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'] = "destinations";
$apps[$x]['destinations'][$y]['name'] = "destinations";
$apps[$x]['destinations'][$y]['sql'] = "select destination_uuid, destination_uuid as uuid, destination_number, destination_context, destination_description from v_destinations ";
$apps[$x]['destinations'][$y]['where'] = "where (domain_uuid = '\${domain_uuid}' or domain_uuid is null) and (destination_type = 'outbound' or destination_type = 'local') and destination_enabled = 'true' ";
$apps[$x]['destinations'][$y]['where'] = "where (domain_uuid = '\${domain_uuid}' or domain_uuid is null) and (destination_type = 'outbound' or destination_type = 'local') and destination_enabled = true ";
$apps[$x]['destinations'][$y]['order_by'] = "destination_number asc";
$apps[$x]['destinations'][$y]['field']['destination_uuid'] = "destination_uuid";
$apps[$x]['destinations'][$y]['field']['destination_number'] = "destination_number";
@@ -393,7 +393,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the destination order.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_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'] = "destination_description";

View File

@@ -120,7 +120,7 @@
$user_uuid = $_POST["user_uuid"];
$group_uuid = $_POST["group_uuid"];
$destination_order= $_POST["destination_order"];
$destination_enabled = $_POST["destination_enabled"] ?? 'false';
$destination_enabled = $_POST["destination_enabled"];
$destination_description = $_POST["destination_description"];
$destination_sell = check_float($_POST["destination_sell"] ?? '');
$currency = $_POST["currency"] ?? null;
@@ -207,7 +207,6 @@
//if (empty($destination_prefix) && permission_exists('destination_prefix')) { $msg .= $text['message-required']." ".$text['label-destination_country_code']."<br>\n"; }
if (empty($destination_number)) { $msg .= $text['message-required']." ".$text['label-destination_number']."<br>\n"; }
if (empty($destination_context)) { $msg .= $text['message-required']." ".$text['label-destination_context']."<br>\n"; }
if (empty($destination_enabled)) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."<br>\n"; }
//check for duplicates
if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $settings->get('destinations', 'unique', false)) {
@@ -449,7 +448,7 @@
$dialplan["dialplan_name"] = (!empty($dialplan_name)) ? $dialplan_name : format_phone($destination_area_code.$destination_number);
$dialplan["dialplan_number"] = $destination_area_code.$destination_number;
$dialplan["dialplan_context"] = $destination_context;
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_continue"] = 'false';
$dialplan["dialplan_order"] = $destination_order;
$dialplan["dialplan_enabled"] = $destination_enabled;
$dialplan["dialplan_description"] = (!empty($dialplan_description)) ? $dialplan_description : $destination_description;
@@ -1326,7 +1325,6 @@
$currency_buy = $currency_buy ?? '';
$destination_carrier = $destination_carrier ?? '';
$destination_order = $destination_order ?? '';
$destination_enabled = $destination_enabled ?? '';
$destination_description = $destination_description ?? '';
$destination_email = $destination_email ?? '';
$select_style = $select_style ?? '';
@@ -1335,7 +1333,39 @@
if (!empty($_GET["id"]) && empty($_POST["persistformvar"])) {
if (is_uuid($_GET["id"])) {
$destination_uuid = $_GET["id"];
$sql = "select * from v_destinations ";
$sql = "select ";
$sql .= "domain_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "destination_type, ";
$sql .= "destination_number, ";
$sql .= "destination_condition_field, ";
$sql .= "destination_prefix, ";
$sql .= "destination_trunk_prefix, ";
$sql .= "destination_area_code, ";
$sql .= "destination_caller_id_name, ";
$sql .= "destination_caller_id_number, ";
$sql .= "destination_cid_name_prefix, ";
$sql .= "destination_hold_music, ";
$sql .= "destination_distinctive_ring, ";
$sql .= "destination_record, ";
$sql .= "destination_ringback, ";
$sql .= "destination_accountcode, ";
$sql .= "destination_type_voice, ";
$sql .= "destination_type_fax, ";
$sql .= "destination_type_text, ";
$sql .= "destination_type_emergency, ";
$sql .= "destination_context, ";
$sql .= "destination_conditions, ";
$sql .= "destination_actions, ";
$sql .= "fax_uuid, ";
$sql .= "provider_uuid, ";
$sql .= "user_uuid, ";
$sql .= "group_uuid, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description, ";
$sql .= "destination_email ";
$sql .= "from v_destinations ";
$sql .= "where destination_uuid = :destination_uuid ";
$parameters['destination_uuid'] = $destination_uuid;
$row = $database->select($sql, $parameters, 'row');
@@ -1462,7 +1492,6 @@
if (empty($destination_order)) { $destination_order = '100'; }
if (empty($destination_type)) { $destination_type = 'inbound'; }
if (empty($destination_context)) { $destination_context = 'public'; }
if (empty($destination_enabled)) { $destination_enabled = 'true'; }
if ($destination_type =="outbound") { $destination_context = $_SESSION['domain_name']; }
if ($destination_type =="local") { $destination_context = $_SESSION['domain_name']; }
@@ -1489,7 +1518,7 @@
if (permission_exists('user_edit')) {
$sql = "select * from v_users ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and user_enabled = 'true' ";
$sql .= "and user_enabled = true ";
$sql .= "order by username asc ";
$parameters['domain_uuid'] = $domain_uuid;
$users = $database->select($sql, $parameters, 'all');
@@ -2135,22 +2164,16 @@
echo " ".$text['label-destination_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' id='destination_enabled' name='destination_enabled' value='true' ".($destination_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='destination_enabled'>\n";
switch ($destination_enabled) {
case "true" : $selected[1] = "selected='selected'"; break;
case "false" : $selected[2] = "selected='selected'"; break;
}
echo " <option value='true' ".$selected[1].">".$text['label-true']."</option>\n";
echo " <option value='false' ".$selected[2].">".$text['label-false']."</option>\n";
unset($selected);
echo " </select>\n";
echo " <select class='formfld' id='destination_enabled' name='destination_enabled'>\n";
echo " <option value='true' ".($destination_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($destination_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 $text['description-destination_enabled']."\n";

View File

@@ -267,7 +267,7 @@
$array["dialplans"][$row_id]["dialplan_name"] = !empty($dialplan_name) ? $dialplan_name : format_phone($destination_number);
$array["dialplans"][$row_id]["dialplan_number"] = $destination_number;
$array["dialplans"][$row_id]["dialplan_context"] = $destination_context;
$array["dialplans"][$row_id]["dialplan_continue"] = "false";
$array["dialplans"][$row_id]["dialplan_continue"] = false;
$array["dialplans"][$row_id]["dialplan_order"] = "100";
$array["dialplans"][$row_id]["dialplan_enabled"] = $destination_enabled;
$array["dialplans"][$row_id]["dialplan_description"] = $destination_description;

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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -164,14 +164,12 @@
$sql .= "or lower(destination_caller_id_name) like :search ";
$sql .= "or destination_caller_id_number like :search ";
}
$sql .= "or lower(destination_enabled) like :search ";
$sql .= "or lower(destination_description) like :search ";
$sql .= "or lower(destination_data) like :search ";
$sql .= ") ";
$parameters['search'] = '%'.$search.'%';
}
$parameters['destination_type'] = $destination_type;
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
//prepare to page the results
@@ -206,7 +204,7 @@
$sql .= " d.destination_context, ";
$sql .= " d.destination_caller_id_name, ";
$sql .= " d.destination_caller_id_number, ";
$sql .= " d.destination_enabled, ";
$sql .= " cast(d.destination_enabled as text), ";
$sql .= " d.destination_description ";
$sql .= "from v_destinations as d ";
if ($show == "all" && permission_exists('destination_all')) {
@@ -230,7 +228,6 @@
$sql .= " or lower(destination_caller_id_name) like :search ";
$sql .= " or destination_caller_id_number like :search ";
}
$sql .= " or lower(destination_enabled) like :search ";
$sql .= " or lower(destination_description) like :search ";
$sql .= " or lower(destination_data) like :search ";
$sql .= ") ";
@@ -238,7 +235,6 @@
}
$sql .= order_by($order_by, $order, 'destination_number, destination_order ', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$destinations = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
@@ -463,4 +459,3 @@
require_once "resources/footer.php";
?>

View File

@@ -1240,7 +1240,7 @@
$sql .= "and d.domain_uuid = :domain_uuid \n";
}
$sql .= "and destination_type = 'inbound' \n";
$sql .= "and destination_enabled = 'true' \n";
$sql .= "and destination_enabled = true \n";
$sql .= "group by d.domain_uuid, d.destination_uuid, d.dialplan_uuid, n.domain_name, d.destination_type, d.destination_prefix, d.destination_number \n";
$sql .= "order by destination_number asc \n";
if (!(!empty($_GET['show']) && $_GET['show'] === 'all' && permission_exists('destination_summary_all'))) {