Consolidate the SQL Queries for better performance.

This commit is contained in:
markjcrane 2016-01-16 09:54:01 -07:00
parent 285cad06da
commit 74ca9eb980
2 changed files with 3 additions and 11 deletions

View File

@ -743,14 +743,6 @@ include "root.php";
}
unset ($prep_statement);
//populate internal address book
$sql = "SELECT extension as , effective_caller_id_name, effective_caller_id_number, outbound_caller_id_name, outbound_caller_id_number, directory_full_name FROM v_extensions";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$internal_addressbook = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$view->assign("internal_addressbook",$internal_addressbook);
unset ($prep_statement);
//set the mac address in the correct format
$mac = $this->format_mac($mac, $device_vendor);

View File

@ -117,11 +117,11 @@
{/foreach}
</functionKeys>
<tbook e="2" complete="true">
{foreach $internal_addressbook as $address}
{foreach $extensions as $row}
<item context="active" type="" fav="false">
<number>{$address.extension}</number>
<number>{$row.extension}</number>
<number_type>sip</number_type>
<first_name>{$address.directory_full_name} ({$address.extension})</first_name>
<first_name>{$row.directory_full_name} ({$row.extension})</first_name>
</item>
{/foreach}