Display message for limits instead of hiding add and copy buttons (#7681)

* Display message for limits instead of hiding add and copy buttons

* Update ivr_menus.php

* Update gateways.php

* Update extensions.php

* Update devices.php

* Update call_center_queues.php

* Update app_languages.php

* Update voicemail_greetings.php

* Update users.php

* Update voicemail_greetings.php

* Update call_center_queues.php
This commit is contained in:
Alex
2025-12-26 17:08:14 -07:00
committed by GitHub
parent 2373b45515
commit e0f62aa5b9
9 changed files with 144 additions and 29 deletions

View File

@@ -46,6 +46,20 @@
$gateways = $_POST['gateways'] ?? '';
}
//get total gateway count from the database, check limit, if defined
if (!empty($action) && $action == 'copy' && !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;
}
}
//process the http post data by action
if (!empty($action) && !empty($gateways)) {
switch ($action) {