Add the format number to destinations list and adjust the function to only process numeric.

This commit is contained in:
Mark Crane
2015-05-05 04:50:23 +00:00
parent 872fa20983
commit e616fad12e
2 changed files with 10 additions and 8 deletions

View File

@@ -178,7 +178,7 @@ else {
echo " <td valign='top' class='".$row_style[$c]."'>".$_SESSION['domains'][$row['domain_uuid']]['domain_name']."</td>\n";
}
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['destination_type'])."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='destination_edit.php?id=".$row['destination_uuid']."'>".$row['destination_number']."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='destination_edit.php?id=".$row['destination_uuid']."'>".format_phone($row['destination_number'])."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_context']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['destination_enabled'])."</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['destination_description']."&nbsp;</td>\n";

View File

@@ -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;