Device [Class]: Updates for PHP 8.1
This commit is contained in:
parent
d0357b6124
commit
798001bb23
|
|
@ -1052,11 +1052,11 @@
|
||||||
$uuids[] = "'".$record['uuid']."'";
|
$uuids[] = "'".$record['uuid']."'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_array($uuids) && @sizeof($uuids) != 0) {
|
if (!empty($uuids) && is_array($uuids) && @sizeof($uuids) != 0) {
|
||||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
||||||
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$rows = $database->select($sql, $parameters, 'all');
|
$rows = $database->select($sql, $parameters ?? null, 'all');
|
||||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$states[$row['uuid']] = $row['toggle'];
|
$states[$row['uuid']] = $row['toggle'];
|
||||||
|
|
@ -1067,10 +1067,12 @@
|
||||||
|
|
||||||
//build update array
|
//build update array
|
||||||
$x = 0;
|
$x = 0;
|
||||||
foreach ($states as $uuid => $state) {
|
if (!empty($states) && is_array($states) && @sizeof($states) != 0) {
|
||||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
|
foreach ($states as $uuid => $state) {
|
||||||
$array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
|
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
|
||||||
$x++;
|
$array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//save the changes
|
//save the changes
|
||||||
|
|
@ -1128,7 +1130,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//create insert array from existing data
|
//create insert array from existing data
|
||||||
if (is_array($uuids) && @sizeof($uuids) != 0) {
|
if (!empty($uuids) && is_array($uuids) && @sizeof($uuids) != 0) {
|
||||||
$sql = "select * from v_".$this->table." ";
|
$sql = "select * from v_".$this->table." ";
|
||||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue