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

@@ -403,7 +403,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for an address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_street";
@@ -536,7 +536,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the extension.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary number.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_description";
@@ -811,7 +811,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_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'] = "contact_setting_description";
@@ -940,7 +940,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the email address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email_address";
@@ -1013,7 +1013,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the url.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "url_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "url_address";
@@ -1152,7 +1152,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "attachment_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Primary attachments are used as the Contact photo and sent with Messages.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "attachment_filename";

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):
@@ -144,7 +144,7 @@
//if primary, unmark other primary addresses
if ($email_primary) {
$sql = "update v_contact_addresses set address_primary = 0 ";
$sql = "update v_contact_addresses set address_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -181,7 +181,7 @@
$array['contact_addresses'][0]['address_country'] = $address_country;
$array['contact_addresses'][0]['address_latitude'] = $address_latitude;
$array['contact_addresses'][0]['address_longitude'] = $address_longitude;
$array['contact_addresses'][0]['address_primary'] = $address_primary ? 1 : 0;
$array['contact_addresses'][0]['address_primary'] = $address_primary;
$array['contact_addresses'][0]['address_description'] = $address_description;
$database = new database;
@@ -435,10 +435,17 @@
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='address_primary' id='address_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(!empty($address_primary) && $address_primary ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='address_primary' name='address_primary'>\n";
echo " <option value='true' ".($address_primary === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($address_primary === 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-address_primary']."\n";
echo "</td>\n";

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -79,7 +79,7 @@
//unflag others as primary
$allowed_primary_attachment = false;
if ($attachment_primary && ($attachment_extension == 'jpg' || $attachment_extension == 'jpeg' || $attachment_extension == 'gif' || $attachment_extension == 'png')) {
$sql = "update v_contact_attachments set attachment_primary = 0 ";
$sql = "update v_contact_attachments set attachment_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -261,10 +261,17 @@
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='attachment_primary' id='attachment_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(!empty($attachment_primary) && $attachment_primary ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='attachment_primary' name='attachment_primary'>\n";
echo " <option value='true' ".($attachment_primary === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($attachment_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "</td>\n";
echo "</tr>\n";

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.
*/
@@ -512,7 +512,7 @@
$array['contacts'][0]['contact_settings'][$y]['contact_setting_name'] = $row["contact_setting_name"];
$array['contacts'][0]['contact_settings'][$y]['contact_setting_value'] = $row["contact_setting_value"];
$array['contacts'][0]['contact_settings'][$y]['contact_setting_order'] = $row["contact_setting_order"];
$array['contacts'][0]['contact_settings'][$y]['contact_setting_enabled'] = $row["contact_setting_enabled"] ?? 'false';
$array['contacts'][0]['contact_settings'][$y]['contact_setting_enabled'] = $row["contact_setting_enabled"];
$array['contacts'][0]['contact_settings'][$y]['contact_setting_description'] = $row["contact_setting_description"];
$y++;
}
@@ -897,7 +897,7 @@
$contact_settings[$x]['contact_setting_name'] = '';
$contact_settings[$x]['contact_setting_value'] = '';
$contact_settings[$x]['contact_setting_order'] = '';
$contact_settings[$x]['contact_setting_enabled'] = 'true';
$contact_settings[$x]['contact_setting_enabled'] = true;
$contact_settings[$x]['contact_setting_description'] = '';
}
@@ -1712,7 +1712,7 @@ if (permission_exists('contact_phone_view')) {
echo " </div>\n";
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['phone_primary'] == "1") {
if ($row['phone_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -1833,22 +1833,17 @@ if (permission_exists('contact_phone_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_phones[$x][phone_primary]' style='width: auto;'>\n";
echo " <option value=''></option>\n";
if ($row['phone_primary'] == "1") {
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <option value='1'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='phone_primary' name='contact_phones[$x][phone_primary]' style='width: auto;'>\n";
echo " <option value='true' ".($row['phone_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['phone_primary'] === 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";
}
if ($row['phone_primary'] == "0") {
echo " <option value='0' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='0'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
//echo $text['description-phone_primary']."\n";
echo " </div>\n";
@@ -1905,7 +1900,7 @@ if (permission_exists('contact_address_view')) {
echo " </div>\n";
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['address_primary'] == "1") {
if ($row['address_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -2096,21 +2091,17 @@ if (permission_exists('contact_address_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_addresses[$x][address_primary]' style='width: auto;'>\n";
echo " <option value=''>".escape($text['label-address_primary'] ?? '')."</option>\n";
if ($row['address_primary'] == "1") {
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <option value='1'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='address_primary' name='contact_addresses[$x][address_primary]' style='width: auto;'>\n";
echo " <option value='true' ".($row['address_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['address_primary'] === 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";
}
if ($row['address_primary'] == "0") {
echo " <option value='0' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='0'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo " </div>\n";
echo " <div class='label'>\n";
@@ -2155,7 +2146,7 @@ if (permission_exists('contact_email_view')) {
echo " </div>\n";
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['email_primary'] == "1") {
if ($row['email_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -2182,21 +2173,17 @@ if (permission_exists('contact_email_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_emails[$x][email_primary]' style='width: auto;'>\n";
echo " <option value=''>".escape($text['label-contact_emails'] ?? '')."</option>\n";
if ($row['email_primary'] == "1") {
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <option value='1'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='email_primary' name='contact_emails[$x][email_primary]' style='width: auto;'>\n";
echo " <option value='true' ".($row['email_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['email_primary'] === 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";
}
if ($row['email_primary'] == "0") {
echo " <option value='0' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='0'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
//echo " <br />\n";
//echo $text['description-email_primary']."\n";
echo " </div>\n";
@@ -2248,7 +2235,7 @@ if (permission_exists('contact_url_view')) {
echo " </div>\n";
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['url_primary'] == "1") {
if ($row['url_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -2303,34 +2290,29 @@ if (permission_exists('contact_url_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_urls[$x][url_primary]' style='width: auto;'>\n";
echo " <option value=''></option>\n";
if ($row['url_primary'] == "1") {
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='1'>".$text['label-true']."</option>\n";
}
if ($row['url_primary'] == "0") {
echo " <option value='0' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='0'>".$text['label-false']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='url_primary' name='contact_urls[$x][url_primary]' style='width: auto;'>\n";
echo " <option value='true' ".($row['url_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['url_primary'] === 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 " </div>\n";
echo " <div class='label'>\n";
echo " ".$text['label-url_description']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <input class='formfld' type='text' name='contact_urls[$x][url_description]' placeholder='' maxlength='255' value=\"".escape($row["url_description"])."\">\n";
echo " </div>\n";
if (!empty($contact_urls) && @sizeof($contact_urls) > 1 && permission_exists('contact_url_delete')) {
if (is_uuid($row['contact_url_uuid'])) {
echo " <input type='checkbox' name='contact_urls[".$x."][checked]' value='true' class='chk_delete checkbox_details' onclick=\"checkbox_on_change(this);\">\n";
}
}
// if (!empty($contact_urls) && @sizeof($contact_urls) > 1 && permission_exists('contact_url_delete')) {
// if (is_uuid($row['contact_url_uuid'])) {
// echo " <input type='checkbox' name='contact_urls[".$x."][checked]' value='true' class='chk_delete checkbox_details' onclick=\"checkbox_on_change(this);\">\n";
// }
// }
//echo " <br />\n";
//echo " ".$text['description-contact_organization']."\n";
echo " <div class='label empty_row' style='grid-row: 6 / span 99;'>\n";
@@ -2511,17 +2493,16 @@ if (permission_exists('contact_setting_view')) {
echo " ".$text['label-enabled']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='contact_settings[$x][contact_setting_enabled]' value='true' ".(empty($row['contact_setting_enabled']) || $row['contact_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='contact_settings[$x][contact_setting_enabled]'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($row['contact_setting_enabled']) && $row['contact_setting_enabled'] == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='contact_setting_enabled' name='contact_settings[$x][contact_setting_enabled]' style='width: auto;'>\n";
echo " <option value='true' ".($row['contact_setting_enabled'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['contact_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 " </div>\n";
echo " <div class='label'>\n";
@@ -2561,7 +2542,7 @@ if (permission_exists('contact_attachment_view')) {
}
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['attachment_primary'] == "1") {
if ($row['attachment_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -2614,10 +2595,17 @@ if (permission_exists('contact_attachment_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_attachments[$x][attachment_primary]' id='attachment_primary' style='width: auto;'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(($row['attachment_primary']) ? "selected" : null).">".$text['option-true']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='attachment_primary' name='contact_attachments[$x][attachment_primary]' style='width: auto;'>\n";
echo " <option value='false' ".($row['attachment_primary'] === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($row['attachment_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo " </div>\n";
echo " <div class='label'>\n";

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -125,7 +125,7 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
//if primary, unmark other primary emails
if ($email_primary) {
$sql = "update v_contact_emails set email_primary = 0 ";
$sql = "update v_contact_emails set email_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -291,10 +291,17 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='email_primary' id='email_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(!empty($email_primary) && $email_primary ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='email_primary' name='email_primary'>\n";
echo " <option value='false' ".($email_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($email_primary === true ? "selected='selected'" : null).">".$text['option-true']."</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-email_primary']."\n";
echo "</td>\n";

View File

@@ -80,7 +80,7 @@ if ($_POST['a'] == 'import') {
$sql .= "and contact_setting_category = 'google' ";
$sql .= "and contact_setting_subcategory = 'id' ";
$sql .= "and contact_setting_value = :contact_setting_value ";
$sql .= "and contact_setting_enabled = 'true' ";
$sql .= "and contact_setting_enabled = true ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['contact_setting_value'] = $contact_id;
$database = new database;

View File

@@ -57,7 +57,7 @@
$sql = "select *, ";
$sql .= "( ";
$sql .= " select a.contact_attachment_uuid from v_contact_attachments as a ";
$sql .= " where a.contact_uuid = c.contact_uuid and a.attachment_primary = 1 ";
$sql .= " where a.contact_uuid = c.contact_uuid and a.attachment_primary = true ";
$sql .= ") as contact_attachment_uuid ";
$sql .= "from v_contacts as c ";
$sql .= "where true ";

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):
@@ -145,7 +145,7 @@
//if primary, unmark other primary numbers
if ($phone_primary) {
$sql = "update v_contact_phones set phone_primary = 0 ";
$sql = "update v_contact_phones set phone_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -400,10 +400,17 @@
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='phone_primary' id='phone_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(($phone_primary) ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='phone_primary' name='phone_primary'>\n";
echo " <option value='false' ".($phone_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($phone_primary === true ? "selected='selected'" : null).">".$text['option-true']."</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-phone_primary']."\n";
echo "</td>\n";

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -321,7 +321,7 @@
echo "<td class='vtable' align='left'>\n";
echo " <input class=\"formfld\" type=\"text\" name=\"contact_search\" placeholder=\"search\" style=\"width: 80px;\" onkeyup=\"get_contacts('contact_select', 'contact_uuid', this.value);\" maxlength=\"255\" value=\"\">\n";
echo " <select class='formfld' style=\"width: 150px;\" id=\"contact_select\" name=\"relation_contact_uuid\" >\n";
echo " <option value='".escape($relation_contact_uuid ?? '')."'>".escape($contact_name ?? '')."</option>\n";
echo " <option value='".escape($relation_contact_uuid ?? '')."'>".escape($relation_contact_uuid ?? '')."</option>\n";
echo " </select>\n";
echo "</td>\n";
echo "</tr>\n";
@@ -332,10 +332,17 @@
echo " ".$text['label-contact_relation_reciprocal']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='relation_reciprocal' id='relation_reciprocal' onchange=\"$('#reciprocal_label').slideToggle(400);\">\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1'>".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='relation_reciprocal' name='relation_reciprocal' onchange=\"$('#reciprocal_label').slideToggle(400);\">\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true'>".$text['option-true']."</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-contact_relation_reciprocal']."\n";
echo "</td>\n";

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -75,7 +75,7 @@
$contact_setting_name = strtolower($_POST["contact_setting_name"]);
$contact_setting_value = $_POST["contact_setting_value"];
$contact_setting_order = $_POST["contact_setting_order"] ?? null;
$contact_setting_enabled = strtolower($_POST["contact_setting_enabled"]) ?? 'false';
$contact_setting_enabled = strtolower($_POST["contact_setting_enabled"]) ?? false;
$contact_setting_description = $_POST["contact_setting_description"];
}
@@ -312,17 +312,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' name='contact_setting_enabled' value='true' ".(empty($contact_setting_enabled) || $contact_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='contact_setting_enabled'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($contact_setting_enabled) && $contact_setting_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='contact_setting_enabled' name='contact_setting_enabled'>\n";
echo " <option value='false' ".($contact_setting_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($contact_setting_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</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";

View File

@@ -137,4 +137,3 @@
}
?>

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):
@@ -128,7 +128,7 @@
//if primary, unmark other primary urls
if ($url_primary) {
$sql = "update v_contact_urls set url_primary = 0 ";
$sql = "update v_contact_urls set url_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -294,10 +294,17 @@
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='url_primary' id='url_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(($url_primary) ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='url_primary' name='url_primary'>\n";
echo " <option value='false' ".($url_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($url_primary === true ? "selected='selected'" : null).">".$text['option-true']."</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-url_primary']."\n";
echo "</td>\n";

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -245,7 +245,7 @@
//get the list
$sql = "select *, ";
$sql .= "(select a.contact_attachment_uuid from v_contact_attachments as a where a.contact_uuid = c.contact_uuid and a.attachment_primary = 1 limit 1) as contact_attachment_uuid ";
$sql .= "(select a.contact_attachment_uuid from v_contact_attachments as a where a.contact_uuid = c.contact_uuid and a.attachment_primary = true limit 1) as contact_attachment_uuid ";
$sql .= "from v_contacts as c ";
$sql .= "where true ";
if ($show != "all" || !permission_exists('contact_all')) {
@@ -472,5 +472,3 @@
require_once "resources/footer.php";
?>

View File

@@ -94,7 +94,7 @@ if (!empty($_GET)) {
$sql = "select url_address from v_contact_urls ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$sql .= "and url_primary = 1 ";
$sql .= "and url_primary = true ";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;