Remove one of the sql queries that was in dialplan -> destinations

This commit is contained in:
Mark Crane
2014-05-30 07:24:06 +00:00
parent 3c603dbc5d
commit acd24da012

View File

@@ -54,6 +54,7 @@ else {
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
$destination_type = check_str($_POST["destination_type"]);
$destination_number = check_str($_POST["destination_number"]);
$db_destination_number = check_str($_POST["destination_number"]);
$destination_caller_id_name = check_str($_POST["destination_caller_id_name"]);
$destination_caller_id_number = check_str($_POST["destination_caller_id_number"]);
$destination_context = check_str($_POST["destination_context"]);
@@ -78,17 +79,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($destination_context) == 0) { $msg .= $text['message-required']." ".$text['label-destination_context']."<br>\n"; }
if (strlen($destination_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."<br>\n"; }
//get the current destination_number
$db_destination_number = '';
$sql = "select destination_number from v_destinations ";
$sql .= "where destination_uuid = '".$destination_uuid."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$db_destination_number = $row['destination_number'];
}
//check for duplicates
if ($action == "add" || $destination_number != $db_destination_number) {
$sql = "select count(*) as num_rows from v_destinations ";
@@ -542,6 +532,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='db_destination_number' value='$destination_number'>\n";
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
echo " <input type='hidden' name='destination_uuid' value='$destination_uuid'>\n";
}