Destinations - Add ability to set condition field on per destination (#5301)

* Update destination_edit.php

* Update app_languages.php

* Update app_config.php
This commit is contained in:
agree
2020-06-11 01:07:12 -04:00
committed by GitHub
parent 4b405f6b9b
commit 47c8ceb521
3 changed files with 78 additions and 3 deletions

View File

@@ -82,6 +82,9 @@
$apps[$x]['permissions'][$y]['name'] = "destination_number";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "destination_condition_field";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "destination_caller_id_name";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
@@ -174,6 +177,10 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the prefix.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "destination_condition_field";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the condition.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_number_regex";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Regular Expression version of destination number";

View File

@@ -484,6 +484,27 @@ $text['label-destination_prefix']['ru-ru'] = "";
$text['label-destination_prefix']['sv-se'] = "";
$text['label-destination_prefix']['uk-ua'] = "";
$text['label-destination_condition_field']['en-us'] = "Condition";
$text['label-destination_condition_field']['en-gb'] = "Condition";
$text['label-destination_condition_field']['ar-eg'] = "";
$text['label-destination_condition_field']['de-at'] = ""; //copied from de-de
$text['label-destination_condition_field']['de-ch'] = ""; //copied from de-de
$text['label-destination_condition_field']['de-de'] = "";
$text['label-destination_condition_field']['es-cl'] = "";
$text['label-destination_condition_field']['es-mx'] = ""; //copied from es-cl
$text['label-destination_condition_field']['fr-ca'] = ""; //copied from fr-fr
$text['label-destination_condition_field']['fr-fr'] = "";
$text['label-destination_condition_field']['he-il'] = "";
$text['label-destination_condition_field']['it-it'] = "";
$text['label-destination_condition_field']['nl-nl'] = "";
$text['label-destination_condition_field']['pl-pl'] = "";
$text['label-destination_condition_field']['pt-br'] = ""; //copied from pt-pt
$text['label-destination_condition_field']['pt-pt'] = "";
$text['label-destination_condition_field']['ro-ro'] = "";
$text['label-destination_condition_field']['ru-ru'] = "";
$text['label-destination_condition_field']['sv-se'] = "";
$text['label-destination_condition_field']['uk-ua'] = "";
$text['label-destination_enabled']['en-us'] = "Enabled";
$text['label-destination_enabled']['en-gb'] = "Enabled";
$text['label-destination_enabled']['ar-eg'] = "مفعل";
@@ -1009,6 +1030,27 @@ $text['description-destination_number']['ru-ru'] = "Введите номер н
$text['description-destination_number']['sv-se'] = "Ange destinationen.";
$text['description-destination_number']['uk-ua'] = "Введіть номер";
$text['description-destination_condition_field']['en-us'] = "Enter the destination condition.";
$text['description-destination_condition_field']['en-gb'] = "Enter the destination condition.";
$text['description-destination_condition_field']['ar-eg'] = "";
$text['description-destination_condition_field']['de-at'] = ""; //copied from de-de
$text['description-destination_condition_field']['de-ch'] = ""; //copied from de-de
$text['description-destination_condition_field']['de-de'] = "";
$text['description-destination_condition_field']['es-cl'] = "";
$text['description-destination_condition_field']['es-mx'] = ""; //copied from es-cl
$text['description-destination_condition_field']['fr-ca'] = ""; //copied from fr-fr
$text['description-destination_condition_field']['fr-fr'] = "";
$text['description-destination_condition_field']['he-il'] = "";
$text['description-destination_condition_field']['it-it'] = "";
$text['description-destination_condition_field']['nl-nl'] = "";
$text['description-destination_condition_field']['pl-pl'] = "";
$text['description-destination_condition_field']['pt-br'] = "";
$text['description-destination_condition_field']['pt-pt'] = "";
$text['description-destination_condition_field']['ro-ro'] = "";
$text['description-destination_condition_field']['ru-ru'] = "";
$text['description-destination_condition_field']['sv-se'] = "";
$text['description-destination_condition_field']['uk-ua'] = "";
$text['description-destination_prefix']['en-us'] = "Enter the destination prefix.";
$text['description-destination_prefix']['en-gb'] = "Enter the destination prefix.";
$text['description-destination_prefix']['ar-eg'] = "";

View File

@@ -84,6 +84,7 @@
$dialplan_uuid = trim($_POST["dialplan_uuid"]);
$domain_uuid = trim($_POST["domain_uuid"]);
$destination_type = trim($_POST["destination_type"]);
$destination_condition_field = trim($_POST["destination_condition_field"]);
$destination_number = trim($_POST["destination_number"]);
$destination_prefix = trim($_POST["destination_prefix"]);
$db_destination_number = trim($_POST["db_destination_number"]);
@@ -237,6 +238,9 @@
$destination_number = $row["destination_number"];
$destination_prefix = $row["destination_prefix"];
}
if (!permission_exists('destination_condition_field')) {
$destination_condition_field = $row["destination_condition_field"];
}
if (!permission_exists('destination_context')) {
$destination_context = $row["destination_context"];
}
@@ -274,7 +278,10 @@
$dialplan_detail_order = 10;
//set the dialplan detail type
if (strlen($_SESSION['dialplan']['destination']['text']) > 0) {
if (strlen($destination_condition_field) > 0) {
$dialplan_detail_type = $destination_condition_field;
}
elseif (strlen($_SESSION['dialplan']['destination']['text']) > 0) {
$dialplan_detail_type = $_SESSION['dialplan']['destination']['text'];
}
else {
@@ -348,7 +355,10 @@
//check the destination number
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
if (strlen($_SESSION['dialplan']['destination']['text']) > 0) {
if (strlen($destination_condition_field) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $destination_condition_field;
}
elseif (strlen($_SESSION['dialplan']['destination']['text']) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text'];
}
else {
@@ -593,6 +603,9 @@
$array['destinations'][0]["dialplan_uuid"] = $dialplan_uuid;
$array['destinations'][0]["fax_uuid"] = $fax_uuid;
$array['destinations'][0]["destination_type"] = $destination_type;
if (permission_exists('destination_condition_field')) {
$array['destinations'][0]["destination_condition_field"] = $destination_condition_field;
}
if (permission_exists('destination_number')) {
$array['destinations'][0]["destination_number"] = $destination_number;
$array['destinations'][0]["destination_number_regex"] = $destination_number_regex;
@@ -617,7 +630,6 @@
}
$array['destinations'][0]["destination_enabled"] = $destination_enabled;
$array['destinations'][0]["destination_description"] = $destination_description;
//prepare the array
$array['dialplans'][] = $dialplan;
unset($dialplan);
@@ -713,6 +725,7 @@
$dialplan_uuid = $row["dialplan_uuid"];
$destination_type = $row["destination_type"];
$destination_number = $row["destination_number"];
$destination_condition_field = $row["destination_condition_field"];
$destination_prefix = $row["destination_prefix"];
$destination_caller_id_name = $row["destination_caller_id_name"];
$destination_caller_id_number = $row["destination_caller_id_number"];
@@ -943,6 +956,19 @@
}
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('destination_condition_field')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_condition_field']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_condition_field' maxlength='32' value=\"".escape($destination_condition_field)."\">\n";
echo "<br />\n";
echo $text['description-destination_condition_field']."\n";
echo "</td>\n";
echo "</tr>\n";
}
if (permission_exists('destination_caller_id_name')) {
echo "<tr id='tr_caller_id_name'>\n";