Update gateways.php

Add an 'or domain_uuid is null' if permission gateway_domain is given to the group.
This commit is contained in:
FusionPBX
2016-06-14 11:14:06 -06:00
committed by GitHub
parent 521bf62695
commit 1f09ffc115
+12 -3
View File
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2016
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -101,7 +101,12 @@ else {
echo "<br />\n"; echo "<br />\n";
//get total gateway count from the database //get total gateway count from the database
$sql = "select count(*) as num_rows from v_gateways where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql = "select count(*) as num_rows from v_gateways ";
$sql .= "where ( domain_uuid = '".$_SESSION['domain_uuid']."' ";
if (permission_exists('gateway_domain') {
$sql .= "or domain_uuid is null ";
}
$sql .= ");";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
if ($prep_statement) { if ($prep_statement) {
$prep_statement->execute(); $prep_statement->execute();
@@ -120,7 +125,11 @@ else {
//get the list //get the list
$sql = "select * from v_gateways "; $sql = "select * from v_gateways ";
$sql .= "where (domain_uuid = '$domain_uuid' or domain_uuid is null) "; $sql .= "where ( domain_uuid = '".$_SESSION['domain_uuid']."' ";
if (permission_exists('gateway_domain') {
$sql .= "or domain_uuid is null ";
}
$sql .= ");";
if (strlen($order_by) == 0) { if (strlen($order_by) == 0) {
$sql .= "order by gateway asc "; $sql .= "order by gateway asc ";
} }