Make better use of formatAddress function for clients listing

This commit is contained in:
johnnyq
2026-07-24 12:22:15 -04:00
parent c7b34fe107
commit e7698f15bd
3 changed files with 11 additions and 11 deletions

View File

@@ -333,18 +333,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$client_name = escapeHtml($row['client_name']);
$client_type = escapeHtml($row['client_type']);
$location_id = intval($row['location_id']);
$location_country = escapeHtml($row['location_country']);
$location_address = escapeHtml($row['location_address']);
$location_city = escapeHtml($row['location_city']);
$location_state = escapeHtml($row['location_state']);
$location_zip = escapeHtml($row['location_zip']);
$location_address_lines = formatAddress($location_address, $location_city, $location_state, $location_zip, '', '<br>');
if ($location_address_lines === '') {
$location_address_display = "-";
} else {
$location_country_line = $location_country ? "<div><small>$location_country</small></div>" : '';
$location_address_display = "<div class='media'><i class='fa fa-fw fa-map-marker-alt text-secondary mt-1 mr-2'></i><div class='media-body'>$location_address_lines$location_country_line</div></div>";
}
$location_country = escapeHtml($row['location_country']);
$full_address = formatAddress($location_address, $location_city, $location_state, $location_zip, $location_country, '<br>') ?: '-';
$contact_id = intval($row['contact_id']);
$contact_name = escapeHtml($row['contact_name']);
$contact_title = escapeHtml($row['contact_title']);
@@ -501,7 +495,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<?php } ?>
</td>
<td><?php echo $location_address_display; ?></td>
<td><?= $full_address ?></td>
<!-- Show Billing if perms & if accounting module is enabled -->
<?php if ((lookupUserPermission("module_financial") >= 1) && $config_module_enable_accounting == 1) { ?>
<td class="text-right">

View File

@@ -63,6 +63,7 @@ if (isset($_GET['client_id'])) {
$location_state = escapeHtml($row['location_state']);
$location_zip = escapeHtml($row['location_zip']);
$location_country = escapeHtml($row['location_country']);
$location_full_address = formatAddress($location_address, $location_city, $location_state, $location_zip, $location_country, '<br>') ?: '-';
$location_phone_country_code = escapeHtml($row['location_phone_country_code']);
$location_phone = escapeHtml(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
$location_primary = intval($row['location_primary']);

View File

@@ -264,11 +264,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$location_id = intval($row['location_id']);
$location_name = escapeHtml($row['location_name']);
$location_description = escapeHtml($row['location_description']);
$location_country = escapeHtml($row['location_country']);
$location_address = escapeHtml($row['location_address']);
$location_city = escapeHtml($row['location_city']);
$location_state = escapeHtml($row['location_state']);
$location_zip = escapeHtml($row['location_zip']);
$location_country = escapeHtml($row['location_country']);
$full_address = formatAddress($location_address, $location_city, $location_state, $location_zip, $location_country, '<br>') ?: '-';
$location_phone_country_code = escapeHtml($row['location_phone_country_code']);
$location_phone = escapeHtml(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
if (empty($location_phone)) {
@@ -349,7 +350,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</a>
</td>
<td><a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$location_address $location_zip"; ?>" target="_blank"><?php echo formatAddress($location_address, $location_city, $location_state, $location_zip, '', '<br>'); ?><?php echo $location_country ? "<br><small>$location_country</small>" : ''; ?></a></td>
<td>
<a href="//maps.<?= $session_map_source ?>.com?q=<?= "$location_address $location_zip" ?>"
target="_blank"><?= $full_address ?>
</a>
</td>
<td>
<?php echo $location_phone_display; ?>
<?php echo $location_fax_display; ?>