From 126779190f0eaf5f9664c94058cc202d4e9f17e4 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Wed, 22 Oct 2025 16:14:22 -0700 Subject: [PATCH] Convert boolean values to a string before being copied (#7591) * Convert boolean values to a string before being copied * Update access_controls.php * Update copyright year and handle boolean values Updated copyright year from 2019 to 2025 and added conversion of boolean values to strings in the database result processing. * Update call_block.php * Update call_center.php * Update call_flows.php * Update conference_controls.php * Update conference_profiles.php * Update conferences.php * Update device.php * Update dialplan.php * Update event_guard.php * Update extension_settings.php * Update fax.php * Update fax_queue.php * Update gateways.php * Update ivr_menu.php * Update number_translations.php * Update phrases.php * Update pin_numbers.php * Update ring_groups.php * Update streams.php * Update time_conditions.php * Update vars.php * Update email_templates.php * Update users.php * Update domains.php * Update groups.php * Update extension_copy.php * Update device_copy.php --- app/access_controls/access_controls.php | 15 +++--- .../resources/classes/access_controls.php | 8 ++++ app/bridges/resources/classes/bridges.php | 10 +++- .../resources/classes/call_block.php | 8 ++++ .../resources/classes/call_center.php | 16 +++++++ .../resources/classes/call_flows.php | 18 +++++++- .../resources/classes/conference_controls.php | 19 +++++++- .../resources/classes/conference_profiles.php | 36 +++++++++++---- .../resources/classes/conferences.php | 26 ++++++++++- app/devices/device_copy.php | 27 ++++++++++- app/devices/resources/classes/device.php | 26 ++++++++++- app/dialplans/resources/classes/dialplan.php | 18 +++++++- .../resources/classes/event_guard.php | 10 +++- .../resources/classes/extension_settings.php | 18 ++++++-- app/extensions/extension_copy.php | 46 +++++++++++++++++-- app/fax/resources/classes/fax.php | 26 ++++++++++- app/fax_queue/resources/classes/fax_queue.php | 10 +++- app/gateways/resources/classes/gateways.php | 10 +++- app/ivr_menus/resources/classes/ivr_menu.php | 26 ++++++++++- .../resources/classes/number_translations.php | 17 ++++++- app/phrases/resources/classes/phrases.php | 18 +++++++- .../resources/classes/pin_numbers.php | 10 +++- .../resources/classes/ring_groups.php | 34 +++++++++++++- app/streams/resources/classes/streams.php | 10 +++- .../resources/classes/time_conditions.php | 18 +++++++- app/vars/resources/classes/vars.php | 10 +++- .../resources/classes/email_templates.php | 10 +++- core/users/resources/classes/users.php | 11 ++++- resources/classes/domains.php | 8 ++++ resources/classes/groups.php | 17 ++++++- 30 files changed, 485 insertions(+), 51 deletions(-) diff --git a/app/access_controls/access_controls.php b/app/access_controls/access_controls.php index ff391c5604..2b960c1f97 100644 --- a/app/access_controls/access_controls.php +++ b/app/access_controls/access_controls.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - 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): @@ -71,8 +71,8 @@ //prepare the array $x = 0; foreach ($access_controls as $row) { - $array['access_controls'][$x]['checked'] = $row['checked'] ?? null; - $array['access_controls'][$x]['access_control_uuid'] = $row['access_control_uuid']; + $array[$x]['checked'] = $row['checked'] ?? null; + $array[$x]['uuid'] = $row['access_control_uuid']; $x++; } @@ -80,17 +80,20 @@ switch ($action) { case 'copy': if (permission_exists('access_control_add')) { - $database->copy($array); + $obj = new access_controls; + $obj->copy($array); } break; case 'toggle': if (permission_exists('access_control_edit')) { - $database->toggle($array); + $obj = new access_controls; + $obj->toggle($array); } break; case 'delete': if (permission_exists('access_control_delete')) { - $database->delete($array); + $obj = new access_controls; + $obj->delete($array); } break; } diff --git a/app/access_controls/resources/classes/access_controls.php b/app/access_controls/resources/classes/access_controls.php index 29fe4c98b2..6e61f3f084 100644 --- a/app/access_controls/resources/classes/access_controls.php +++ b/app/access_controls/resources/classes/access_controls.php @@ -222,6 +222,14 @@ foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/bridges/resources/classes/bridges.php b/app/bridges/resources/classes/bridges.php index 7967b746b0..8af148f485 100644 --- a/app/bridges/resources/classes/bridges.php +++ b/app/bridges/resources/classes/bridges.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -249,6 +249,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $x => $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/call_block/resources/classes/call_block.php b/app/call_block/resources/classes/call_block.php index 4039adc393..857e3e509a 100644 --- a/app/call_block/resources/classes/call_block.php +++ b/app/call_block/resources/classes/call_block.php @@ -272,6 +272,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $x => $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/call_centers/resources/classes/call_center.php b/app/call_centers/resources/classes/call_center.php index a466e5b3c8..c9f5b62e9c 100644 --- a/app/call_centers/resources/classes/call_center.php +++ b/app/call_centers/resources/classes/call_center.php @@ -533,6 +533,14 @@ $new_call_center_queue_uuid = uuid(); $new_dialplan_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -566,6 +574,14 @@ $dialplan = $this->database->select($sql_3, $parameters_3, 'row'); if (is_array($dialplan) && @sizeof($dialplan) != 0) { + //convert boolean values to a string + foreach($dialplan as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $dialplan[$key] = $value; + } + } + //copy data $array['dialplans'][$x] = $dialplan; diff --git a/app/call_flows/resources/classes/call_flows.php b/app/call_flows/resources/classes/call_flows.php index a9f460a872..807b4d9996 100644 --- a/app/call_flows/resources/classes/call_flows.php +++ b/app/call_flows/resources/classes/call_flows.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008 - 2019 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -363,6 +363,14 @@ $new_call_flow_uuid = uuid(); $new_dialplan_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -377,6 +385,14 @@ $dialplan = $this->database->select($sql_2, $parameters_2, 'row'); if (is_array($dialplan) && @sizeof($dialplan) != 0) { + //convert boolean values to a string + foreach($dialplan as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $dialplan[$key] = $value; + } + } + //copy data $array['dialplans'][$x] = $dialplan; diff --git a/app/conference_controls/resources/classes/conference_controls.php b/app/conference_controls/resources/classes/conference_controls.php index f78eaba3fc..dfd0be916d 100644 --- a/app/conference_controls/resources/classes/conference_controls.php +++ b/app/conference_controls/resources/classes/conference_controls.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2019-2023 + Portions created by the Initial Developer are Copyright (C) 2019-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -363,6 +363,14 @@ foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -377,6 +385,14 @@ if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } + //copy data $array['conference_control_details'][$y] = $row_2; @@ -397,7 +413,6 @@ //save the changes and set the message if (is_array($array) && @sizeof($array) != 0) { //save the array - $this->database->save($array); unset($array); diff --git a/app/conference_profiles/resources/classes/conference_profiles.php b/app/conference_profiles/resources/classes/conference_profiles.php index e742b2e621..6c7748162a 100644 --- a/app/conference_profiles/resources/classes/conference_profiles.php +++ b/app/conference_profiles/resources/classes/conference_profiles.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2019-2023 + Portions created by the Initial Developer are Copyright (C) 2019-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -107,7 +107,7 @@ $p->add('conference_profile_param_delete', 'temp'); //execute delete - $this->$database->delete($array); + $this->database->delete($array); unset($array); //revoke temporary permissions @@ -159,7 +159,7 @@ //delete the checked rows if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //execute delete - $this->$database->delete($array); + $this->database->delete($array); unset($array); //set message @@ -207,7 +207,7 @@ 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).") "; - $rows = $this->$database->select($sql, $parameters ?? null, 'all'); + $rows = $this->database->select($sql, $parameters ?? null, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $row) { $states[$row['uuid']] = $row['toggle']; @@ -230,7 +230,7 @@ //save the changes if (is_array($array) && @sizeof($array) != 0) { //save the array - $this->$database->save($array); + $this->database->save($array); unset($array); //set message @@ -275,7 +275,7 @@ 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).") "; - $rows = $this->$database->select($sql, $parameters ?? null, 'all'); + $rows = $this->database->select($sql, $parameters ?? null, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $row) { $states[$row['uuid']] = $row['toggle']; @@ -300,7 +300,7 @@ //save the changes if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //save the array - $this->$database->save($array); + $this->database->save($array); unset($array); //set message @@ -352,12 +352,20 @@ //primary table $sql = "select * from v_".$this->table." "; $sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") "; - $rows = $this->$database->select($sql, $parameters ?? null, 'all'); + $rows = $this->database->select($sql, $parameters ?? null, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { $y = 0; foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -368,10 +376,18 @@ //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']; - $rows_2 = $this->$database->select($sql_2, $parameters_2, 'all'); + $rows_2 = $this->database->select($sql_2, $parameters_2, 'all'); if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } + //copy data $array['conference_profile_params'][$y] = $row_2; @@ -398,7 +414,7 @@ $p->add('conference_profile_param_add', 'temp'); //save the array - $this->$database->save($array); + $this->database->save($array); unset($array); //revoke temporary permissions diff --git a/app/conferences/resources/classes/conferences.php b/app/conferences/resources/classes/conferences.php index 2975197b70..8d48fc0ea5 100644 --- a/app/conferences/resources/classes/conferences.php +++ b/app/conferences/resources/classes/conferences.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -303,6 +303,14 @@ $new_conference_uuid = uuid(); $new_dialplan_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -321,6 +329,14 @@ if (is_array($conference_users) && @sizeof($conference_users) != 0) { foreach ($conference_users as $conference_user) { + //convert boolean values to a string + foreach($conference_user as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $conference_user[$key] = $value; + } + } + //copy data $array['conference_users'][$y] = $conference_user; @@ -341,6 +357,14 @@ $dialplan = $this->database->select($sql_3, $parameters_3, 'row'); if (is_array($dialplan) && @sizeof($dialplan) != 0) { + //convert boolean values to a string + foreach($dialplan as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $dialplan[$key] = $value; + } + } + //copy data $array['dialplans'][$x] = $dialplan; diff --git a/app/devices/device_copy.php b/app/devices/device_copy.php index 08c4051e61..e25f00612b 100644 --- a/app/devices/device_copy.php +++ b/app/devices/device_copy.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -71,7 +71,30 @@ } //get the device - $sql = "select * from v_devices "; + $sql = "select "; + $sql .= "device_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "device_profile_uuid, "; + $sql .= "device_address, "; + $sql .= "device_label, "; + $sql .= "device_vendor, "; + $sql .= "device_location, "; + $sql .= "device_model, "; + $sql .= "device_firmware_version, "; + $sql .= "cast(device_enabled as text), "; + $sql .= "device_enabled_date, "; + $sql .= "device_template, "; + $sql .= "device_user_uuid, "; + $sql .= "device_username, "; + $sql .= "device_password, "; + $sql .= "device_uuid_alternate, "; + $sql .= "device_description, "; + $sql .= "device_provisioned_date, "; + $sql .= "device_provisioned_method, "; + $sql .= "device_provisioned_ip, "; + $sql .= "device_provisioned_agent, "; + $sql .= "device_serial_number "; + $sql .= "from v_devices "; $sql .= "where device_uuid = :device_uuid "; $parameters['device_uuid'] = $device_uuid; $devices = $database->select($sql, $parameters, 'all'); diff --git a/app/devices/resources/classes/device.php b/app/devices/resources/classes/device.php index ad0c7f0f65..82e6c8ddd5 100644 --- a/app/devices/resources/classes/device.php +++ b/app/devices/resources/classes/device.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2010 - 2024 + Copyright (C) 2010-2025 All Rights Reserved. Contributor(s): @@ -1323,6 +1323,14 @@ foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -1346,6 +1354,14 @@ if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } + //copy data $array['device_profile_keys'][$y] = $row_2; @@ -1367,6 +1383,14 @@ if (is_array($rows_3) && @sizeof($rows_3) != 0) { foreach ($rows_3 as $row_3) { + //convert boolean values to a string + foreach($row_3 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_3[$key] = $value; + } + } + //copy data $array['device_profile_settings'][$z] = $row_3; diff --git a/app/dialplans/resources/classes/dialplan.php b/app/dialplans/resources/classes/dialplan.php index 1f54c573f8..d3391a41d1 100644 --- a/app/dialplans/resources/classes/dialplan.php +++ b/app/dialplans/resources/classes/dialplan.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2010-2023 + Copyright (C) 2010-2025 All Rights Reserved. Contributor(s): @@ -1350,6 +1350,14 @@ //set a unique uuid $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -1378,6 +1386,14 @@ if (!empty($rows_2)) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } + //copy data $array['dialplan_details'][$y] = $row_2; diff --git a/app/event_guard/resources/classes/event_guard.php b/app/event_guard/resources/classes/event_guard.php index 6e248eebc9..19172584b5 100644 --- a/app/event_guard/resources/classes/event_guard.php +++ b/app/event_guard/resources/classes/event_guard.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2019-2023 + Portions created by the Initial Developer are Copyright (C) 2019-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -290,6 +290,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { $x = 0; foreach ($rows as $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/extension_settings/resources/classes/extension_settings.php b/app/extension_settings/resources/classes/extension_settings.php index 4710c66a55..fb08b8cb91 100644 --- a/app/extension_settings/resources/classes/extension_settings.php +++ b/app/extension_settings/resources/classes/extension_settings.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2021-2023 + Portions created by the Initial Developer are Copyright (C) 2021-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -128,8 +128,8 @@ //execute delete $this->database->delete($array); unset($array); - - //clear the cache + + //clear the cache $sql = "select extension, number_alias, user_context from v_extensions "; $sql .= "where extension_uuid = :extension_uuid "; $parameters['extension_uuid'] = $this->extension_uuid; @@ -204,8 +204,8 @@ $this->database->save($array); unset($array); - - //clear the cache + + //clear the cache $sql = "select extension, number_alias, user_context from v_extensions "; $sql .= "where extension_uuid = :extension_uuid "; $parameters['extension_uuid'] = $extension_uuid; @@ -261,6 +261,14 @@ foreach ($rows as $x => $row) { // var_dump($row); exit; + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/extensions/extension_copy.php b/app/extensions/extension_copy.php index aab7983439..af8127ff6f 100644 --- a/app/extensions/extension_copy.php +++ b/app/extensions/extension_copy.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -66,7 +66,40 @@ } //get the extension data - $sql = "select * from v_extensions "; + $sql = "select "; + $sql .= "extension, "; + $sql .= "number_alias, "; + $sql .= "accountcode, "; + $sql .= "effective_caller_id_name, "; + $sql .= "effective_caller_id_number, "; + $sql .= "outbound_caller_id_name, "; + $sql .= "outbound_caller_id_number, "; + $sql .= "emergency_caller_id_name, "; + $sql .= "emergency_caller_id_number, "; + $sql .= "directory_visible, "; + $sql .= "directory_exten_visible, "; + $sql .= "limit_max, "; + $sql .= "limit_destination, "; + $sql .= "user_context, "; + $sql .= "missed_call_app, "; + $sql .= "missed_call_data, "; + $sql .= "toll_allow, "; + $sql .= "call_timeout, "; + $sql .= "call_group, "; + $sql .= "user_record, "; + $sql .= "hold_music, "; + $sql .= "auth_acl, "; + $sql .= "cidr, "; + $sql .= "sip_force_contact, "; + $sql .= "nibble_account, "; + $sql .= "sip_force_expires, "; + $sql .= "mwi_account, "; + $sql .= "sip_bypass_media, "; + $sql .= "dial_string, "; + $sql .= "extension_type, "; + $sql .= "cast(enabled as text), "; + $sql .= "description "; + $sql .= "from v_extensions "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and extension_uuid = :extension_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; @@ -151,7 +184,12 @@ if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) { //get the voicemails - $sql = "select * from v_voicemails "; + $sql = "select "; + $sql .= "voicemail_mail_to, "; + $sql .= "voicemail_file, "; + $sql .= "voicemail_local_after_email, "; + $sql .= "cast(voicemail_enabled as text) "; + $sql .= "from v_voicemails "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and voicemail_id = :voicemail_id "; $parameters['voicemail_id'] = is_numeric($number_alias) ? $number_alias : $extension; @@ -198,4 +236,4 @@ header("Location: extensions.php?".(!empty($order_by) ? '&order_by='.$order_by.'&order='.$order : null).(is_numeric($page) ? '&page='.$page : null)); exit; -?> \ No newline at end of file +?> diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index e9d0611316..3fd9eff015 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008 - 2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -588,6 +588,14 @@ $new_fax_uuid = uuid(); $new_dialplan_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -610,6 +618,14 @@ if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } + //copy data $array['fax_users'][$y] = $row_2; @@ -630,6 +646,14 @@ $dialplan = $this->database->select($sql_3, $parameters_3, 'row'); if (is_array($dialplan) && @sizeof($dialplan) != 0) { + //convert boolean values to a string + foreach($dialplan as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $dialplan[$key] = $value; + } + } + //copy data $array['dialplans'][$x] = $dialplan; diff --git a/app/fax_queue/resources/classes/fax_queue.php b/app/fax_queue/resources/classes/fax_queue.php index 253f277761..3ed1506a89 100644 --- a/app/fax_queue/resources/classes/fax_queue.php +++ b/app/fax_queue/resources/classes/fax_queue.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2019 - 2021 + Portions created by the Initial Developer are Copyright (C) 2019-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -277,6 +277,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { $x = 0; foreach ($rows as $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/gateways/resources/classes/gateways.php b/app/gateways/resources/classes/gateways.php index 1951b9d366..491842b2d2 100644 --- a/app/gateways/resources/classes/gateways.php +++ b/app/gateways/resources/classes/gateways.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2022 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -537,6 +537,14 @@ foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/ivr_menus/resources/classes/ivr_menu.php b/app/ivr_menus/resources/classes/ivr_menu.php index f677a93a29..a01065509e 100644 --- a/app/ivr_menus/resources/classes/ivr_menu.php +++ b/app/ivr_menus/resources/classes/ivr_menu.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -109,7 +109,7 @@ $this->permission_prefix = 'ivr_menu_'; $this->table = 'ivr_menus'; $this->uuid_prefix = 'ivr_menu_'; - + //return if permission does not exist if (!permission_exists($this->permission_prefix.'delete')) { return false; @@ -412,6 +412,14 @@ $new_ivr_menu_uuid = uuid(); $new_dialplan_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -426,6 +434,13 @@ $rows_2 = $this->database->select($sql_2, $parameters_2, 'all'); if (!empty($rows_2)) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } //copy data $array['ivr_menu_options'][$y] = $row_2; @@ -446,6 +461,13 @@ $parameters_3['dialplan_uuid'] = $row['dialplan_uuid']; $dialplan = $this->database->select($sql_3, $parameters_3, 'row'); if (!empty($dialplan)) { + //convert boolean values to a string + foreach($dialplan as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $dialplan[$key] = $value; + } + } //copy data $array['dialplans'][$z] = $dialplan; diff --git a/app/number_translations/resources/classes/number_translations.php b/app/number_translations/resources/classes/number_translations.php index fa1b236bee..0c10e446d5 100644 --- a/app/number_translations/resources/classes/number_translations.php +++ b/app/number_translations/resources/classes/number_translations.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -344,6 +344,14 @@ foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -357,6 +365,13 @@ $rows_2 = $this->database->select($sql_2, $parameters_2, 'all'); if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } //copy data $array['number_translation_details'][$y] = $row_2; diff --git a/app/phrases/resources/classes/phrases.php b/app/phrases/resources/classes/phrases.php index f09e63ac75..fad286a666 100644 --- a/app/phrases/resources/classes/phrases.php +++ b/app/phrases/resources/classes/phrases.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -361,6 +361,14 @@ foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -375,6 +383,14 @@ if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } + //copy data $array['phrase_details'][$y] = $row_2; diff --git a/app/pin_numbers/resources/classes/pin_numbers.php b/app/pin_numbers/resources/classes/pin_numbers.php index 17fe911935..1a74e65438 100644 --- a/app/pin_numbers/resources/classes/pin_numbers.php +++ b/app/pin_numbers/resources/classes/pin_numbers.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2016-2019 + Portions created by the Initial Developer are Copyright (C) 2016-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -228,6 +228,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $x => $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/ring_groups/resources/classes/ring_groups.php b/app/ring_groups/resources/classes/ring_groups.php index 3ad6b4a127..b79269d704 100644 --- a/app/ring_groups/resources/classes/ring_groups.php +++ b/app/ring_groups/resources/classes/ring_groups.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2010-2023 + Portions created by the Initial Developer are Copyright (C) 2010-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -407,6 +407,14 @@ $new_ring_group_uuid = uuid(); $new_dialplan_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -422,6 +430,14 @@ if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } + //copy data $array['ring_group_users'][$y] = $row_2; @@ -443,6 +459,14 @@ if (is_array($rows_3) && @sizeof($rows_3) != 0) { foreach ($rows_3 as $row_3) { + //convert boolean values to a string + foreach($row_3 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_3[$key] = $value; + } + } + //copy data $array['ring_group_destinations'][$z] = $row_3; @@ -463,6 +487,14 @@ $dialplan = $this->database->select($sql_4, $parameters_4, 'row'); if (is_array($dialplan) && @sizeof($dialplan) != 0) { + //convert boolean values to a string + foreach($dialplan as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $dialplan[$key] = $value; + } + } + //copy data $array['dialplans'][$x] = $dialplan; diff --git a/app/streams/resources/classes/streams.php b/app/streams/resources/classes/streams.php index cdabef3be0..f6c9866c8c 100644 --- a/app/streams/resources/classes/streams.php +++ b/app/streams/resources/classes/streams.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018-2023 + Portions created by the Initial Developer are Copyright (C) 2018-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -245,6 +245,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $x => $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/app/time_conditions/resources/classes/time_conditions.php b/app/time_conditions/resources/classes/time_conditions.php index c6038bc29c..a5d8767366 100644 --- a/app/time_conditions/resources/classes/time_conditions.php +++ b/app/time_conditions/resources/classes/time_conditions.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2010-2019 + Copyright (C) 2010-2025 All Rights Reserved. Contributor(s): @@ -304,6 +304,14 @@ foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -318,6 +326,14 @@ if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } + //copy data $array['dialplan_details'][$y] = $row_2; diff --git a/app/vars/resources/classes/vars.php b/app/vars/resources/classes/vars.php index 3456c6814e..f00ce49c3a 100644 --- a/app/vars/resources/classes/vars.php +++ b/app/vars/resources/classes/vars.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -216,6 +216,14 @@ if (!empty($rows) && @sizeof($rows) != 0) { foreach ($rows as $x => $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/core/email_templates/resources/classes/email_templates.php b/core/email_templates/resources/classes/email_templates.php index cea75612a1..831e717cc0 100644 --- a/core/email_templates/resources/classes/email_templates.php +++ b/core/email_templates/resources/classes/email_templates.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -227,6 +227,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { foreach ($rows as $x => $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/core/users/resources/classes/users.php b/core/users/resources/classes/users.php index 1f168e2ff4..fccfeb926d 100644 --- a/core/users/resources/classes/users.php +++ b/core/users/resources/classes/users.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2019-2020 + Portions created by the Initial Developer are Copyright (C) 2019-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -269,6 +269,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { $x = 0; foreach ($rows as $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -286,7 +294,6 @@ //save the changes and set the message if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //save the array - $this->database->save($array); unset($array); diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 120c452142..78d25f5352 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -416,6 +416,14 @@ if (is_array($rows) && @sizeof($rows) != 0) { $x = 0; foreach ($rows as $row) { + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; diff --git a/resources/classes/groups.php b/resources/classes/groups.php index 1d7a2a0a6f..9ab75df695 100644 --- a/resources/classes/groups.php +++ b/resources/classes/groups.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - 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): @@ -322,6 +322,14 @@ foreach ($rows as $x => $row) { $primary_uuid = uuid(); + //convert boolean values to a string + foreach($row as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row[$key] = $value; + } + } + //copy data $array[$this->table][$x] = $row; @@ -335,6 +343,13 @@ $rows_2 = $this->database->select($sql_2, $parameters_2, 'all'); if (is_array($rows_2) && @sizeof($rows_2) != 0) { foreach ($rows_2 as $row_2) { + //convert boolean values to a string + foreach($row_2 as $key => $value) { + if (gettype($value) == 'boolean') { + $value = $value ? 'true' : 'false'; + $row_2[$key] = $value; + } + } //copy data $array['group_permissions'][$y] = $row_2;