From e616fad12ebcc7259a859771cbf8aaf34387000f Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Tue, 5 May 2015 04:50:23 +0000 Subject: [PATCH] Add the format number to destinations list and adjust the function to only process numeric. --- app/destinations/destinations.php | 2 +- resources/functions.php | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 5caafc6850..79384d6794 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -178,7 +178,7 @@ else { echo " ".$_SESSION['domains'][$row['domain_uuid']]['domain_name']."\n"; } echo " ".ucwords($row['destination_type'])."\n"; - echo " ".$row['destination_number']."\n"; + echo " ".format_phone($row['destination_number'])."\n"; echo " ".$row['destination_context']."\n"; echo " ".ucwords($row['destination_enabled'])."\n"; echo " ".$row['destination_description']." \n"; diff --git a/resources/functions.php b/resources/functions.php index 69b33d3933..79c9cc14ca 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -771,13 +771,15 @@ function format_string ($format, $data) { //get the format and use it to format the phone number function format_phone($phone_number) { - foreach ($_SESSION["format"]["phone"] as &$format) { - $format_count = substr_count($format, 'x'); - $format_count = $format_count + substr_count($format, 'R'); - $format_count = $format_count + substr_count($format, 'r'); - if ($format_count == strlen($phone_number)) { - //format the number - $phone_number = format_string($format, $phone_number); + if (is_numeric($phone_number)) { + foreach ($_SESSION["format"]["phone"] as &$format) { + $format_count = substr_count($format, 'x'); + $format_count = $format_count + substr_count($format, 'R'); + $format_count = $format_count + substr_count($format, 'r'); + if ($format_count == strlen($phone_number)) { + //format the number + $phone_number = format_string($format, $phone_number); + } } } return $phone_number;