mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
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:
@@ -95,7 +95,7 @@
|
||||
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_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'] = "sip_profile_description";
|
||||
@@ -208,7 +208,7 @@
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the value.";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_setting_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'] = "Choose to enable or disable this.";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_setting_description";
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
|
||||
//add the sip profile if it is not false
|
||||
if ($sip_profile_enabled != "false") {
|
||||
if ($sip_profile_enabled != false) {
|
||||
|
||||
//add profile name and description
|
||||
$sip_profile_uuid = uuid();
|
||||
@@ -109,7 +109,7 @@
|
||||
$array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_uuid'] = $sip_profile_uuid;
|
||||
$array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_setting_name'] = $row['@attributes']['name'];
|
||||
$array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_setting_value'] = $row['@attributes']['value'];
|
||||
$array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_setting_enabled'] = $row['@attributes']['enabled'] != 'false' ? 'true' : $row['@attributes']['enabled'];
|
||||
$array['sip_profiles'][$x]['sip_profile_settings'][$y]['sip_profile_setting_enabled'] = $row['@attributes']['enabled'] != false ? true : $row['@attributes']['enabled'];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -219,7 +219,7 @@
|
||||
|
||||
//if empty, set enabled to true
|
||||
$sql = "update v_sip_profiles set ";
|
||||
$sql .= "sip_profile_enabled = 'true' ";
|
||||
$sql .= "sip_profile_enabled = true ";
|
||||
$sql .= "where sip_profile_enabled is null ";
|
||||
$sql .= "or sip_profile_enabled = '' ";
|
||||
$database->execute($sql);
|
||||
|
||||
@@ -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) 2016-2023
|
||||
Portions created by the Initial Developer are Copyright (C) 2016-2025
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -55,7 +55,6 @@
|
||||
$sip_profile_uuid = '';
|
||||
$sip_profile_name = '';
|
||||
$sip_profile_hostname = '';
|
||||
$sip_profile_enabled = 'false';
|
||||
$sip_profile_description = '';
|
||||
$sip_profile_domains = [];
|
||||
$sip_profile_settings = [];
|
||||
@@ -87,7 +86,7 @@
|
||||
$sip_profile_uuid = $_POST["sip_profile_uuid"];
|
||||
$sip_profile_name = $_POST["sip_profile_name"];
|
||||
$sip_profile_hostname = $_POST["sip_profile_hostname"];
|
||||
$sip_profile_enabled = $_POST["sip_profile_enabled"] ?? 'false';
|
||||
$sip_profile_enabled = $_POST["sip_profile_enabled"];
|
||||
$sip_profile_description = $_POST["sip_profile_description"];
|
||||
$sip_profile_domains = $_POST["sip_profile_domains"];
|
||||
$sip_profile_settings = $_POST["sip_profile_settings"];
|
||||
@@ -116,7 +115,6 @@
|
||||
//if (empty($sip_profile_uuid)) { $msg .= $text['message-required']." ".$text['label-sip_profile_uuid']."<br>\n"; }
|
||||
if (empty($sip_profile_name)) { $msg .= $text['message-required']." ".$text['label-sip_profile_name']."<br>\n"; }
|
||||
//if (empty($sip_profile_hostname)) { $msg .= $text['message-required']." ".$text['label-sip_profile_hostname']."<br>\n"; }
|
||||
if (empty($sip_profile_enabled)) { $msg .= $text['message-required']." ".$text['label-sip_profile_enabled']."<br>\n"; }
|
||||
if (empty($sip_profile_description)) { $msg .= $text['message-required']." ".$text['label-sip_profile_description']."<br>\n"; }
|
||||
if (!empty($msg) && empty($_POST["persistformvar"])) {
|
||||
require_once "resources/header.php";
|
||||
@@ -277,7 +275,12 @@
|
||||
//pre-populate the form
|
||||
if (!empty($_GET["id"]) && empty($_POST["persistformvar"])) {
|
||||
$sip_profile_uuid = $_GET["id"];
|
||||
$sql = "select * from v_sip_profiles ";
|
||||
$sql = "select ";
|
||||
$sql .= "sip_profile_name, ";
|
||||
$sql .= "sip_profile_hostname, ";
|
||||
$sql .= "sip_profile_enabled, ";
|
||||
$sql .= "sip_profile_description ";
|
||||
$sql .= "from v_sip_profiles ";
|
||||
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
|
||||
$parameters['sip_profile_uuid'] = $sip_profile_uuid;
|
||||
$database = new database;
|
||||
@@ -291,11 +294,15 @@
|
||||
unset($sql, $parameters, $row);
|
||||
}
|
||||
|
||||
//set the defaults
|
||||
if (empty($sip_profile_enabled)) { $sip_profile_enabled = 'true'; }
|
||||
|
||||
//get the child data
|
||||
$sql = "select * from v_sip_profile_settings ";
|
||||
$sql = "select ";
|
||||
$sql .= "sip_profile_setting_uuid, ";
|
||||
$sql .= "sip_profile_uuid, ";
|
||||
$sql .= "sip_profile_setting_name, ";
|
||||
$sql .= "sip_profile_setting_value, ";
|
||||
$sql .= "sip_profile_setting_enabled, ";
|
||||
$sql .= "sip_profile_setting_description ";
|
||||
$sql .= "from v_sip_profile_settings ";
|
||||
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
|
||||
$sql .= "order by sip_profile_setting_name ";
|
||||
$parameters['sip_profile_uuid'] = $sip_profile_uuid;
|
||||
@@ -316,7 +323,13 @@
|
||||
}
|
||||
|
||||
//get the child data
|
||||
$sql = "select * from v_sip_profile_domains ";
|
||||
$sql = "select ";
|
||||
$sql .= "sip_profile_domain_uuid, ";
|
||||
$sql .= "sip_profile_uuid, ";
|
||||
$sql .= "sip_profile_domain_name, ";
|
||||
$sql .= "sip_profile_domain_alias, ";
|
||||
$sql .= "sip_profile_domain_parse ";
|
||||
$sql .= "from v_sip_profile_domains ";
|
||||
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
|
||||
$parameters['sip_profile_uuid'] = $sip_profile_uuid;
|
||||
$database = new database;
|
||||
@@ -363,7 +376,7 @@
|
||||
//show the header
|
||||
$document['title'] = $text['title-sip_profile'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
|
||||
//helper scripts
|
||||
echo "<script language='javascript'>\n";
|
||||
|
||||
@@ -382,7 +395,7 @@
|
||||
unset($js_sip_profile_names);
|
||||
|
||||
echo "</script>\n";
|
||||
|
||||
|
||||
//show the content
|
||||
echo "<form name='frm' id='frm' method='post'>\n";
|
||||
|
||||
@@ -489,8 +502,8 @@
|
||||
if (!empty($sip_profile_uuid) && is_uuid($row["sip_profile_uuid"])) {
|
||||
$sip_profile_uuid = $row["sip_profile_uuid"];
|
||||
}
|
||||
$label_sip_profile_domain_alias = !empty($row["sip_profile_domain_alias"]) ? $text['label-'.$row["sip_profile_domain_alias"]] : '';
|
||||
$label_sip_profile_domain_parse = !empty($row["sip_profile_domain_alias"]) ? $text['label-'.$row["sip_profile_domain_alias"]] : '';
|
||||
$label_sip_profile_domain_alias = $row["sip_profile_domain_alias"] !== '' ? $text['label-'.($row["sip_profile_domain_alias"] === true ? 'true' : 'false')] : '';
|
||||
$label_sip_profile_domain_parse = $row["sip_profile_domain_parse"] !== '' ? $text['label-'.($row["sip_profile_domain_parse"] === true ? 'true' : 'false')] : '';
|
||||
|
||||
echo " <input type='hidden' name='sip_profile_domains[$x][sip_profile_domain_uuid]' value='".(!empty($row["sip_profile_domain_uuid"]) ? $row["sip_profile_domain_uuid"] : uuid())."'>\n";
|
||||
echo " <input type='hidden' name='sip_profile_domains[$x][sip_profile_uuid]' value='".escape($sip_profile_uuid)."'>\n";
|
||||
@@ -501,7 +514,6 @@
|
||||
echo " <td class='vtablerow' style='".$bottom_border." text-align: center;' ".(permission_exists('sip_profile_domain_edit') ? "onclick=\"label_to_form('label_sip_profile_domain_alias_$x','sip_profile_domain_alias_$x');\"" : null)." nowrap='nowrap'>\n";
|
||||
echo " <label id='label_sip_profile_domain_alias_$x'>".$label_sip_profile_domain_alias."</label>\n";
|
||||
echo " <select id='sip_profile_domain_alias_$x' class='formfld' style='display: none;' name='sip_profile_domains[$x][sip_profile_domain_alias]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='true' ".($row["sip_profile_domain_alias"] == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' ".($row["sip_profile_domain_alias"] == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
@@ -509,7 +521,6 @@
|
||||
echo " <td class='vtablerow' style='".$bottom_border." text-align: center;' ".(permission_exists('sip_profile_domain_edit') ? "onclick=\"label_to_form('label_sip_profile_domain_parse_$x','sip_profile_domain_parse_$x');\"" : null)." nowrap='nowrap'>\n";
|
||||
echo " <label id='label_sip_profile_domain_parse_$x'>".$label_sip_profile_domain_parse."</label>\n";
|
||||
echo " <select id='sip_profile_domain_parse_$x' class='formfld' style='display: none;' name='sip_profile_domains[$x][sip_profile_domain_parse]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='true' ".($row["sip_profile_domain_parse"] == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' ".($row["sip_profile_domain_parse"] == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
@@ -564,7 +575,8 @@
|
||||
$x = 0;
|
||||
foreach ($sip_profile_settings as $row) {
|
||||
$bottom_border = empty($row['sip_profile_setting_uuid']) ? "border-bottom: none;" : null;
|
||||
$label_sip_profile_setting_enabled = !empty($row["sip_profile_setting_enabled"]) ? $text['label-'.$row["sip_profile_setting_enabled"]] : '';
|
||||
$label_sip_profile_setting_enabled = $text['label-'.($row["sip_profile_setting_enabled"] === true ? 'true' : 'false')];
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <input type='hidden' name='sip_profile_settings[$x][sip_profile_setting_uuid]' value='".(is_uuid($row["sip_profile_setting_uuid"]) ? $row["sip_profile_setting_uuid"] : uuid())."'>\n";
|
||||
echo " <input type='hidden' name='sip_profile_settings[$x][sip_profile_uuid]' value='".escape($row["sip_profile_uuid"])."'>\n";
|
||||
@@ -579,8 +591,8 @@
|
||||
echo " <td class='vtablerow' style='".$bottom_border." text-align: center;' ".(permission_exists('sip_profile_setting_edit') ? "onclick=\"label_to_form('label_sip_profile_setting_enabled_$x','sip_profile_setting_enabled_$x');\"" : null)." nowrap='nowrap'>\n";
|
||||
echo " <label id='label_sip_profile_setting_enabled_$x'>".$label_sip_profile_setting_enabled."</label>\n";
|
||||
echo " <select id='sip_profile_setting_enabled_$x' class='formfld' style='display: none;' name='sip_profile_settings[$x][sip_profile_setting_enabled].'>\n";
|
||||
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' ".($row['sip_profile_setting_enabled'] == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||
echo " <option value='true' ".($row['sip_profile_setting_enabled'] === true ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' ".($row['sip_profile_setting_enabled'] === false ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtablerow' style='".$bottom_border."' ".(permission_exists('sip_profile_setting_edit') ? "onclick=\"label_to_form('label_sip_profile_setting_description_$x','sip_profile_setting_description_$x');\"" : null)." nowrap='nowrap'>\n";
|
||||
@@ -631,17 +643,16 @@
|
||||
echo " ".$text['label-sip_profile_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
||||
echo " <label class='switch'>\n";
|
||||
echo " <input type='checkbox' id='sip_profile_enabled' name='sip_profile_enabled' value='true' ".($sip_profile_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='sip_profile_enabled' name='sip_profile_enabled'>\n";
|
||||
echo " <option value='true' ".($sip_profile_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
|
||||
echo " <option value='false' ".($sip_profile_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " <select class='formfld' id='sip_profile_enabled' name='sip_profile_enabled'>\n";
|
||||
echo " <option value='true' ".($sip_profile_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
|
||||
echo " <option value='false' ".($sip_profile_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-sip_profile_enabled']."\n";
|
||||
|
||||
@@ -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):
|
||||
@@ -111,7 +111,7 @@
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = str_replace('count(sip_profile_uuid)', '*', $sql);
|
||||
$sql = str_replace('count(sip_profile_uuid)', 'sip_profile_uuid, sip_profile_name, sip_profile_hostname, cast(sip_profile_enabled as text), sip_profile_description', $sql);
|
||||
$sql .= order_by($order_by, $order);
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$database = new database;
|
||||
|
||||
Reference in New Issue
Block a user