From 4eeb8f109ca80cbec1c4a528939dfd9885b2f60a Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Fri, 27 Mar 2015 18:13:03 +0000 Subject: [PATCH] Fix Destinations so that it will correctly show DIDs that are not assigned to a domain. --- app/destinations/destinations.php | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index e1d50f09dd..2004734072 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -77,16 +77,6 @@ else { echo "\n"; //get total destination count from the database - $sql = "select count(*) as num_rows from v_destinations where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - $total_destinations = $row['num_rows']; - } - unset($sql, $prep_statement, $row); - - //prepare to page the results $sql = "select count(*) as num_rows from v_destinations "; if ($_GET['showall'] && permission_exists('destination_show_all')) { if (strlen($search) > 0) { @@ -111,7 +101,7 @@ else { if ($prep_statement) { $prep_statement->execute(); $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - $num_rows = $row['num_rows']; + $total_destinations = $row['num_rows']; } else { $num_rows = 0; @@ -125,13 +115,12 @@ else { } $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + list($paging_controls, $rows_per_page, $var3) = paging($total_destinations, $param, $rows_per_page); $offset = $rows_per_page * $page; //get the list $sql = "select * from v_destinations "; if ($_GET['showall'] && permission_exists('destination_show_all')) { - $sql .= " join v_domains on v_domains.domain_uuid = v_destinations.domain_uuid "; if (strlen($search) > 0) { $sql .= " where "; } @@ -154,8 +143,8 @@ else { $sql .= "limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - $result = $prep_statement->fetchAll(); - $result_count = count($result); + $destination = $prep_statement->fetchAll(); + $destination_count = count($destination); unset ($prep_statement, $sql); $c = 0; @@ -181,12 +170,12 @@ else { echo "\n"; echo "\n"; - if ($result_count > 0) { - foreach($result as $row) { + if ($destination_count > 0) { + foreach($destination as $row) { $tr_link = "href='destination_edit.php?id=".$row['destination_uuid']."'"; echo "\n"; if ($_GET['showall'] && permission_exists('destination_show_all')) { - echo " ".$row['domain_name']."\n"; + echo " ".$_SESSION['domains'][$row['domain_uuid']]['domain_name']."\n"; } echo " ".ucwords($row['destination_type'])."\n"; echo " ".$row['destination_number']."\n"; @@ -204,7 +193,7 @@ else { echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } //end foreach - unset($sql, $result, $row_count); + unset($sql, $destination, $row_count); } //end if results echo "\n";