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

@@ -85,7 +85,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the profile name.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "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'] = "Set the status of the profile.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "profile_description";
@@ -144,7 +144,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the value.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "profile_param_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'] = "Set the status of the parameter.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "profile_param_description";

View File

@@ -81,7 +81,7 @@
//print_r($p);
$profile_param_name = $p['@attributes']['name'];
$profile_param_value = $p['@attributes']['value'];
$profile_param_enabled = 'true';
$profile_param_enabled = true;
//add the coference profile params
$conference_profile_param_uuid = uuid();

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) 2018-2024
Portions created by the Initial Developer are Copyright (C) 2018-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -57,7 +57,7 @@
//get http post variables and set them to php variables
if (!empty($_POST)) {
$profile_name = $_POST["profile_name"];
$profile_enabled = $_POST["profile_enabled"] ?? 'false';
$profile_enabled = $_POST["profile_enabled"];
$profile_description = $_POST["profile_description"];
}
//check to see if the http post exists
@@ -129,7 +129,11 @@
//pre-populate the form
if (!empty($_GET) && empty($_POST["persistformvar"])) {
$conference_profile_uuid = $_GET["id"];
$sql = "select * from v_conference_profiles ";
$sql = "select ";
$sql .= "profile_name, ";
$sql .= "profile_enabled, ";
$sql .= "profile_description ";
$sql .= "from v_conference_profiles ";
$sql .= "where conference_profile_uuid = :conference_profile_uuid ";
//$sql .= "and domain_uuid = :domain_uuid ";
$parameters['conference_profile_uuid'] = $conference_profile_uuid;
@@ -144,9 +148,6 @@
unset($sql, $parameters);
}
//set the defaults
if (empty($profile_enabled)) { $profile_enabled = 'true'; }
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
@@ -186,17 +187,16 @@
echo " ".$text['label-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='profile_enabled' name='profile_enabled' value='true' ".($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' name='profile_enabled'>\n";
echo " <option value='true' ".($profile_enabled == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".($profile_enabled == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='profile_enabled' name='profile_enabled'>\n";
echo " <option value='true' ".($profile_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($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-profile_enabled']."\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) 2018-2024
Portions created by the Initial Developer are Copyright (C) 2018-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -64,7 +64,7 @@
if (!empty($_POST)) {
$profile_param_name = $_POST["profile_param_name"];
$profile_param_value = $_POST["profile_param_value"];
$profile_param_enabled = $_POST["profile_param_enabled"] ?? 'false';
$profile_param_enabled = $_POST["profile_param_enabled"];
$profile_param_description = $_POST["profile_param_description"];
}
@@ -123,7 +123,6 @@
}
if (is_uuid($array['conference_profile_params'][0]['conference_profile_param_uuid'])) {
$database = new database;
$database->app_name = 'conference_profiles';
$database->app_uuid = 'c33e2c2a-847f-44c1-8c0d-310df5d65ba9';
$database->save($array);
@@ -139,11 +138,15 @@
//pre-populate the form
if (!empty($_GET) && empty($_POST["persistformvar"])) {
$conference_profile_param_uuid = $_GET["id"] ?? '';
$sql = "select * from v_conference_profile_params ";
$sql = "select ";
$sql .= "profile_param_name, ";
$sql .= "profile_param_value, ";
$sql .= "profile_param_enabled, ";
$sql .= "profile_param_description ";
$sql .= "from v_conference_profile_params ";
$sql .= "where conference_profile_param_uuid = :conference_profile_param_uuid ";
$parameters['conference_profile_param_uuid'] = $conference_profile_param_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
$row = $database->select($sql, $parameters ?? null, 'row');
if (!empty($row)) {
$profile_param_name = $row["profile_param_name"];
$profile_param_value = $row["profile_param_value"];
@@ -153,9 +156,6 @@
unset($sql, $parameters);
}
//set the defaults
if (empty($profile_param_enabled)) { $profile_param_enabled = 'true'; }
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
@@ -206,17 +206,16 @@
echo " ".$text['label-profile_param_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='profile_param_enabled' name='profile_param_enabled' value='true' ".($profile_param_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='profile_param_enabled' name='profile_param_enabled'>\n";
echo " <option value='true' ".($profile_param_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($profile_param_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='profile_param_enabled' name='profile_param_enabled'>\n";
echo " <option value='true' ".($profile_param_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($profile_param_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-profile_param_enabled']."\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) 2018-2024
Portions created by the Initial Developer are Copyright (C) 2018-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -84,8 +84,8 @@
$sql .= "from v_conference_profile_params ";
$sql .= "where conference_profile_uuid = :conference_profile_uuid ";
$parameters['conference_profile_uuid'] = $conference_profile_uuid;
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
//prepare to page the results
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
@@ -97,10 +97,18 @@
}
//get the list
$sql = str_replace('count(conference_profile_param_uuid)', '*', $sql);
$sql = "select ";
$sql .= "conference_profile_param_uuid, ";
$sql .= "conference_profile_uuid, ";
$sql .= "profile_param_name, ";
$sql .= "profile_param_value, ";
$sql .= "cast(profile_param_enabled as text), ";
$sql .= "profile_param_description ";
$sql .= "from v_conference_profile_params ";
$sql .= "where conference_profile_uuid = :conference_profile_uuid ";
$parameters['conference_profile_uuid'] = $conference_profile_uuid;
$sql .= order_by($order_by, $order, 'profile_param_name', 'asc');
$sql .= limit_offset($rows_per_page ?? '', $offset ?? '');
$database = new database;
$result = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);

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) 2018-2024
Portions created by the Initial Developer are Copyright (C) 2018-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -102,9 +102,18 @@
}
$database = new database;
$num_rows = $database->select($sql, $parameters ?? null, 'column');
unset($sql);
//get the list
$sql = str_replace('count(conference_profile_uuid)', '*', $sql);
$sql = "select ";
$sql .= "conference_profile_uuid, ";
$sql .= "profile_name, ";
$sql .= "cast(profile_enabled as text), ";
$sql .= "profile_description ";
$sql .= "from v_conference_profiles ";
if (!empty($sql_search)) {
$sql .= "where ".$sql_search;
}
$sql .= order_by($order_by, $order, 'profile_name', 'asc');
$sql .= limit_offset($rows_per_page ?? '', $offset ?? '');
$database = new database;

View File

@@ -102,7 +102,6 @@
$p->add('conference_profile_param_delete', 'temp');
//execute delete
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->delete($array);
@@ -157,7 +156,6 @@
//delete the checked rows
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
//execute delete
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->delete($array);
@@ -208,7 +206,6 @@
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
$database = new database;
$rows = $database->select($sql, $parameters ?? null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
@@ -232,7 +229,6 @@
//save the changes
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
@@ -280,7 +276,6 @@
if (!empty($uuids) && is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
$database = new database;
$rows = $database->select($sql, $parameters ?? null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
@@ -306,7 +301,6 @@
//save the changes
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
@@ -361,7 +355,6 @@
//primary table
$sql = "select * from v_".$this->table." ";
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
$database = new database;
$rows = $database->select($sql, $parameters ?? null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$y = 0;
@@ -378,7 +371,6 @@
//params sub table
$sql_2 = "select * from v_conference_profile_params where conference_profile_uuid = :conference_profile_uuid";
$parameters_2['conference_profile_uuid'] = $row['conference_profile_uuid'];
$database = new database;
$rows_2 = $database->select($sql_2, $parameters_2, 'all');
if (is_array($rows_2) && @sizeof($rows_2) != 0) {
foreach ($rows_2 as $row_2) {
@@ -409,7 +401,6 @@
$p->add('conference_profile_param_add', 'temp');
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);