Update destination_edit.php

Prevent fax details from duplicating, fix trailing spaces, and adjust some indentation.
This commit is contained in:
FusionPBX 2016-08-03 00:06:36 -06:00 committed by GitHub
parent bb17126542
commit 462bb54a9b
1 changed files with 124 additions and 94 deletions

View File

@ -304,6 +304,18 @@
}
unset ($prep_statement);
//delete previous fax detection settings
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
$sql .= "and (";
$sql .= " dialplan_detail_data like '%tone_detect%' ";
$sql .= " or dialplan_detail_type = 'tone_detect' ";
$sql .= " or (dialplan_detail_type = 'sleep' and dialplan_detail_data = '3000') ";
$sql .= ")";
$db->exec($sql);
unset($sql);
//add set tone detect_hits=1
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
@ -480,7 +492,6 @@
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
//initialize the destinations object
$destination = new destinations;
@ -536,6 +547,25 @@
}
unset($limit);
//remove previous fax details
$x=0;
foreach($dialplan_details as $row) {
if ($row['dialplan_detail_data'] == "tone_detect_hits=1") {
unset($dialplan_details[$x]);
}
if ($row['dialplan_detail_type'] == "tone_detect") {
unset($dialplan_details[$x]);
}
if ($row['dialplan_detail_type'] == "sleep") {
unset($dialplan_details[$x]);
}
if (substr($dialplan_detail_data,0,22) == "execute_on_tone_detect") {
unset($dialplan_details[$x]);
}
//increment the row id
$x++;
}
//set the defaults
if (strlen($destination_type) == 0) { $destination_type = 'inbound'; }
if (strlen($destination_context) == 0) { $destination_context = 'public'; }