Add formatAddress function and replace all addresses with it

This commit is contained in:
johnnyq
2026-07-23 18:10:39 -04:00
parent 9c65644adc
commit 41b118ab87
17 changed files with 60 additions and 40 deletions

View File

@@ -1462,11 +1462,12 @@ if (isset($_POST["export_client_pdf"])) {
$html .= '<hr>';
// Client header information (non-table)
$location_city_state_zip = formatAddress('', $location_city, $location_state, $location_zip, '', ' ');
$html .= "
<div class='client-header'>
<h3>$client_name</h3>
<p><strong>Address:</strong> $location_address</p>
<p><strong>City State Zip:</strong> $location_city $location_state $location_zip</p>
<p><strong>City State Zip:</strong> $location_city_state_zip</p>
<p><strong>Phone:</strong> $contact_phone</p>
<p><strong>Website:</strong> $client_website</p>
<p><strong>Contact:</strong> $contact_name</p>
@@ -1542,10 +1543,11 @@ if (isset($_POST["export_client_pdf"])) {
$location_zip = escapeHtml($row["location_zip"]);
$location_phone_country_code = escapeHtml($row["location_phone_country_code"]);
$location_phone = escapeHtml(formatPhoneNumber($row["location_phone"], $location_phone_country_code));
$location_full_address = formatAddress($location_address, $location_city, $location_state, $location_zip, '', ' ');
$html .= "
<tr>
<td>$location_name</td>
<td>$location_address $location_city $location_state $location_zip</td>
<td>$location_full_address</td>
<td>$location_phone</td>
</tr>";
}

View File

@@ -892,8 +892,8 @@ if (isset($_GET['export_invoice_pdf'])) {
<td width="50%" align="right" style="font-size:14pt; font-weight:bold;">' . $client_name . '</td>
</tr>
<tr>
<td style="font-size:10pt; line-height:1.4;">' . nl2br("$company_address\n$company_city $company_state $company_zip\n$company_country\n$company_phone\n$company_website\n$company_tax_id_display") . '</td>
<td style="font-size:10pt; line-height:1.4;" align="right">' . nl2br("$location_address\n$location_city $location_state $location_zip\n$location_country\n$contact_email\n$contact_phone") . '</td>
<td style="font-size:10pt; line-height:1.4;">' . nl2br(formatAddress($company_address, $company_city, $company_state, $company_zip, $company_country) . "\n$company_phone\n$company_website\n$company_tax_id_display") . '</td>
<td style="font-size:10pt; line-height:1.4;" align="right">' . nl2br(formatAddress($location_address, $location_city, $location_state, $location_zip, $location_country) . "\n$contact_email\n$contact_phone") . '</td>
</tr>
</table><br>';
@@ -1074,8 +1074,8 @@ if (isset($_GET['export_invoice_packing_slip'])) {
<td width="50%" align="right" style="font-size:14pt; font-weight:bold;">' . $client_name . '</td>
</tr>
<tr>
<td style="font-size:10pt; line-height:1.4;">' . nl2br("$company_address\n$company_city $company_state $company_zip\n$company_country\n$company_phone\n$company_website") . '</td>
<td style="font-size:10pt; line-height:1.4;" align="right">' . nl2br("$location_address\n$location_city $location_state $location_zip\n$location_country\n$contact_email\n$contact_phone") . '</td>
<td style="font-size:10pt; line-height:1.4;">' . nl2br(formatAddress($company_address, $company_city, $company_state, $company_zip, $company_country) . "\n$company_phone\n$company_website") . '</td>
<td style="font-size:10pt; line-height:1.4;" align="right">' . nl2br(formatAddress($location_address, $location_city, $location_state, $location_zip, $location_country) . "\n$contact_email\n$contact_phone") . '</td>
</tr>
</table><br>';

View File

@@ -871,8 +871,8 @@ if (isset($_GET['export_quote_pdf'])) {
<td width="50%" align="right" style="font-size:14pt; font-weight:bold;">' . $client_name . '</td>
</tr>
<tr>
<td style="font-size:10pt; line-height:1.4;">' . nl2br("$company_address\n$company_city $company_state $company_zip\n$company_country\n$company_phone\n$company_website") . '</td>
<td style="font-size:10pt; line-height:1.4;" align="right">' . nl2br("$location_address\n$location_city $location_state $location_zip\n$location_country\n$contact_email\n$contact_phone") . '</td>
<td style="font-size:10pt; line-height:1.4;">' . nl2br(formatAddress($company_address, $company_city, $company_state, $company_zip, $company_country) . "\n$company_phone\n$company_website") . '</td>
<td style="font-size:10pt; line-height:1.4;" align="right">' . nl2br(formatAddress($location_address, $location_city, $location_state, $location_zip, $location_country) . "\n$contact_email\n$contact_phone") . '</td>
</tr>
</table><br>';