diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 5a8a5647fe..d71116094f 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -148,7 +148,7 @@ $sql .= "limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $destinations = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); //alternate the row style @@ -217,6 +217,9 @@ echo " \n"; echo " \n"; echo " \n"; + if ($_GET['show'] == "all" && permission_exists('destination_all')) { + echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param); + } echo th_order_by('destination_type', $text['label-destination_type'], $order_by, $order); echo th_order_by('destination_number', $text['label-destination_number'], $order_by, $order); echo th_order_by('destination_context', $text['label-destination_context'], $order_by, $order); @@ -236,20 +239,28 @@ echo " \n"; echo "\n"; - if (is_array($result)) { + if (is_array($destinations)) { $x = 0; - foreach($result as $row) { + foreach($destinations as $row) { if (permission_exists('destination_edit')) { $tr_link = "href='destination_edit.php?id=".$row['destination_uuid']."'"; } echo "\n"; - //echo " ".$row['domain_uuid']." \n"; //echo " ".$row['destination_uuid']." \n"; //echo " ".$row['dialplan_uuid']." \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; + if ($_GET['show'] == "all" && permission_exists('destination_all')) { + if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { + $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; + } + else { + $domain = $text['label-global']; + } + echo " ".$domain."\n"; + } echo " ".$row['destination_type']." \n"; echo " ".format_phone($row['destination_number'])." \n"; //echo " ".$row['destination_number_regex']." \n"; @@ -278,11 +289,11 @@ $x++; if ($c==0) { $c=1; } else { $c=0; } } //end foreach - unset($sql, $result, $row_count); + unset($sql, $destinations, $row_count); } //end if results echo "\n"; - echo "\n"; + echo "\n"; echo " \n"; echo " \n"; echo " \n";