Fix domain limits being ignored when set to 0 (#7738)

This commit is contained in:
Alex
2026-02-06 11:17:27 -07:00
committed by GitHub
parent bfcdef308d
commit 15e79122a4
8 changed files with 60 additions and 71 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) 2008-2025
Portions created by the Initial Developer are Copyright (C) 2008-2026
the Initial Developer. All Rights Reserved.
*/
@@ -59,18 +59,16 @@
}
//get the total device count from the database, check the limit, if defined
if ($action == 'add') {
if (!empty($settings->get('limit', 'devices', ''))) {
$sql = "select count(*) from v_devices where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
$total_devices = $database->select($sql, $parameters, 'column');
if ($total_devices >= $settings->get('limit', 'devices', '')) {
message::add($text['message-maximum_devices'].' '.$settings->get('limit', 'devices', ''), 'negative');
header('Location: devices.php');
exit;
}
unset($sql, $parameters, $total_devices);
if ($action == 'add' && $settings->get('limit', 'devices', '') != '') {
$sql = "select count(*) from v_devices where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
$total_devices = $database->select($sql, $parameters, 'column');
if ($total_devices >= $settings->get('limit', 'devices', '')) {
message::add($text['message-maximum_devices'].' '.$settings->get('limit', 'devices', ''), 'negative');
header('Location: devices.php');
exit;
}
unset($sql, $parameters, $total_devices);
}
//get http post variables and set them to php variables