Skip to content

Commit 07b29a7

Browse files
committed
Add Phone Country code in more places for proper phone number formatting
1 parent 3286343 commit 07b29a7

18 files changed

+88
-43
lines changed

ajax/ajax_contact_details.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
$contact_name = nullable_htmlentities($row['contact_name']);
1919
$contact_title = nullable_htmlentities($row['contact_title']);
2020
$contact_department =nullable_htmlentities($row['contact_department']);
21-
$contact_phone = formatPhoneNumber($row['contact_phone']);
21+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
22+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
2223
$contact_extension = nullable_htmlentities($row['contact_extension']);
23-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
24+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
25+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_mobile_country_code));
2426
$contact_email = nullable_htmlentities($row['contact_email']);
2527
$contact_photo = nullable_htmlentities($row['contact_photo']);
2628
$contact_pin = nullable_htmlentities($row['contact_pin']);

ajax/ajax_vendor_edit.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$vendor_account_number = nullable_htmlentities($row['vendor_account_number']);
1313
$vendor_contact_name = nullable_htmlentities($row['vendor_contact_name']);
1414
$vendor_phone_country_code = nullable_htmlentities($row['vendor_phone_country_code']);
15-
$vendor_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $vendor_phone_country_code));
15+
$vendor_phone = nullable_htmlentities(formatPhoneNumber($row['vendor_phone'], $vendor_phone_country_code));
1616
$vendor_extension = nullable_htmlentities($row['vendor_extension']);
1717
$vendor_email = nullable_htmlentities($row['vendor_email']);
1818
$vendor_website = nullable_htmlentities($row['vendor_website']);

client_overview.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,11 @@
221221
$contact_name = nullable_htmlentities($row['contact_name']);
222222
$contact_title = nullable_htmlentities($row['contact_title']);
223223
$contact_email = nullable_htmlentities($row['contact_email']);
224-
$contact_phone = formatPhoneNumber($row['contact_phone']);
224+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
225+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
225226
$contact_extension = nullable_htmlentities($row['contact_extension']);
226-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
227+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
228+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
227229

228230
?>
229231
<tr>

clients.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,11 @@ class="collapse mt-3
291291
$contact_id = intval($row['contact_id']);
292292
$contact_name = nullable_htmlentities($row['contact_name']);
293293
$contact_title = nullable_htmlentities($row['contact_title']);
294-
$contact_phone = formatPhoneNumber($row['contact_phone']);
294+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
295+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
295296
$contact_extension = nullable_htmlentities($row['contact_extension']);
296-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
297+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
298+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
297299
$contact_email = nullable_htmlentities($row['contact_email']);
298300
$client_website = nullable_htmlentities($row['client_website']);
299301
$client_rate = floatval($row['client_rate']);

contact_details.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
$contact_name = nullable_htmlentities($row['contact_name']);
2929
$contact_title = nullable_htmlentities($row['contact_title']);
3030
$contact_department =nullable_htmlentities($row['contact_department']);
31-
$contact_phone = formatPhoneNumber($row['contact_phone']);
31+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
32+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
3233
$contact_extension = nullable_htmlentities($row['contact_extension']);
33-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
34+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
35+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_mobile_country_code));
3436
$contact_email = nullable_htmlentities($row['contact_email']);
3537
$contact_photo = nullable_htmlentities($row['contact_photo']);
3638
$contact_pin = nullable_htmlentities($row['contact_pin']);

global_search.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@
172172
while ($row = mysqli_fetch_array($sql_clients)) {
173173
$client_id = intval($row['client_id']);
174174
$client_name = nullable_htmlentities($row['client_name']);
175-
$location_phone = formatPhoneNumber($row['location_phone']);
175+
$location_phone_country_code = nullable_htmlentities($row['location_phone_country_code']);
176+
$location_phone = nullable_htmlentities(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
176177
$client_website = nullable_htmlentities($row['client_website']);
177178

178179
?>
@@ -218,9 +219,11 @@
218219
$contact_id = intval($row['contact_id']);
219220
$contact_name = nullable_htmlentities($row['contact_name']);
220221
$contact_title = nullable_htmlentities($row['contact_title']);
221-
$contact_phone = formatPhoneNumber($row['contact_phone']);
222+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
223+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
222224
$contact_extension = nullable_htmlentities($row['contact_extension']);
223-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
225+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
226+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
224227
$contact_email = nullable_htmlentities($row['contact_email']);
225228
$client_id = intval($row['client_id']);
226229
$client_name = nullable_htmlentities($row['client_name']);
@@ -272,7 +275,8 @@
272275
while ($row = mysqli_fetch_array($sql_vendors)) {
273276
$vendor_name = nullable_htmlentities($row['vendor_name']);
274277
$vendor_description = nullable_htmlentities($row['vendor_description']);
275-
$vendor_phone = formatPhoneNumber($row['vendor_phone']);
278+
$vendor_phone_country_code = nullable_htmlentities($row['vendor_phone_country_code']);
279+
$vendor_phone = nullable_htmlentities(formatPhoneNumber($row['vendor_phone'], $vendor_phone_country_code));
276280
$client_id = intval($row['client_id']);
277281
$client_name = nullable_htmlentities($row['client_name']);
278282

guest/guest_view_invoice.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@
5151
$location_state = nullable_htmlentities($row['location_state']);
5252
$location_zip = nullable_htmlentities($row['location_zip']);
5353
$contact_email = nullable_htmlentities($row['contact_email']);
54-
$contact_phone = formatPhoneNumber($row['contact_phone']);
54+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
55+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
5556
$contact_extension = nullable_htmlentities($row['contact_extension']);
56-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
57+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
58+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
5759
$client_website = nullable_htmlentities($row['client_website']);
5860
$client_currency_code = nullable_htmlentities($row['client_currency_code']);
5961
$client_net_terms = intval($row['client_net_terms']);
@@ -69,7 +71,8 @@
6971
$company_city = nullable_htmlentities($row['company_city']);
7072
$company_state = nullable_htmlentities($row['company_state']);
7173
$company_zip = nullable_htmlentities($row['company_zip']);
72-
$company_phone = formatPhoneNumber($row['company_phone']);
74+
$company_phone_country_code = nullable_htmlentities($row['company_phone_country_code']);
75+
$company_phone = nullable_htmlentities(formatPhoneNumber($row['company_phone'], $company_phone_country_code));
7376
$company_email = nullable_htmlentities($row['company_email']);
7477
$company_website = nullable_htmlentities($row['company_website']);
7578
$company_logo = nullable_htmlentities($row['company_logo']);

guest/guest_view_item.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
$company_city = nullable_htmlentities($row['company_city']);
2424
$company_state = nullable_htmlentities($row['company_state']);
2525
$company_zip = nullable_htmlentities($row['company_zip']);
26-
$company_phone = formatPhoneNumber($row['company_phone']);
26+
$company_phone_country_code = nullable_htmlentities($row['company_phone_country_code']);
27+
$company_phone = nullable_htmlentities(formatPhoneNumber($row['company_phone'], $company_phone_country_code));
2728
$company_email = nullable_htmlentities($row['company_email']);
2829
$company_website = nullable_htmlentities($row['company_website']);
2930
$company_logo = nullable_htmlentities($row['company_logo']);

guest/guest_view_quote.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@
5252
$location_state = nullable_htmlentities($row['location_state']);
5353
$location_zip = nullable_htmlentities($row['location_zip']);
5454
$contact_email = nullable_htmlentities($row['contact_email']);
55-
$contact_phone = formatPhoneNumber($row['contact_phone']);
55+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
56+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
5657
$contact_extension = nullable_htmlentities($row['contact_extension']);
57-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
58+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
59+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
5860
$client_website = nullable_htmlentities($row['client_website']);
5961
$client_currency_code = nullable_htmlentities($row['client_currency_code']);
6062
$client_net_terms = intval($row['client_net_terms']);
@@ -69,7 +71,8 @@
6971
$company_city = nullable_htmlentities($row['company_city']);
7072
$company_state = nullable_htmlentities($row['company_state']);
7173
$company_zip = nullable_htmlentities($row['company_zip']);
72-
$company_phone = formatPhoneNumber($row['company_phone']);
74+
$company_phone_country_code = nullable_htmlentities($row['company_phone_country_code']);
75+
$company_phone = nullable_htmlentities(formatPhoneNumber($row['company_phone'], $company_phone_country_code));
7376
$company_email = nullable_htmlentities($row['company_email']);
7477
$company_website = nullable_htmlentities($row['company_website']);
7578
$company_logo = nullable_htmlentities($row['company_logo']);

guest/guest_view_ticket.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
// Company info
2020
$company_sql_row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT company_phone, company_website FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1"));
21-
$company_phone = formatPhoneNumber($company_sql_row['company_phone']);
21+
$company_phone_country_code = nullable_htmlentities($company_sql_row['company_phone_country_code']);
22+
$company_phone = nullable_htmlentities(formatPhoneNumber($company_sql_row['company_phone'], $company_phone_country_code));
2223
$company_website = nullable_htmlentities($company_sql_row['company_website']);
2324

2425
$url_key = sanitizeInput($_GET['url_key']);

includes/inc_all_client.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@
6161
$contact_name = nullable_htmlentities($row['contact_name']);
6262
$contact_title = nullable_htmlentities($row['contact_title']);
6363
$contact_email = nullable_htmlentities($row['contact_email']);
64-
$contact_phone = formatPhoneNumber($row['contact_phone']);
64+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
65+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
6566
$contact_extension = nullable_htmlentities($row['contact_extension']);
66-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
67+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
68+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
6769
$contact_primary = intval($row['contact_primary']);
6870
$location_id = intval($row['location_id']);
6971
$location_name = nullable_htmlentities($row['location_name']);
@@ -72,7 +74,8 @@
7274
$location_state = nullable_htmlentities($row['location_state']);
7375
$location_zip = nullable_htmlentities($row['location_zip']);
7476
$location_country = nullable_htmlentities($row['location_country']);
75-
$location_phone = formatPhoneNumber($row['location_phone']);
77+
$location_phone_country_code = nullable_htmlentities($row['location_phone_country_code']);
78+
$location_phone = nullable_htmlentities(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
7679
$location_primary = intval($row['location_primary']);
7780

7881
// Tab Title // No Sanitizing needed

invoice.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@
5454
$location_state = nullable_htmlentities($row['location_state']);
5555
$location_zip = nullable_htmlentities($row['location_zip']);
5656
$contact_email = nullable_htmlentities($row['contact_email']);
57-
$contact_phone = formatPhoneNumber($row['contact_phone']);
57+
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
58+
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
5859
$contact_extension = nullable_htmlentities($row['contact_extension']);
59-
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
60+
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
61+
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
6062
$client_website = nullable_htmlentities($row['client_website']);
6163
$client_currency_code = nullable_htmlentities($row['client_currency_code']);
6264
$client_net_terms = intval($row['client_net_terms']);
@@ -77,7 +79,8 @@
7779
$company_city = nullable_htmlentities($row['company_city']);
7880
$company_state = nullable_htmlentities($row['company_state']);
7981
$company_zip = nullable_htmlentities($row['company_zip']);
80-
$company_phone = formatPhoneNumber($row['company_phone']);
82+
$company_phone_country_code = nullable_htmlentities($row['company_phone_country_code']);
83+
$company_phone = nullable_htmlentities(formatPhoneNumber($row['company_phone'], $company_phone_country_code));
8184
$company_email = nullable_htmlentities($row['company_email']);
8285
$company_website = nullable_htmlentities($row['company_website']);
8386
$company_logo = nullable_htmlentities($row['company_logo']);

locations.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,15 @@ class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"
249249
$location_city = nullable_htmlentities($row['location_city']);
250250
$location_state = nullable_htmlentities($row['location_state']);
251251
$location_zip = nullable_htmlentities($row['location_zip']);
252-
$location_phone = formatPhoneNumber($row['location_phone']);
252+
$location_phone_country_code = nullable_htmlentities($row['location_phone_country_code']);
253+
$location_phone = nullable_htmlentities(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
253254
if (empty($location_phone)) {
254255
$location_phone_display = "-";
255256
} else {
256257
$location_phone_display = $location_phone;
257258
}
258-
$location_fax = formatPhoneNumber($row['location_fax']);
259+
$location_fax_country_code = nullable_htmlentities($row['location_fax_country_code']);
260+
$location_fax = nullable_htmlentities(formatPhoneNumber($row['location_fax'], $location_fax_country_code));
259261
if ($location_fax) {
260262
$location_fax_display = "<div class='text-secondary'>Fax: $location_fax</div>";
261263
} else {

0 commit comments

Comments
 (0)