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
+9 -9
View File
@@ -482,7 +482,7 @@
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "device_enabled";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "device_provision_enable";
$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'] = "device_enabled_date";
@@ -670,7 +670,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "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'] = "insert_date";
@@ -743,7 +743,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "device_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'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "device_setting_description";
@@ -912,7 +912,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "device_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'] = "device_profile_description";
@@ -1003,7 +1003,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the device key extension.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'profile_key_protected';
$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'] = 'Enter the device key protected.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'profile_key_label';
@@ -1073,7 +1073,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the profile setting value.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = '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'] = 'Enter the profile setting enabled.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'profile_setting_description';
@@ -1119,7 +1119,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the name.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "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 vendor.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "description";
@@ -1189,7 +1189,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the value.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the status of the function.";
$z++;
@@ -1879,7 +1879,7 @@
$vendors[$y]['functions'][$z]['subtype'] = "";
$vendors[$y]['functions'][$z]['value'] = "blf";
$vendors[$y]['functions'][$z]['groups'][] = "superadmin";
$vendors[$y]['functions'][$z]['groups'][] = "admin";
$vendors[$y]['functions'][$z]['groups'][] = "admin";
$z++;
$vendors[$y]['functions'][$z]['uuid'] = "b531c295-6b8f-4c50-a1a2-63aefbaf91ae";
$vendors[$y]['functions'][$z]['label'] = "label-line";
+35 -43
View File
@@ -128,7 +128,7 @@
$device_uuid_alternate = $_POST["device_uuid_alternate"] ?? null;
$device_model = $_POST["device_model"] ?? null;
$device_firmware_version = $_POST["device_firmware_version"] ?? null;
$device_enabled = $_POST["device_enabled"] ?? 'false';
$device_enabled = $_POST["device_enabled"];
$device_template = $_POST["device_template"];
$device_description = $_POST["device_description"];
//lines
@@ -349,7 +349,7 @@
if (permission_exists('device_line_shared')) {
$array['devices'][0]['device_lines'][$y]['shared_line'] = $row["shared_line"];
}
$array['devices'][0]['device_lines'][$y]['enabled'] = $row["enabled"] ?? 'false';
$array['devices'][0]['device_lines'][$y]['enabled'] = $row["enabled"] ?? false;
if (permission_exists('device_line_port')) {
$array['devices'][0]['device_lines'][$y]['sip_port'] = $row["sip_port"];
}
@@ -435,15 +435,14 @@
$array['devices'][0]['device_settings'][$y]['device_setting_subcategory'] = $row["device_setting_subcategory"] ?? null;
$array['devices'][0]['device_settings'][$y]['device_setting_name'] = $row["device_setting_name"] ?? null;
$array['devices'][0]['device_settings'][$y]['device_setting_value'] = $row["device_setting_value"] ?? null;
$array['devices'][0]['device_settings'][$y]['device_setting_enabled'] = $row["device_setting_enabled"] ?? 'false';
// echo $array['devices'][0]['device_settings'][$y]['device_setting_enabled'].'<br>';
$array['devices'][0]['device_settings'][$y]['device_setting_enabled'] = $row["device_setting_enabled"] ?? false;
$array['devices'][0]['device_settings'][$y]['device_setting_description'] = $row["device_setting_description"];
$y++;
}
}
}
// view_array($array);
// exit;
//save the device
$database->app_name = 'devices';
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
@@ -545,9 +544,6 @@
$domains = $database->select($sql, null, 'all');
unset($sql, $parameters);
//set the defaults
if (empty($device_enabled)) { $device_enabled = 'true'; }
//use the device address to get the vendor
if (empty($device_vendor)) {
//get the device vendor using the device address
@@ -597,7 +593,7 @@
$device_lines[$x]['auth_id'] = '';
$device_lines[$x]['password'] = '';
$device_lines[$x]['shared_line'] = '';
$device_lines[$x]['enabled'] = '';
$device_lines[$x]['enabled'] = false;
$device_lines[$x]['sip_port'] = $settings->get('provision', 'line_sip_port', '5060');
$device_lines[$x]['sip_transport'] = $settings->get('provision', 'line_sip_transport', 'tcp');
$device_lines[$x]['register_expires'] = $settings->get('provision', 'line_register_expires', '120');
@@ -685,7 +681,7 @@
for ($x = 0; $x < $rows; $x++) {
$device_settings[$id]['device_setting_name'] = '';
$device_settings[$id]['device_setting_value'] = '';
$device_settings[$id]['device_setting_enabled'] = '';
$device_settings[$id]['device_setting_enabled'] = false;
$device_settings[$id]['device_setting_description'] = '';
$id++;
}
@@ -694,7 +690,7 @@
//get the users
$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');
@@ -1283,7 +1279,6 @@
$x = 0;
foreach ($device_lines as $row) {
//set the defaults
if (!permission_exists('device_line_server_address')) {
if (empty($row['server_address'])) { $row['server_address'] = $domain_name; }
@@ -1453,17 +1448,16 @@
}
echo " <td align='left'>\n";
if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='device_lines[".$x."][enabled]' value='true' ".(empty($row['enabled']) || $row['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='device_lines[".$x."][enabled]'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['enabled'] == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='user_setting_enabled' name='device_lines[".$x."][enabled]'>\n";
echo " <option value='true' ".($row['enabled'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['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";
@@ -1817,17 +1811,16 @@
echo "</td>\n";
echo "<td align='left'>\n";
if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='device_settings[".$x."][device_setting_enabled]' value='true' ".(empty($row['device_setting_enabled']) || $row['device_setting_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='device_settings[".$x."][device_setting_enabled]'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($row['device_setting_enabled']) && $row['device_setting_enabled'] == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='device_setting_enabled' name='device_settings[".$x."][device_setting_enabled]'>\n";
echo " <option value='true' ".($row['device_setting_enabled'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['device_setting_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";
@@ -2017,17 +2010,16 @@
echo " ".$text['label-device_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='device_enabled' name='device_enabled' value='true' ".($device_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='device_enabled' name='device_enabled'>\n";
echo " <option value='true' ".($device_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($device_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='device_enabled' name='device_enabled'>\n";
echo " <option value='true' ".($device_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($device_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-device_enabled']."\n";
+46 -44
View File
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2020-2024 All Rights Reserved.
Copyright (C) 2020-2025 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
@@ -76,7 +76,7 @@
$device_profile_name = $_POST["device_profile_name"];
$device_profile_keys = $_POST["device_profile_keys"];
$device_profile_settings = $_POST["device_profile_settings"];
$device_profile_enabled = $_POST["device_profile_enabled"] ?? 'false';
$device_profile_enabled = $_POST["device_profile_enabled"];
$device_profile_description = $_POST["device_profile_description"];
$device_profile_keys_delete = $_POST["device_profile_keys_delete"] ?? null;
$device_profile_settings_delete = $_POST["device_profile_settings_delete"] ?? null;
@@ -96,7 +96,6 @@
$sql = "select domain_uuid from v_device_profiles ";
$sql .= "where device_profile_uuid = :device_profile_uuid ";
$parameters['device_profile_uuid'] = $device_profile_uuid;
$database = new database;
$domain_uuid = $database->execute($sql, $parameters, 'column');
}
}
@@ -115,7 +114,6 @@
//if (empty($device_profile_keys)) { $msg .= $text['message-required']." ".$text['label-device_profile_keys']."<br>\n"; }
//if (empty($device_profile_settings)) { $msg .= $text['message-required']." ".$text['label-device_profile_settings']."<br>\n"; }
//if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (empty($device_profile_enabled)) { $msg .= $text['message-required']." ".$text['label-device_profile_enabled']."<br>\n"; }
//if (empty($device_profile_description)) { $msg .= $text['message-required']." ".$text['label-device_profile_description']."<br>\n"; }
if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
@@ -170,7 +168,7 @@
$array['device_profiles'][0]['device_profile_settings'][$y]["device_profile_setting_uuid"] = $row["device_profile_setting_uuid"];
$array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_name"] = $row["profile_setting_name"];
$array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_value"] = $row["profile_setting_value"];
$array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_enabled"] = $row["profile_setting_enabled"] ?? 'false';
$array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_enabled"] = $row["profile_setting_enabled"];
$array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_description"] = $row["profile_setting_description"];
$y++;
}
@@ -178,7 +176,6 @@
}
//save to the data
$database = new database;
$database->app_name = 'Device Profiles';
$database->app_uuid = 'bb2531c3-97e6-428f-9a19-cbac1b96f5b7';
$database->save($array);
@@ -223,12 +220,17 @@
//pre-populate the form
if (!empty($_GET) && is_array($_GET) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) {
$device_profile_uuid = $_GET["id"];
$sql = "select * from v_device_profiles ";
$sql = "select ";
$sql .= "device_profile_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "device_profile_name, ";
$sql .= "device_profile_enabled, ";
$sql .= "device_profile_description ";
$sql .= "from v_device_profiles ";
$sql .= "where device_profile_uuid = :device_profile_uuid ";
//$sql .= "and domain_uuid = :domain_uuid ";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['device_profile_uuid'] = $device_profile_uuid;
$database = new database;
$result = $database->execute($sql, $parameters, 'all');
foreach ($result as $row) {
$domain_uuid = $row["domain_uuid"];
@@ -241,9 +243,6 @@
unset ($sql, $parameters);
}
//set the defaults
if (empty($device_profile_enabled)) { $device_profile_enabled = 'true'; }
//get the child data
if (!empty($device_profile_uuid)) {
$sql = "select * from v_device_profile_keys ";
@@ -265,7 +264,6 @@
$sql .= "profile_key_id asc ";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['device_profile_uuid'] = $device_profile_uuid;
$database = new database;
$device_profile_keys = $database->execute($sql, $parameters, 'all');
unset ($sql, $parameters);
}
@@ -295,9 +293,8 @@
//get the vendors
$sql = "select * ";
$sql .= "from v_device_vendors as v ";
$sql .= "where enabled = 'true' ";
$sql .= "where enabled = true ";
$sql .= "order by name asc ";
$database = new database;
$vendors = $database->select($sql, null, 'all');
unset($sql);
@@ -305,10 +302,9 @@
$sql = "select v.name as vendor_name, f.type, f.subtype, f.value ";
$sql .= "from v_device_vendors as v, v_device_vendor_functions as f ";
$sql .= "where v.device_vendor_uuid = f.device_vendor_uuid ";
$sql .= "and v.enabled = 'true' ";
$sql .= "and f.enabled = 'true' ";
$sql .= "and v.enabled = true ";
$sql .= "and f.enabled = true ";
$sql .= "order by v.name asc, f.type asc ";
$database = new database;
$vendor_functions = $database->select($sql, null, 'all');
unset($sql);
@@ -352,7 +348,6 @@
$sql .= "order by profile_setting_name asc";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['device_profile_uuid'] = $device_profile_uuid;
$database = new database;
$device_profile_settings = $database->execute($sql, $parameters, 'all');
unset ($sql, $parameters);
}
@@ -369,7 +364,7 @@
$device_profile_settings[$x]['device_profile_setting_uuid'] = '';
$device_profile_settings[$x]['profile_setting_name'] = '';
$device_profile_settings[$x]['profile_setting_value'] = '';
$device_profile_settings[$x]['profile_setting_enabled'] = 'true';
$device_profile_settings[$x]['profile_setting_enabled'] = true;
$device_profile_settings[$x]['profile_setting_description'] = '';
//filter the uuid
@@ -632,20 +627,29 @@
echo " <td class='formfld'>\n";
echo " <input class='formfld' type='text' name='device_profile_keys[$x][profile_key_value]' maxlength='255' value=\"".escape($row["profile_key_value"])."\">\n";
echo " </td>\n";
if (permission_exists('device_key_extension')) {
echo " <td class='formfld'>\n";
echo " <input class='formfld' type='text' name='device_profile_keys[$x][profile_key_extension]' maxlength='255' value=\"".escape($row["profile_key_extension"])."\">\n";
echo " </td>\n";
}
if (permission_exists('device_key_protected')) {
echo " <td>\n";
echo " <select class='formfld' name='device_profile_keys[$x][profile_key_protected]'>\n";
echo " <option value=''></option>\n";
echo " <option value='true' ".($row['profile_key_protected'] == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".($row['profile_key_protected'] == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='profile_key_protected' name='device_profile_keys[$x][profile_key_protected]'>\n";
echo " <option value='true' ".($row['profile_key_protected'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['profile_key_protected'] === 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 " <td class='formfld'>\n";
echo " <input class='formfld' type='text' name='device_profile_keys[$x][profile_key_label]' maxlength='255' value=\"".escape($row["profile_key_label"])."\">\n";
echo " </td>\n";
@@ -711,17 +715,16 @@
echo " <input class='formfld' type='text' name='device_profile_settings[$x][profile_setting_value]' maxlength='255' value=\"".escape($row["profile_setting_value"])."\">\n";
echo " </td>\n";
echo " <td class='formfld'>\n";
if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='device_profile_settings[".$x."][profile_setting_enabled]' value='true' ".(empty($row['profile_setting_enabled']) || $row['profile_setting_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='device_profile_settings[".$x."][profile_setting_enabled]'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($row['profile_setting_enabled']) && $row['profile_setting_enabled'] == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='profile_setting_enabled' name='device_profile_settings[".$x."][profile_setting_enabled]'>\n";
echo " <option value='true' ".($row['profile_setting_enabled'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['profile_setting_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 " <td class='formfld'>\n";
@@ -771,17 +774,16 @@
echo " ".$text['label-device_profile_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='device_profile_enabled' name='device_profile_enabled' value='true' ".($device_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='device_profile_enabled' name='device_profile_enabled'>\n";
echo " <option value='true' ".($device_profile_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($device_profile_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='device_profile_enabled' name='device_profile_enabled'>\n";
echo " <option value='true' ".($device_profile_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($device_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-device_profile_enabled'] ?? '')."\n";
+14 -5
View File
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2019-2024 All Rights Reserved.
Copyright (C) 2019-2025 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
@@ -118,7 +118,6 @@
$parameters['domain_uuid'] = $domain_uuid;
}
$sql .= $sql_search ?? '';
$database = new database;
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare to page the results
@@ -137,10 +136,21 @@
$offset = $rows_per_page * $page;
//get the list
$sql = str_replace('count(*)', '*', $sql);
$sql = "select ";
$sql .= "device_profile_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "device_profile_name, ";
$sql .= "cast(device_profile_enabled as text), ";
$sql .= "device_profile_description ";
$sql .= "from v_device_profiles ";
$sql .= "where true ";
if ($show != "all" || !permission_exists('device_profile_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid;
}
$sql .= $sql_search ?? '';
$sql .= order_by($order_by, $order, 'device_profile_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$device_profiles = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
@@ -302,4 +312,3 @@
require_once "resources/footer.php";
?>
+17 -17
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) 2016-2024
Portions created by the Initial Developer are Copyright (C) 2016-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -53,7 +53,7 @@
//get http post variables and set them to php variables
if (count($_POST) > 0) {
$name = $_POST["name"];
$enabled = $_POST["enabled"] ?? 'false';
$enabled = $_POST["enabled"];
$description = $_POST["description"];
}
@@ -76,7 +76,6 @@
//check for all required data
$msg = '';
if (empty($name)) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
if (empty($enabled)) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (empty($description)) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
@@ -123,7 +122,12 @@
//pre-populate the form
if (!empty($_GET) && count($_GET) > 0 && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) {
$device_vendor_uuid = $_GET["id"];
$sql = "select * from v_device_vendors ";
$sql = "select ";
$sql .= "device_vendor_uuid, ";
$sql .= "name, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= "from v_device_vendors ";
$sql .= "where device_vendor_uuid = :device_vendor_uuid ";
$parameters['device_vendor_uuid'] = $device_vendor_uuid;
$database = new database;
@@ -136,9 +140,6 @@
unset($sql, $parameters, $row);
}
//set the defaults
if (empty($enabled)) { $enabled = true; }
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
@@ -178,17 +179,16 @@
echo " ".$text['label-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='enabled' name='enabled' value='true' ".($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='enabled' name='enabled'>\n";
echo " <option value='true' ".($enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='enabled' name='enabled'>\n";
echo " <option value='true' ".($enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($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-enabled']."\n";
+28 -22
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) 2016-2024
Portions created by the Initial Developer are Copyright (C) 2016-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -47,7 +47,6 @@
$p = permissions::new();
$p->add('device_vendor_function_group_delete', 'temp');
$database = new database;
$database->app_name = 'devices';
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
$database->delete($array);
@@ -95,7 +94,7 @@
$type = $_POST["type"];
$subtype = $_POST["subtype"];
$value = $_POST["value"];
$enabled = $_POST["enabled"] ?? 'false';
$enabled = $_POST["enabled"];
$description = $_POST["description"];
}
@@ -120,7 +119,6 @@
//if (empty($label)) { $msg .= $text['message-required']." ".$text['label-label']."<br>\n"; }
if (empty($type)) { $msg .= $text['message-required']." ".$text['label-type']."<br>\n"; }
if (empty($value)) { $msg .= $text['message-required']." ".$text['label-value']."<br>\n"; }
if (empty($enabled)) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (empty($description)) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
@@ -159,7 +157,6 @@
$array['device_vendor_functions'][0]['enabled'] = $enabled;
$array['device_vendor_functions'][0]['description'] = $description;
$database = new database;
$database->app_name = 'devices';
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
$database->save($array);
@@ -186,7 +183,6 @@
$p = permissions::new();
$p->add('device_vendor_function_group_add', 'temp');
$database = new database;
$database->app_name = 'devices';
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
$database->save($array);
@@ -206,13 +202,19 @@
//pre-populate the form
if (!empty($_GET) && count($_GET) > 0 && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) {
$device_vendor_function_uuid = $_GET["id"] ?? null;
$sql = "select * from v_device_vendor_functions ";
$sql = "select ";
$sql .= "device_vendor_function_uuid, ";
$sql .= "device_vendor_uuid, ";
$sql .= "type, ";
$sql .= "subtype, ";
$sql .= "value, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= "from v_device_vendor_functions ";
$sql .= "where device_vendor_function_uuid = :device_vendor_function_uuid ";
$parameters['device_vendor_function_uuid'] = $device_vendor_function_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
//$label = $row["label"];
$type = $row["type"];
$subtype = $row["subtype"];
$value = $row["value"];
@@ -237,7 +239,6 @@
$sql .= "g.group_name asc ";
$parameters['device_vendor_uuid'] = $device_vendor_uuid;
$parameters['device_vendor_function_uuid'] = $device_vendor_function_uuid;
$database = new database;
$function_groups = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
@@ -251,7 +252,14 @@
}
//get the groups
$sql = "select * from v_groups ";
$sql = "select ";
$sql .= "group_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "group_name, ";
$sql .= "group_protected, ";
$sql .= "group_level, ";
$sql .= "group_description ";
$sql .= "from v_groups ";
if (!empty($assigned_groups) && is_array($assigned_groups) && @sizeof($assigned_groups) != 0) {
$sql .= "where ";
foreach ($assigned_groups as $index => $group_uuid) {
@@ -263,7 +271,6 @@
}
}
$sql .= "order by domain_uuid desc, group_name asc ";
$database = new database;
$groups = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters, $sql_where, $index);
@@ -366,17 +373,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='enabled' value='true' ".(empty($enabled) || $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='enabled'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(empty($enabled) || $enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='enabled' name='enabled'>\n";
echo " <option value='true' ".($enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($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-enabled']."\n";
+17 -9
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) 2016-2024
Portions created by the Initial Developer are Copyright (C) 2016-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -76,18 +76,20 @@
$order_by = $_GET["order_by"] ?? null;
$order = $_GET["order"] ?? null;
//get the search term
$search = strtolower($_GET["search"] ?? '');
//prepare to page the results
$sql = "select count(*) from v_device_vendor_functions ";
$sql .= "where device_vendor_uuid = :device_vendor_uuid ";
if (isset($_GET["search"])) {
if (!empty($search)) {
$sql .= "and (";
$sql .= " label like :search ";
$sql .= " or type like :search ";
$sql .= " or subtype like :search ";
$sql .= " or enabled like :search ";
$sql .= " or description like :search ";
$sql .= ")";
$parameters['search'] = '%'.$_GET["search"].'%';
$parameters['search'] = '%'.$search.'%';
}
$parameters['device_vendor_uuid'] = $device_vendor_uuid;
$database = new database;
@@ -106,18 +108,25 @@
}
//get the list
$sql = "select * from v_device_vendor_functions ";
$sql = "select ";
$sql .= "device_vendor_function_uuid, ";
$sql .= "device_vendor_uuid, ";
$sql .= "type, ";
$sql .= "subtype, ";
$sql .= "value, ";
$sql .= "cast(enabled as text), ";
$sql .= "description ";
$sql .= "from v_device_vendor_functions ";
$sql .= "where device_vendor_uuid = :device_vendor_uuid ";
if (isset($_GET["search"])) {
if (!empty($search)) {
$sql .= "and (";
$sql .= " label like :search ";
$sql .= " or type like :search ";
$sql .= " or subtype like :search ";
$sql .= " or value like :search ";
$sql .= " or enabled like :search ";
$sql .= " or description like :search ";
$sql .= ")";
$parameters['search'] = '%'.$_GET["search"].'%';
$parameters['search'] = '%'.$search.'%';
}
$parameters['device_vendor_uuid'] = $device_vendor_uuid;
$sql .= order_by($order_by, $order, 'type', 'asc');
@@ -293,4 +302,3 @@
echo "</script>\n";
?>
+24 -13
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) 2016-2024
Portions created by the Initial Developer are Copyright (C) 2016-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -74,20 +74,19 @@
$order_by = $_GET["order_by"] ?? null;
$order = $_GET["order"] ?? null;
//add the search term
//set the search term
$search = strtolower($_GET["search"] ?? '');
if (!empty($search)) {
$sql_where = "where (";
$sql_where .= "lower(name) like :search ";
$sql_where .= "or lower(enabled) like :search ";
$sql_where .= "or lower(description) like :search ";
$sql_where .= ")";
$parameters['search'] = '%'.$search.'%';
}
//prepare to page the results
$sql = "select count(*) from v_device_vendors ";
$sql .= $sql_where ?? null;
if (!empty($search)) {
$sql .= "where (";
$sql .= " lower(name) like :search ";
$sql .= " or lower(enabled) like :search ";
$sql .= " or lower(description) like :search ";
$sql .= ")";
$parameters['search'] = '%'.$search.'%';
}
$database = new database;
$num_rows = $database->select($sql, $parameters ?? null, 'column');
@@ -101,7 +100,20 @@
$offset = $rows_per_page * $page;
//get the list
$sql = str_replace('count(*)', '*', $sql);
$sql = "select ";
$sql .= "device_vendor_uuid, ";
$sql .= "name, ";
$sql .= "cast(enabled as text), ";
$sql .= "description ";
$sql .= "from v_device_vendors ";
if (!empty($search)) {
$sql .= "where (";
$sql .= " lower(name) like :search ";
$sql .= " or lower(enabled) like :search ";
$sql .= " or lower(description) like :search ";
$sql .= ")";
$parameters['search'] = '%'.$search.'%';
}
$sql .= order_by($order_by, $order, 'name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
@@ -226,4 +238,3 @@
require_once "resources/footer.php";
?>
+24 -4
View File
@@ -135,7 +135,6 @@
$sql .= " lower(d.device_address) like :search ";
$sql .= " or lower(d.device_label) like :search ";
$sql .= " or lower(d.device_vendor) like :search ";
$sql .= " or lower(d.device_enabled) like :search ";
$sql .= " or lower(d.device_template) like :search ";
$sql .= " or lower(d.device_description) like :search ";
$sql .= " or lower(d.device_provisioned_method) like :search ";
@@ -189,7 +188,30 @@
if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
$sql .= "d3.domain_name, ";
}
$sql .="d.*, d2.device_label as alternate_label, ";
$sql .= "d.device_uuid, ";
$sql .= "d.domain_uuid, ";
$sql .= "d.device_address, ";
$sql .= "d.device_label, ";
$sql .= "d.device_vendor, ";
$sql .= "d.device_model, ";
$sql .= "d.device_firmware_version, ";
$sql .= "d.device_template, ";
$sql .= "d.device_username, ";
$sql .= "d.device_password, ";
$sql .= "d.device_time_zone, ";
$sql .= "d.device_description, ";
$sql .= "d.device_profile_uuid, ";
$sql .= "d.device_uuid_alternate, ";
$sql .= "d.device_user_uuid, ";
$sql .= "d.device_provisioned_date, ";
$sql .= "d.device_provisioned_method, ";
$sql .= "d.device_provisioned_ip, ";
$sql .= "d.device_enabled_date, ";
$sql .= "d.device_provisioned_agent, ";
$sql .= "d.device_location, ";
$sql .= "d.device_serial_number, ";
$sql .= "cast(d.device_enabled as text), ";
$sql .= "d2.device_label as alternate_label, ";
$sql .= "to_char(timezone(:time_zone, d.device_provisioned_date), 'DD Mon YYYY') as provisioned_date_formatted, \n";
$sql .= "to_char(timezone(:time_zone, d.device_provisioned_date), 'HH12:MI:SS am') as provisioned_time_formatted \n";
$sql .= "from v_devices as d, v_devices as d2 ";
@@ -224,7 +246,6 @@
$sql .= " lower(d.device_address) like :search ";
$sql .= " or lower(d.device_label) like :search ";
$sql .= " or lower(d.device_vendor) like :search ";
$sql .= " or lower(d.device_enabled) like :search ";
$sql .= " or lower(d.device_template) like :search ";
$sql .= " or lower(d.device_description) like :search ";
$sql .= " or lower(d.device_provisioned_method) like :search ";
@@ -477,4 +498,3 @@
require_once "resources/footer.php";
?>