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
This commit is contained in:
Alex
2025-10-22 16:14:22 -07:00
committed by GitHub
parent 0ab13ffc31
commit 126779190f
30 changed files with 485 additions and 51 deletions

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) 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