diff --git a/asset_details.php b/asset_details.php index 8c09d235..cb020ec9 100644 --- a/asset_details.php +++ b/asset_details.php @@ -592,7 +592,7 @@ if (isset($_GET['asset_id'])) {
ALL Contacts
+ALL Locations
+ +Locations diff --git a/client_locations.php b/locations.php similarity index 89% rename from client_locations.php rename to locations.php index b0874c12..9c10745d 100644 --- a/client_locations.php +++ b/locations.php @@ -4,7 +4,16 @@ $sort = "location_name"; $order = "ASC"; -require_once "includes/inc_all_client.php"; +// If client_id is in URI then show client Side Bar and client header +if (isset($_GET['client_id'])) { + require_once "includes/inc_all_client.php"; + $client_query = "AND location_client_id = $client_id"; + $client_url = "client_id=$client_id&"; +} else { + require_once "includes/inc_client_overview_all.php"; + $client_query = ''; + $client_url = ''; +} // Tags Filter if (isset($_GET['tags']) && is_array($_GET['tags']) && !empty($_GET['tags'])) { @@ -27,13 +36,14 @@ $url_query_strings_sort = http_build_query($get_copy); $sql = mysqli_query( $mysqli, - "SELECT SQL_CALC_FOUND_ROWS locations.*, GROUP_CONCAT(tag_name) FROM locations + "SELECT SQL_CALC_FOUND_ROWS locations.*, clients.*, GROUP_CONCAT(tag_name) FROM locations + LEFT JOIN clients ON client_id = location_client_id LEFT JOIN location_tags ON location_tags.location_id = locations.location_id LEFT JOIN tags ON tags.tag_id = location_tags.tag_id - WHERE location_client_id = $client_id + WHERE location_$archive_query $tag_query - AND location_$archive_query - AND (location_name LIKE '%$q%' OR location_description LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%' OR tag_name LIKE '%$q%') + AND (location_name LIKE '%$q%' OR location_description LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%' OR tag_name LIKE '%$q%' OR client_name LIKE '%$q%') + $client_query GROUP BY location_id ORDER BY location_primary DESC, $sort $order LIMIT $record_from, $record_to" ); @@ -67,7 +77,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));