Update time_condition_edit.php
This commit is contained in:
parent
3fb1d7ffaa
commit
24e985fdec
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2017
|
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -74,7 +74,9 @@
|
||||||
$dialplan_anti_action_array = explode(":", $dialplan_anti_action);
|
$dialplan_anti_action_array = explode(":", $dialplan_anti_action);
|
||||||
$dialplan_anti_action_app = array_shift($dialplan_anti_action_array);
|
$dialplan_anti_action_app = array_shift($dialplan_anti_action_array);
|
||||||
$dialplan_anti_action_data = join(':', $dialplan_anti_action_array);
|
$dialplan_anti_action_data = join(':', $dialplan_anti_action_array);
|
||||||
|
if (permission_exists('time_condition_context')) {
|
||||||
|
$dialplan_context = check_str($_POST["dialplan_context"]);
|
||||||
|
}
|
||||||
$dialplan_enabled = check_str($_POST["dialplan_enabled"]);
|
$dialplan_enabled = check_str($_POST["dialplan_enabled"]);
|
||||||
$dialplan_description = check_str($_POST["dialplan_description"]);
|
$dialplan_description = check_str($_POST["dialplan_description"]);
|
||||||
|
|
||||||
|
|
@ -106,6 +108,16 @@
|
||||||
$dialplan_name = str_replace(' ', '_', $dialplan_name);
|
$dialplan_name = str_replace(' ', '_', $dialplan_name);
|
||||||
$dialplan_name = str_replace('/', '', $dialplan_name);
|
$dialplan_name = str_replace('/', '', $dialplan_name);
|
||||||
|
|
||||||
|
//set the context for users that do not have the permission
|
||||||
|
if (permission_exists('time_condition_context')) {
|
||||||
|
$dialplan_context = check_str($_POST["dialplan_context"]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($action == 'add') {
|
||||||
|
$dialplan_context = $_SESSION['domain_name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//start the atomic transaction
|
//start the atomic transaction
|
||||||
$count = $db->exec("BEGIN;"); //returns affected rows
|
$count = $db->exec("BEGIN;"); //returns affected rows
|
||||||
|
|
||||||
|
|
@ -141,12 +153,7 @@
|
||||||
$sql .= "'".$dialplan_number."', ";
|
$sql .= "'".$dialplan_number."', ";
|
||||||
$sql .= "'".$dialplan_order."', ";
|
$sql .= "'".$dialplan_order."', ";
|
||||||
$sql .= "'false', ";
|
$sql .= "'false', ";
|
||||||
if (strlen($domain_uuid) == 0) {
|
$sql .= "'".$dialplan_context."', ";
|
||||||
$sql .= "'\${domain_name}', ";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$sql .= "'".$_SESSION['context']."', ";
|
|
||||||
}
|
|
||||||
$sql .= "'".$dialplan_enabled."', ";
|
$sql .= "'".$dialplan_enabled."', ";
|
||||||
$sql .= "'".$dialplan_description."' ";
|
$sql .= "'".$dialplan_description."' ";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
@ -168,11 +175,8 @@
|
||||||
$sql .= "dialplan_number = '".$dialplan_number."', ";
|
$sql .= "dialplan_number = '".$dialplan_number."', ";
|
||||||
$sql .= "dialplan_order = '".$dialplan_order."', ";
|
$sql .= "dialplan_order = '".$dialplan_order."', ";
|
||||||
$sql .= "dialplan_continue = 'true', ";
|
$sql .= "dialplan_continue = 'true', ";
|
||||||
if (strlen($domain_uuid) == 0) {
|
if (strlen($dialplan_context) > 0) {
|
||||||
$sql .= "dialplan_context = '\${domain_name}', ";
|
$sql .= "dialplan_context = '".$dialplan_context."', ";
|
||||||
}
|
|
||||||
else {
|
|
||||||
$sql .= "dialplan_context = '".$_SESSION['context']."', ";
|
|
||||||
}
|
}
|
||||||
$sql .= "dialplan_enabled = '".$dialplan_enabled."', ";
|
$sql .= "dialplan_enabled = '".$dialplan_enabled."', ";
|
||||||
$sql .= "dialplan_description = '".$dialplan_description."' ";
|
$sql .= "dialplan_description = '".$dialplan_description."' ";
|
||||||
|
|
@ -552,9 +556,9 @@
|
||||||
$sql .= "where dialplan_uuid = '".$dialplan_uuid."' ";
|
$sql .= "where dialplan_uuid = '".$dialplan_uuid."' ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
$dialplans = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
if (is_array($result)) {
|
if (is_array($dialplans)) {
|
||||||
foreach ($result as &$row) {
|
foreach ($dialplans as &$row) {
|
||||||
$domain_uuid = $row["domain_uuid"];
|
$domain_uuid = $row["domain_uuid"];
|
||||||
//$app_uuid = $row["app_uuid"];
|
//$app_uuid = $row["app_uuid"];
|
||||||
$dialplan_name = $row["dialplan_name"];
|
$dialplan_name = $row["dialplan_name"];
|
||||||
|
|
@ -591,14 +595,13 @@
|
||||||
$sql .= "order by dialplan_detail_group asc, dialplan_detail_order asc";
|
$sql .= "order by dialplan_detail_group asc, dialplan_detail_order asc";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
$dialplan_details = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
$result_count = count($result);
|
|
||||||
unset ($prep_statement, $sql);
|
unset ($prep_statement, $sql);
|
||||||
|
|
||||||
//load current conditions into array (combined by group), and retrieve action and anti-action
|
//load current conditions into array (combined by group), and retrieve action and anti-action
|
||||||
$c = 0;
|
$c = 0;
|
||||||
if (is_array($result)) {
|
if (is_array($dialplan_details)) {
|
||||||
foreach ($result as $row) {
|
foreach ($dialplan_details as $row) {
|
||||||
if ($row['dialplan_detail_tag'] == 'action') {
|
if ($row['dialplan_detail_tag'] == 'action') {
|
||||||
if ($row['dialplan_detail_group'] == '999') {
|
if ($row['dialplan_detail_group'] == '999') {
|
||||||
$dialplan_anti_action = $row['dialplan_detail_type'].(($row['dialplan_detail_data'] != '') ? ':'.$row['dialplan_detail_data'] : null);
|
$dialplan_anti_action = $row['dialplan_detail_type'].(($row['dialplan_detail_data'] != '') ? ':'.$row['dialplan_detail_data'] : null);
|
||||||
|
|
@ -1162,7 +1165,7 @@ if ($action == 'update') {
|
||||||
echo " ".$text['label-alternate-destination']."\n";
|
echo " ".$text['label-alternate-destination']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo $destination->select('dialplan', 'dialplan_anti_action', $dialplan_anti_action);
|
echo " ".$destination->select('dialplan', 'dialplan_anti_action', $dialplan_anti_action);
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
|
@ -1210,6 +1213,19 @@ if ($action == 'update') {
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (permission_exists('time_condition_context')) {
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-context']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
echo " <input class='formfld' type='text' name='dialplan_context' maxlength='255' value=\"".escape($dialplan_context)."\" required='required'>\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo $text['description-enter-context']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||||
echo " ".$text['label-enabled']."\n";
|
echo " ".$text['label-enabled']."\n";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue