Update boolean toggle and the database boolean type (#7522)

* Change the data type to boolean

* Use boolean values in SQL and Conditional Statements

* Schema Data Types: Drop views so that alter tables statements complete

* Update settings.php

* Add extension for call_screen_enabled

* Gateway handle boolean
Add the boolean toggle
- distinct_to
- caller_id_in_from
- supress_cng
- extension_in_contact
- contact_in_ping

* Update gateways.php

* Update voicemail_edit.php

* Replace the ${caller_id_name} with the extensions caller id name

* Phrase - Edit: Update slide toggle with new select beneath.

* Update the input toggle style

* Set the input_toggle_style_switch as boolean

* Update the input toggle style

* Theme: Adjust CSS to wrap description text on form fields.

* Add domain_uuid and domain_name to the SQL SELECT

* Unset the parameters to fix the next query

* Gateway: Integrate new slide toggle switch.

* Dashboard: Update the input toggle style (#7499)

* Dashboard: Update the input toggle style

* Update dashboard_widget_edit.php

* Update dashboard_edit.php

* Inbound Route - Add: Integrate new slide toggle switch and boolean.

* User Settings: Integrate new slide toggle switch.

* Call Block Edit: Update the input toggle style (#7500)

* Bridge Edit: Update the input toggle style (#7501)

* Update phrases.php

* Update domain_edit.php

* Domain Settings Edit: Update the input toggle style

* User Edit: Update the input toggle style

* Update install.php

* Remove fields marked as deprecated

* Use boolean in the select statement

* Streams: New slide toggle and boolean.

* Streams: Remove unnecessary default.

* Queues (FIFO): New slide toggle.

* Call Detail Records: Update the input toggle style (#7503)

* Call Detail Records: Update the input toggle style

* Update xml_cdr_extension_summary.php

* Update xml_cdr_extension_summary.php

* Update xml_cdr_extension_summary.php

* Call Centers: Update the input toggle style (#7502)

* Call Centers: Update the input toggle style

* Update call_center_agent_edit.php

* Conference Centers: Update the input toggle style (#7506)

* Conference Centers: Update the input toggle style

* Update app_config.php

* Update conference_center_edit.php

* Use boolean data type (#7505)

* Call Flow Edit: Update the input toggle style (#7504)

* Devices: Update the input toggle style

* IVR Menus: New slide toggle.

* IVR Menu: Remove deprected file.

* SIP Profile - Edit: New slide toggle.

* Device Profiles: Update the input toggle style

* Ring Groups - List: Fix syntax.

* Theme: Fire onchange event when switching slide toggle control.

* Device Vendors: Update the input toggle style

* Update enabled boolean

* Update device_edit.php

* Ring Groups: New slide toggle.

* Update domain_edit.php

* Email Templates: Update the input toggle style

* Header: Correct default value on input toggle style.

* Default/Domain/User Settings: Adjust Select option label for better clarity.

* Use true boolean types for switch theme toggle or drop-down box (#7507)

* Groups: Update the input toggle style

* Conference Controls: Update the input toggle style (#7509)

* Conference Controls: Update the input toggle style

* Update conference_control_edit.php

* Update conference_control_details.php

* Update conference_control_detail_edit.php

* Conferences: Update the input toggle style (#7511)

* Use true boolean types for switch theme toggle or drop-down box (#7513)

* Dialplans: Update the input toggle style
Also updated outbound route add

* Ring Group: Only adjust ring group forward destination top margin when slide toggle enabled.

* Default/Domain/User Settings - List: Adjust for new 'Select Box' label on input_toggle_style value.

* Use true boolean types for switch theme toggle or drop-down box (#7514)

* Call Forward / Follow Me: Minor javascript adjustments to mirror previous behavior.

* Ring Groups [Dashboard]: New slide toggle.

* Get the contacts details with a seperate SQL Query

* Remove debug info

* Destinations: Update the input toggle style

* Conference Profiles: Update the input toggle style (#7515)

* Conference Profiles: Update the input toggle style

* Update conference_profiles.php

* Update conference_profile_params.php

* Update conference_profile_param_edit.php

* Update conference_profile_edit.php

* Extensions: Update the input toggle style

* Contacts: Update the input toggle style (#7517)

* Contacts: Update the input toggle style

* Update contact_address_edit.php

* Update contact_attachment_edit.php

* Update contact_edit.php

* Update contact_email_edit.php

* Update contact_phone_edit.php

* Update contact_relation_edit.php

* Update contact_setting_edit.php

* Update contact_url_edit.php

* Update contacts.php

* Voicemails: New slide toggle.

* Voicemail Greeting: New slide toggle.

* Modules: New slide toggle.

* Recordings: New slide toggle

* Variables: New slide toggle.

* Time Conditions: New slide toggle.

* Extensions - List: Remove invalid column name.

* Extension Settings: New slide toggle.

* Number Translations: New slide toggle and boolean.

* Sofia global settings: Update the input toggle style

* Update alter table convert to boolean

* Fix contact relation search (#7518)

* Sip Profile Edit: Fix setting enabled labels (#7519)

* Sip Profile Edit: Fix setting enabled labels

* Update sip_profile_edit.php

* Update dialplan_edit.php (#7520)

* Update SQL queries to use true/false for contact primary settings (#7521)

* Update SQL queries to use true/false for contact primary settings

* Update contacts_vcard.php

* Update email.php

* Update totp.php

* Update contact_url_edit.php

* Update contact_email_edit.php

* Update contact_address_edit.php

* Update contact_attachment_edit.php

* Update contact_phone_edit.php

* Add a database views method

* Add database view groups

* Add database users view

* Add database call_recordings view

* Update users.php

* Add  database view call block

* Update schema to use the database views method

* Update conference.conf.lua boolean

* Update directory.lua boolean

* Update callcenter.conf.lua agent_status boolean

* Update sofia.conf.lua boolean

* Update number translations lua boolean

* Update directory.lua boolean

* Update group_call.lua fix the cache

* Update reverse-auth-lookup.lua boolean

* Update directory.lua boolean

* Use concat instead of ||

* Update index.lua

---------

Co-authored-by: fusionate <nate@fusionpbx.com>
Co-authored-by: Alex <alex@fusionpbx.com>
Co-authored-by: frytimo <tim@fusionpbx.com>
This commit is contained in:
FusionPBX
2025-09-20 18:42:05 -06:00
committed by GitHub
parent 96874c19b8
commit 7f9064fadb
223 changed files with 3215 additions and 2963 deletions

View File

@@ -36,7 +36,7 @@
$apps[$x]['destinations'][$y]['label'] = "dialplans";
$apps[$x]['destinations'][$y]['name'] = "dialplans";
$apps[$x]['destinations'][$y]['sql'] = "select d.domain_name, e.dialplan_name, e.dialplan_number as destination, e.dialplan_description as description from v_dialplans as e, v_domains as d ";
$apps[$x]['destinations'][$y]['where'] = "where e.domain_uuid = '\${domain_uuid}' and e.domain_uuid = d.domain_uuid and e.dialplan_destination = 'true' and e.dialplan_number <> '' and e.dialplan_enabled = 'true' ";
$apps[$x]['destinations'][$y]['where'] = "where e.domain_uuid = '\${domain_uuid}' and e.domain_uuid = d.domain_uuid and e.dialplan_destination = true and e.dialplan_number <> '' and e.dialplan_enabled = true ";
$apps[$x]['destinations'][$y]['order_by'] = "dialplan_order asc";
$apps[$x]['destinations'][$y]['field']['domain_name'] = "domain_name";
$apps[$x]['destinations'][$y]['field']['dialplan_name'] = "dialplan_name";
@@ -158,12 +158,11 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_destination";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_continue";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_xml";
@@ -177,7 +176,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_enabled";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_description";

View File

@@ -152,9 +152,9 @@
$array['dialplans'][0]['app_uuid'] = 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4';
$array['dialplans'][0]['dialplan_context'] = 'public';
$array['dialplans'][0]['dialplan_name'] = 'not-found';
$array['dialplans'][0]['dialplan_continue'] = 'false';
$array['dialplans'][0]['dialplan_continue'] = false;
$array['dialplans'][0]['dialplan_order'] = '999';
$array['dialplans'][0]['dialplan_enabled'] = 'false';
$array['dialplans'][0]['dialplan_enabled'] = false;
$array['dialplan_details'][0]['dialplan_uuid'] = 'ea5339de-1982-46ca-9695-c35176165314';
$array['dialplan_details'][0]['dialplan_detail_uuid'] = '8a21744d-b381-4cb0-9930-55b776e4e461';

View File

@@ -72,7 +72,7 @@
$dialplan_context = $_POST["dialplan_context"];
$dialplan_order = $_POST["dialplan_order"];
$dialplan_enabled = $_POST["dialplan_enabled"] ?? 'false';
$dialplan_enabled = $_POST["dialplan_enabled"] ?? false;
$dialplan_description = $_POST["dialplan_description"];
}
@@ -122,7 +122,7 @@
$array['dialplans'][0]['app_uuid'] = '742714e5-8cdf-32fd-462c-cbe7e3d655db';
$array['dialplans'][0]['dialplan_name'] = $dialplan_name;
$array['dialplans'][0]['dialplan_order'] = $dialplan_order;
$array['dialplans'][0]['dialplan_continue'] = 'false';
$array['dialplans'][0]['dialplan_continue'] = false;
$array['dialplans'][0]['dialplan_context'] = $dialplan_context;
$array['dialplans'][0]['dialplan_enabled'] = $dialplan_enabled;
$array['dialplans'][0]['dialplan_description'] = $dialplan_description;
@@ -269,13 +269,13 @@
//echo "<td class='vtable' align='left'>\n";
//echo " <select class='formfld' name='dialplan_continue' style='width: 60%;'>\n";
//echo " <option value=''></option>\n";
//if ($dialplan_continue == "true") {
//if ($dialplan_continue == true) {
// echo " <option value='true' selected='selected'>true</option>\n";
//}
//else {
// echo " <option value='true'>true</option>\n";
//}
//if ($dialplan_continue == "false") {
//if ($dialplan_continue == false) {
// echo " <option value='false' selected='selected'>false</option>\n";
//}
//else {
@@ -520,17 +520,16 @@
echo " ".$text['label-enabled']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='dialplan_enabled' value='true' ".(empty($dialplan_enabled) || $dialplan_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' name='dialplan_enabled'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($dialplan_enabled) && $dialplan_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='dialplan_enabled' name='dialplan_enabled'>\n";
echo " <option value='true' ".($dialplan_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($dialplan_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo " <br />\n";
echo " </td>\n";

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2023
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -96,10 +96,10 @@
$dialplan_name = $_POST["dialplan_name"];
$dialplan_number = $_POST["dialplan_number"];
$dialplan_order = $_POST["dialplan_order"];
$dialplan_continue = $_POST["dialplan_continue"] ?? 'false';
$dialplan_continue = $_POST["dialplan_continue"];
$dialplan_details = $_POST["dialplan_details"] ?? null;
$dialplan_context = $_POST["dialplan_context"];
$dialplan_enabled = $_POST["dialplan_enabled"] ?? 'false';
$dialplan_enabled = $_POST["dialplan_enabled"];
$dialplan_description = $_POST["dialplan_description"];
$dialplan_details_delete = $_POST["dialplan_details_delete"] ?? null;
if (!empty($dialplan_details_delete)) {
@@ -265,7 +265,7 @@
$array['dialplans'][$x]['dialplan_context'] = $_POST["dialplan_context"];
$array['dialplans'][$x]['dialplan_continue'] = $_POST["dialplan_continue"];
$array['dialplans'][$x]['dialplan_order'] = $_POST["dialplan_order"];
$array['dialplans'][$x]['dialplan_enabled'] = $_POST["dialplan_enabled"] ?? 'false';
$array['dialplans'][$x]['dialplan_enabled'] = $_POST["dialplan_enabled"];
$array['dialplans'][$x]['dialplan_description'] = $_POST["dialplan_description"];
$y = 0;
if (!empty($_POST["dialplan_details"]) && is_array($_POST["dialplan_details"])) {
@@ -312,7 +312,6 @@
$array['dialplans'][$x]['dialplan_xml'] = $dialplan_array[$dialplan_uuid];
//add or update the database
$database = new database;
$database->app_name = 'dialplans';
$database->app_uuid = $app_uuid ?? null;
$database->uuid($dialplan_uuid);
@@ -353,10 +352,23 @@
//pre-populate the form
if (!empty($_GET) && count($_GET) > 0 && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) {
$sql = "select * from v_dialplans ";
$sql = "select ";
$sql .= "domain_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "app_uuid, ";
$sql .= "hostname, ";
$sql .= "dialplan_context, ";
$sql .= "dialplan_name, ";
$sql .= "dialplan_number, ";
$sql .= "dialplan_destination, ";
$sql .= "dialplan_continue, ";
$sql .= "dialplan_xml, ";
$sql .= "dialplan_order, ";
$sql .= "dialplan_enabled, ";
$sql .= "dialplan_description ";
$sql .= "from v_dialplans ";
$sql .= "where dialplan_uuid = :dialplan_uuid ";
$parameters['dialplan_uuid'] = $dialplan_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
$domain_uuid = $row["domain_uuid"];
@@ -381,18 +393,17 @@
$dialplan_order = '200';
}
if (empty($dialplan_destination)) {
$dialplan_destination = 'false';
$dialplan_destination = false;
}
//get the dialplan details in an array
$sql = "select ";
$sql .= "domain_uuid, dialplan_uuid, dialplan_detail_uuid, dialplan_detail_tag, dialplan_detail_type, dialplan_detail_data, ";
$sql .= "dialplan_detail_break, dialplan_detail_inline, dialplan_detail_group, dialplan_detail_order, cast(dialplan_detail_enabled as text) ";
$sql .= "dialplan_detail_break, dialplan_detail_inline, dialplan_detail_group, dialplan_detail_order, dialplan_detail_enabled ";
$sql .= "from v_dialplan_details ";
$sql .= "where dialplan_uuid = :dialplan_uuid ";
$sql .= "order by dialplan_detail_group asc, dialplan_detail_order asc";
$parameters['dialplan_uuid'] = $dialplan_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
@@ -476,7 +487,7 @@
$details[$group][$x]['dialplan_detail_inline'] = '';
$details[$group][$x]['dialplan_detail_group'] = $group;
$details[$group][$x]['dialplan_detail_order'] = $dialplan_detail_order;
$details[$group][$x]['dialplan_detail_enabled'] = 'true';
$details[$group][$x]['dialplan_detail_enabled'] = true;
}
}
@@ -639,17 +650,16 @@
echo " ".$text['label-continue']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='dialplan_continue' value='true' ".(!empty($dialplan_continue) && $dialplan_continue == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' name='dialplan_continue'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($dialplan_continue) && $dialplan_continue == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='dialplan_continue' name='dialplan_continue'>\n";
echo " <option value='true' ".($dialplan_continue === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($dialplan_continue === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo " </td>\n";
echo " </tr>\n";
@@ -692,13 +702,13 @@
echo " <td class='vtable' align='left'>\n";
echo " <select class='formfld' name='dialplan_destination'>\n";
echo " <option value=''></option>\n";
if ($dialplan_destination == "true") {
if ($dialplan_destination == true) {
echo " <option value='true' selected='selected'>".$text['option-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if ($dialplan_destination == "false") {
if ($dialplan_destination == false) {
echo " <option value='false' selected='selected'>".$text['option-false']."</option>\n";
}
else {
@@ -743,17 +753,16 @@
echo " ".$text['label-enabled']."\n";
echo " </td>\n";
echo " <td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='dialplan_enabled' name='dialplan_enabled' value='true' ".(!empty($dialplan_enabled) && $dialplan_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='dialplan_enabled' name='dialplan_enabled'>\n";
echo " <option value='true' ".($dialplan_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($dialplan_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='dialplan_enabled' name='dialplan_enabled'>\n";
echo " <option value='true' ".($dialplan_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($dialplan_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo " </td>\n";
echo " </tr>\n";
@@ -837,11 +846,6 @@
$dialplan_detail_order = $row['dialplan_detail_order'];
$dialplan_detail_enabled = $row['dialplan_detail_enabled'];
//default to enabled true
if (empty($dialplan_detail_enabled)) {
$dialplan_detail_enabled = 'true';
}
//no border on last row
$no_border = ($index == 999) ? "border: none;" : null;
@@ -949,7 +953,6 @@
// retrieve gateway name from db
$sql = "select gateway from v_gateways where gateway_uuid = :gateway_uuid ";
$parameters['gateway_uuid'] = $bridge_statement[3];
$database = new database;
$gateways = $database->select($sql, $parameters, 'all');
if (is_array($gateways) && @sizeof($gateways) != 0) {
$gateway_name = $gateways[0]['gateway'];
@@ -1037,13 +1040,13 @@
echo "</td>\n";
//enabled
echo "<td class='vtablerow' style='".$no_border." text-align: center;' onclick=\"label_to_form('label_dialplan_detail_enabled_".$x."','dialplan_detail_enabled_".$x."');\" nowrap='nowrap'>\n";
$label_dialplan_detail_enabled = $text['label-'.($dialplan_detail_enabled === true ? 'true' : 'false')];
if ($element['hidden']) {
echo " <label id=\"label_dialplan_detail_enabled_".$x."\">".escape($dialplan_detail_enabled)."</label>\n";
echo " <label id=\"label_dialplan_detail_enabled_".$x."\">".$label_dialplan_detail_enabled."</label>\n";
}
echo " <select id='dialplan_detail_enabled_".$x."' name='dialplan_details[".$x."][dialplan_detail_enabled]' class='formfld' style='width: auto; ".$element['visibility']."'>\n";
echo " <option></option>\n";
echo " <option value='true' ".($dialplan_detail_enabled == "true" ? $selected : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($dialplan_detail_enabled == "false" ? $selected : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($dialplan_detail_enabled === true ? $selected : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($dialplan_detail_enabled === false ? $selected : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo "</td>\n";
//tools

View File

@@ -123,7 +123,6 @@
$sql .= "app_uuid = 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4' ";
$sql .= "where dialplan_context = 'public' ";
$sql .= "and app_uuid is null; ";
$database = new database;
$database->execute($sql);
unset($sql);
}
@@ -178,8 +177,6 @@
$sql .= " lower(dialplan_context) like :search ";
$sql .= " or lower(dialplan_name) like :search ";
$sql .= " or lower(dialplan_number) like :search ";
$sql .= " or lower(dialplan_continue) like :search ";
$sql .= " or lower(dialplan_enabled) like :search ";
$sql .= " or lower(dialplan_description) like :search ";
if (is_numeric($search)) {
$sql .= " or dialplan_order = :search_numeric ";
@@ -188,7 +185,6 @@
$sql .= ") ";
$parameters['search'] = '%'.$search.'%';
}
$database = new database;
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare the paging
@@ -214,7 +210,21 @@
$offset = $rows_per_page * $page;
//get the list of dialplans
$sql = "select * from v_dialplans ";
$sql = "select ";
$sql .= "domain_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "app_uuid, ";
$sql .= "hostname, ";
$sql .= "dialplan_context, ";
$sql .= "dialplan_name, ";
$sql .= "dialplan_number, ";
$sql .= "dialplan_destination, ";
$sql .= "cast(dialplan_continue as text), ";
$sql .= "dialplan_xml, ";
$sql .= "dialplan_order, ";
$sql .= "cast(dialplan_enabled as text), ";
$sql .= "dialplan_description ";
$sql .= "from v_dialplans ";
if ($show == "all" && permission_exists('dialplan_all')) {
$sql .= "where true ";
}
@@ -252,8 +262,6 @@
$sql .= " lower(dialplan_context) like :search ";
$sql .= " or lower(dialplan_name) like :search ";
$sql .= " or lower(dialplan_number) like :search ";
$sql .= " or lower(dialplan_continue) like :search ";
$sql .= " or lower(dialplan_enabled) like :search ";
$sql .= " or lower(dialplan_description) like :search ";
if (is_numeric($search)) {
$sql .= " or dialplan_order = :search_numeric ";
@@ -274,7 +282,6 @@
$sql .= "order by dialplan_order asc, lower(dialplan_name) asc ";
}
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$dialplans = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
@@ -298,7 +305,6 @@
$parameters['app_uuid'] = $app_uuid;
}
$sql .= ") as dc ";
$database = new database;
$rows = $database->select($sql, $parameters ?? null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
@@ -655,4 +661,3 @@
require_once "resources/footer.php";
?>

View File

@@ -326,7 +326,7 @@
$array['dialplans'][$x]['dialplan_enabled'] = $dialplan['@attributes']['enabled'];
}
else {
$array['dialplans'][$x]['dialplan_enabled'] = "true";
$array['dialplans'][$x]['dialplan_enabled'] = true;
}
$array['dialplans'][$x]['dialplan_description'] = $dialplan['@attributes']['description'] ?? null;
@@ -351,7 +351,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = $row['@attributes']['enabled'];
}
else {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true;
}
$y++;
@@ -391,7 +391,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = $row2['@attributes']['enabled'];
}
else {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true;
}
$y++;
@@ -418,7 +418,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = $row2['@attributes']['enabled'];
}
else {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = true;
}
$y++;
@@ -499,7 +499,7 @@
$sql .= "or d.domain_uuid is null ";
$sql .= ") ";
$sql .= "and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' ";
$sql .= "and d.dialplan_enabled = 'true' ";
$sql .= "and d.dialplan_enabled = true ";
$sql .= "and d.dialplan_uuid = s.dialplan_uuid ";
$sql .= "order by ";
$sql .= "d.dialplan_order asc, ";
@@ -603,7 +603,7 @@
foreach($database_array['dialplans'] as $row) {
if (!empty($row['dialplan_details'])) {
foreach($row['dialplan_details'] as $detail) {
if ($detail['dialplan_detail_enabled'] == 'true') {
if ($detail['dialplan_detail_enabled'] == true) {
$array[$id]['domain_uuid'] = $row['domain_uuid'];
$array[$id]['dialplan_uuid'] = $row['dialplan_uuid'];
$array[$id]['app_uuid'] = $row['app_uuid'];
@@ -668,7 +668,7 @@
else {
$sql .= "where (dialplan_context = :dialplan_context or dialplan_context = '\${domain_name}' or dialplan_context = 'global') ";
}
$sql .= "and dialplan_enabled = 'true' ";
$sql .= "and dialplan_enabled = true ";
$parameters['dialplan_context'] = $this->context;
}
}
@@ -728,7 +728,7 @@
$sql .= "and p.dialplan_uuid = :dialplan_uuid \n";
$parameters['dialplan_uuid'] = $this->uuid;
}
$sql .= "and (s.dialplan_detail_enabled = 'true' or s.dialplan_detail_enabled is null) \n";
$sql .= "and (s.dialplan_detail_enabled = true or s.dialplan_detail_enabled is null) \n";
$sql .= "order by \n";
$sql .= "p.dialplan_order asc, \n";
$sql .= "p.dialplan_name asc, \n";