From ed0afd7be5ea9bbf94f47510d6d81c016169fc15 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 6 Sep 2019 05:09:57 -0600 Subject: [PATCH] Update destination_edit.php --- app/destinations/destination_edit.php | 38 ++++++++++++++++++++------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 90bd264dfe..ec0f72e5ec 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -148,7 +148,7 @@ //check for all required data $msg = ''; if (strlen($destination_type) == 0) { $msg .= $text['message-required']." ".$text['label-destination_type']."
\n"; } - if (strlen($destination_number) == 0) { $msg .= $text['message-required']." ".$text['label-destination_number']."
\n"; } + //if (strlen($destination_number) == 0) { $msg .= $text['message-required']." ".$text['label-destination_number']."
\n"; } if (strlen($destination_context) == 0) { $msg .= $text['message-required']." ".$text['label-destination_context']."
\n"; } if (strlen($destination_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."
\n"; } @@ -194,14 +194,14 @@ } //get the fax information - if (strlen($fax_uuid) > 0) { + if (is_uuid($fax_uuid)) { $sql = "select * from v_fax "; $sql .= "where fax_uuid = :fax_uuid "; - if (!permission_exists('destination_domain')) { - $sql .= "and domain_uuid = :domain_uuid "; - } + //if (!permission_exists('destination_domain')) { + // $sql .= "and domain_uuid = :domain_uuid "; + //} $parameters['fax_uuid'] = $fax_uuid; - $parameters['domain_uuid'] = $domain_uuid; + //$parameters['domain_uuid'] = $domain_uuid; $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0) { @@ -218,6 +218,19 @@ unset($sql, $parameters, $row); } + //get the destination_number + if ($action == 'update' && !permission_exists('destination_number') && is_uuid($destination_uuid)) { + $sql = "select * from v_destinations "; + $sql .= "where destination_uuid = :destination_uuid "; + $parameters['destination_uuid'] = $destination_uuid; + $database = new database; + $row = $database->select($sql, $parameters, 'row'); + if (is_array($row) && @sizeof($row) != 0) { + $destination_number = $row["destination_number"]; + } + unset($sql, $parameters, $row); + } + //if empty then get new uuid if (!is_uuid($dialplan_uuid)) { $dialplan_uuid = uuid(); @@ -901,9 +914,14 @@ echo " ".$text['label-destination_number']."\n"; echo "\n"; echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-destination_number']."\n"; + if (permission_exists('destination_number')) { + echo " \n"; + echo "
\n"; + echo $text['description-destination_number']."\n"; + } + else { + echo escape($destination_number)."\n"; + } echo "\n"; echo "\n"; @@ -1177,4 +1195,4 @@ //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?>