From fe2c8ed41fb1f3065f7ab577ca21900b34cdea79 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Wed, 18 Mar 2015 07:28:05 +0000 Subject: [PATCH] Destinations: Removed attempt to create a dialplan entry when no Action is selected. Resolves Issue 867. --- app/destinations/destination_edit.php | 10 +++++++--- app/destinations/destinations.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 55e8f58ac3..a777fbf96e 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -99,8 +99,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $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_caller_id_name) == 0) { $msg .= $text['message-required']." ".$text['label-destination_caller_id_name']."
\n"; } - //if (strlen($destination_caller_id_number) == 0) { $msg .= $text['message-required']." ".$text['label-destination_caller_id_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"; } @@ -146,6 +144,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //add or update the dialplan if the destination number is set if ($add_dialplan) { + //get the array $dialplan_details = $_POST["dialplan_details"]; @@ -363,7 +362,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } $orm->save($dialplan); $dialplan_response = $orm->message; - //print_r($dialplan_response); //synchronize the xml config save_dialplan_xml(); @@ -373,6 +371,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $cache->delete("dialplan:".$destination_context); } //add or update the dialplan if the destination number is set + else { + + //remove empty dialplan details from POST array so doesn't attempt to insert below + unset($_POST["dialplan_details"]); + + } //get the destination_uuid if (strlen($dialplan_response['uuid']) > 0) { diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 17ba1025ef..b79d444818 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -174,7 +174,7 @@ else { echo " ".$row['destination_number']."\n"; echo " ".$row['destination_context']."\n"; echo " ".ucwords($row['destination_enabled'])."\n"; - echo " ".$row['destination_description']."\n"; + echo " ".$row['destination_description']." \n"; echo " "; echo "$v_link_label_edit"; echo "$v_link_label_delete";