Destinations - change negative condition to a positive one.

Usually best use positive conditions rather as they are easier to follow.
This commit is contained in:
FusionPBX
2023-05-21 16:19:54 -06:00
committed by GitHub
parent efc332aba7
commit e0d8574410
+13 -7
View File
@@ -48,9 +48,9 @@
//get posted data //get posted data
if (!empty($_POST['destinations'])) { if (!empty($_POST['destinations'])) {
$action = $_POST['action']; $action = $_POST['action'] ?? '';
$search = $_POST['search']; $search = $_POST['search'] ?? '';
$destinations = $_POST['destinations']; $destinations = $_POST['destinations'] ?? '';
} }
//process the http post data by action //process the http post data by action
@@ -123,8 +123,11 @@
//prepare to page the results //prepare to page the results
$sql = "select count(*) from v_destinations "; $sql = "select count(*) from v_destinations ";
$sql .= "where destination_type = :destination_type "; if ($show == "all" && permission_exists('destination_all')) {
if ($show != "all" || !permission_exists('destination_all')) { $sql .= "where destination_type = :destination_type ";
}
else {
$sql .= "where destination_type = :destination_type ";
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
@@ -165,8 +168,11 @@
//get the list //get the list
$sql = "select * from v_destinations "; $sql = "select * from v_destinations ";
$sql .= "where destination_type = :destination_type "; if ($show == "all" && permission_exists('destination_all')) {
if ($show != "all" || !permission_exists('destination_all')) { $sql .= "where destination_type = :destination_type ";
}
else {
$sql .= "where destination_type = :destination_type ";
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }