mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-08 08:59:19 +00:00
Fix domain limits being ignored when set to 0 (#7738)
This commit is contained in:
@@ -83,19 +83,17 @@
|
||||
}
|
||||
|
||||
//get total call center queues count from the database, check limit, if defined
|
||||
if ($action == 'add') {
|
||||
if (!empty($settings->get('limit','call_center_queues', ''))) {
|
||||
$sql = "select count(*) from v_call_center_queues ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$total_call_center_queues = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
if ($action == 'add' && $settings->get('limit','call_center_queues') != '') {
|
||||
$sql = "select count(*) from v_call_center_queues ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$total_call_center_queues = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
if ($total_call_center_queues >= $settings->get('limit','call_center_queues', 0)) {
|
||||
message::add($text['message-maximum_queues'].' '.$settings->get('limit','call_center_queues', ''), 'negative');
|
||||
header('Location: call_center_queues.php');
|
||||
return;
|
||||
}
|
||||
if ($total_call_center_queues >= $settings->get('limit','call_center_queues', 0)) {
|
||||
message::add($text['message-maximum_queues'].' '.$settings->get('limit','call_center_queues', ''), 'negative');
|
||||
header('Location: call_center_queues.php');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Contributor(s):
|
||||
@@ -68,20 +68,16 @@
|
||||
$record_extension = $settings->get('call_recordings', 'record_extension', 'mp3');
|
||||
|
||||
//get total destination count from the database, check limit, if defined
|
||||
if (!permission_exists('destination_domain')) {
|
||||
if ($action == 'add') {
|
||||
if (!empty($settings->get('limit', 'destinations', ''))) {
|
||||
$sql = "select count(*) from v_destinations where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$total_destinations = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
if ($action == 'add' && $settings->get('limit', 'destinations', '') != '' && !permission_exists('destination_domain')) {
|
||||
$sql = "select count(*) from v_destinations where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$total_destinations = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
if ($total_destinations >= $settings->get('limit', 'destinations', '')) {
|
||||
message::add($text['message-maximum_destinations'].' '.$settings->get('limit', 'destinations', ''), 'negative');
|
||||
header('Location: destinations.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ($total_destinations >= $settings->get('limit', 'destinations', '')) {
|
||||
message::add($text['message-maximum_destinations'].' '.$settings->get('limit', 'destinations', ''), 'negative');
|
||||
header('Location: destinations.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Contributor(s):
|
||||
@@ -116,20 +116,18 @@
|
||||
}
|
||||
|
||||
//get total extension count from the database, check limit, if defined
|
||||
if ($action == 'add') {
|
||||
if ($limit_extensions > 0) {
|
||||
$sql = "select count(extension_uuid) ";
|
||||
$sql .= "from v_extensions ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$total_extensions = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
if ($action == 'add' && $limit_extensions != '') {
|
||||
$sql = "select count(extension_uuid) ";
|
||||
$sql .= "from v_extensions ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$total_extensions = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
if ($total_extensions >= $limit_extensions) {
|
||||
message::add($text['message-maximum_extensions'].' '.$limit_extensions, 'negative');
|
||||
header('Location: extensions.php?'.(!empty($order_by) ? '&order_by='.$order_by.'&order='.$order : null).(isset($page) && is_numeric($page) ? '&page='.$page : null));
|
||||
exit;
|
||||
}
|
||||
if ($total_extensions >= $limit_extensions) {
|
||||
message::add($text['message-maximum_extensions'].' '.$limit_extensions, 'negative');
|
||||
header('Location: extensions.php?'.(!empty($order_by) ? '&order_by='.$order_by.'&order='.$order : null).(isset($page) && is_numeric($page) ? '&page='.$page : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Contributor(s):
|
||||
@@ -54,18 +54,17 @@
|
||||
}
|
||||
|
||||
//get total gateway count from the database, check limit, if defined
|
||||
if ($action == 'add') {
|
||||
if (!empty($settings->get('limit', 'gateways'))) {
|
||||
$sql = "select count(gateway_uuid) from v_gateways ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$total_gateways = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
if ($total_gateways >= $settings->get('limit', 'gateways')) {
|
||||
message::add($text['message-maximum_gateways'].' '.$settings->get('limit', 'gateways'), 'negative');
|
||||
header('Location: gateways.php');
|
||||
exit;
|
||||
}
|
||||
if ($action == 'add' && $settings->get('limit', 'gateways') != '') {
|
||||
$sql = "select count(gateway_uuid) from v_gateways ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$total_gateways = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
if ($total_gateways >= $settings->get('limit', 'gateways')) {
|
||||
message::add($text['message-maximum_gateways'].' '.$settings->get('limit', 'gateways'), 'negative');
|
||||
header('Location: gateways.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,13 +79,13 @@
|
||||
}
|
||||
|
||||
//get total ivr menu count from the database, check limit, if defined
|
||||
if (!empty($settings->get('limit', 'ivr_menus'))) {
|
||||
if ($action == 'add' && $settings->get('limit', 'ivr_menus') != '') {
|
||||
$sql = "select count(*) as num_rows from v_ivr_menus where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$total_ivr_menus = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
if ($action == 'add' && $total_ivr_menus >= $settings->get('limit', 'ivr_menus')) {
|
||||
if ($total_ivr_menus >= $settings->get('limit', 'ivr_menus')) {
|
||||
message::add($text['message-maximum_ivr_menus'].' '.$settings->get('limit', 'ivr_menus'), 'negative');
|
||||
header('Location: ivr_menus.php');
|
||||
exit;
|
||||
|
||||
@@ -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) 2010-2025
|
||||
Portions created by the Initial Developer are Copyright (C) 2010-2026
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -137,7 +137,7 @@
|
||||
}
|
||||
|
||||
//get total ring group count from the database, check limit, if defined
|
||||
if ($action == 'add' && $settings->get('limit', 'ring_groups', '') ?? '') {
|
||||
if ($action == 'add' && $settings->get('limit', 'ring_groups') != '') {
|
||||
$sql = "select count(*) from v_ring_groups ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Contributor(s):
|
||||
@@ -50,7 +50,7 @@
|
||||
}
|
||||
|
||||
//get total user count from the database, check limit, if defined
|
||||
if (permission_exists('user_add') && $action == 'add' && !empty($settings->get('limit', 'users'))) {
|
||||
if (permission_exists('user_add') && $action == 'add' && $settings->get('limit', 'users') != '') {
|
||||
$sql = "select count(*) ";
|
||||
$sql .= "from v_users ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
|
||||
Reference in New Issue
Block a user