Extension Settings [Class]: Updates for PHP 8.1, fix Copy of disabled record.
This commit is contained in:
parent
4b249e1fe4
commit
2cc5035ceb
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2021
|
Portions created by the Initial Developer are Copyright (C) 2021-2023
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -85,7 +85,7 @@ if (!class_exists('extension_settings')) {
|
||||||
$x = 0;
|
$x = 0;
|
||||||
foreach ($records as $record) {
|
foreach ($records as $record) {
|
||||||
//add to the array
|
//add to the array
|
||||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||||
$array[$this->table][$x][$this->name.'_uuid'] = $record['uuid'];
|
$array[$this->table][$x][$this->name.'_uuid'] = $record['uuid'];
|
||||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
}
|
}
|
||||||
|
|
@ -142,8 +142,8 @@ if (!class_exists('extension_settings')) {
|
||||||
//toggle the checked records
|
//toggle the checked records
|
||||||
if (is_array($records) && @sizeof($records) != 0) {
|
if (is_array($records) && @sizeof($records) != 0) {
|
||||||
//get current toggle state
|
//get current toggle state
|
||||||
foreach($records as $record) {
|
foreach ($records as $record) {
|
||||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||||
$uuids[] = "'".$record['uuid']."'";
|
$uuids[] = "'".$record['uuid']."'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -223,8 +223,8 @@ if (!class_exists('extension_settings')) {
|
||||||
if (is_array($records) && @sizeof($records) != 0) {
|
if (is_array($records) && @sizeof($records) != 0) {
|
||||||
|
|
||||||
//get checked records
|
//get checked records
|
||||||
foreach($records as $record) {
|
foreach ($records as $record) {
|
||||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||||
$uuids[] = "'".$record['uuid']."'";
|
$uuids[] = "'".$record['uuid']."'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -238,17 +238,17 @@ if (!class_exists('extension_settings')) {
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$rows = $database->select($sql, $parameters, 'all');
|
$rows = $database->select($sql, $parameters, 'all');
|
||||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||||
$x = 0;
|
foreach ($rows as $x => $row) {
|
||||||
foreach ($rows as $row) {
|
// var_dump($row); exit;
|
||||||
|
|
||||||
//copy data
|
//copy data
|
||||||
$array[$this->table][$x] = $row;
|
$array[$this->table][$x] = $row;
|
||||||
|
|
||||||
//add copy to the description
|
//overwrite
|
||||||
$array[$this->table][$x][$this->name.'_uuid'] = uuid();
|
$array[$this->table][$x][$this->name.'_uuid'] = uuid();
|
||||||
$array[$this->table][$x][$this->description_field] = trim($row[$this->description_field]).' ('.$text['label-copy'].')';
|
$array[$this->table][$x][$this->name.'_enabled'] = $row['extension_setting_enabled'] === true ? 'true' : 'false';
|
||||||
|
$array[$this->table][$x][$this->description_field] = trim($row[$this->description_field] ?? '').' ('.$text['label-copy'].')';
|
||||||
|
|
||||||
//increment the id
|
|
||||||
$x++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($sql, $parameters, $rows, $row);
|
unset($sql, $parameters, $rows, $row);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue