mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Add personal directory array for provisioning.
This commit is contained in:
@@ -498,6 +498,70 @@ include "root.php";
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//get the list of contact directly assigned to the user
|
||||
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_personal']['boolean'] == "true") {
|
||||
foreach ($device_lines as &$line) {
|
||||
//get the extension uuid from the line username [one result]
|
||||
$sql = "select * from v_extensions ";
|
||||
$sql .= "where (extension = '".$line["user_id"]."' or number_alias = '".$line["user_id"]."') ";
|
||||
$sql .= "and domain_uuid = '$domain_uuid' ";
|
||||
//echo $sql."\n";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset($prep_statement);
|
||||
foreach ($extensions as &$extension) {
|
||||
$extension_uuid = $extension["extension_uuid"];
|
||||
}
|
||||
//echo "extension uuid: ".$extension_uuid."\n";
|
||||
|
||||
//get the user_uuid assigned to the extension_uuid [multiple results]
|
||||
$sql = "select user_uuid from v_extension_users ";
|
||||
$sql .= "where extension_uuid = '$extension_uuid' ";
|
||||
$sql .= "and domain_uuid = '$domain_uuid' ";
|
||||
//echo $sql."\n";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$extension_users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset($prep_statement);
|
||||
foreach ($extension_users as &$row) {
|
||||
//get the list of contacts [multiple results]
|
||||
$sql = "select contact_uuid from v_contact_users ";
|
||||
$sql .= "where user_uuid = '".$row["user_uuid"]."' ";
|
||||
$sql .= "and domain_uuid = '$domain_uuid' ";
|
||||
//echo $sql."\n";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$extension_users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset($prep_statement);
|
||||
foreach ($extension_users as &$row) {
|
||||
$contacts[] = $row["contact_uuid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get the contacts assigned to the user
|
||||
//SQL 'in' with implode contacts array prevents returning duplicate contacts
|
||||
if (sizeof($contacts) > 0) {
|
||||
$sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, ";
|
||||
$sql .= "p.phone_number, p.phone_extension ";
|
||||
$sql .= "from v_contacts as c, v_contact_phones as p ";
|
||||
$sql .= "where c.contact_uuid in ('".implode("','",$contacts)."') ";
|
||||
$sql .= "and c.contact_uuid = p.contact_uuid ";
|
||||
$sql .= "and p.phone_type_voice = '1' ";
|
||||
$sql .= "and c.domain_uuid = '$domain_uuid' ";
|
||||
//echo $sql."\n";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$directory_personal = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset($prep_statement);
|
||||
//print_r($contacts);
|
||||
}
|
||||
|
||||
//assign the contacts array
|
||||
$view->assign("directory_personal", $contacts);
|
||||
}
|
||||
|
||||
//get the contact extensions array and add to the template engine
|
||||
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") {
|
||||
//get contacts from the database
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
<Prompt>Please choose...</Prompt>
|
||||
<MenuItem>
|
||||
<Name>Our Phones</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_extensions.xml</URL>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_extensions.xml?mac={$mac}</URL>
|
||||
</MenuItem>
|
||||
<!--
|
||||
<MenuItem>
|
||||
<Name>Personal</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_personal.xml</URL>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_personal.xml?mac={$mac}</URL>
|
||||
</MenuItem>
|
||||
-->
|
||||
<MenuItem>
|
||||
<Name>Enterprise</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_enterprise.xml?mac={$mac}</URL>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Title>Personal</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}{if $row.contact_category == "personal"}
|
||||
{foreach $directory_personal as $row}
|
||||
<DirectoryEntry>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
@@ -15,7 +15,6 @@
|
||||
<Telephone>{$row.phone_extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</CiscoIPPhoneDirectory>
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
<Prompt>Please choose...</Prompt>
|
||||
<MenuItem>
|
||||
<Name>Our Phones</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_extensions.xml</URL>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_extensions.xml?mac={$mac}</URL>
|
||||
</MenuItem>
|
||||
<!--
|
||||
<MenuItem>
|
||||
<Name>Personal</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_personal.xml</URL>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_personal.xml?mac={$mac}</URL>
|
||||
</MenuItem>
|
||||
-->
|
||||
<MenuItem>
|
||||
<Name>Enterprise</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory_enterprise.xml?mac={$mac}</URL>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Title>Personal</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}{if $row.contact_category == "personal"}
|
||||
{foreach $directory_personal as $row}
|
||||
<DirectoryEntry>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
@@ -15,7 +15,6 @@
|
||||
<Telephone>{$row.phone_extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</CiscoIPPhoneDirectory>
|
||||
|
||||
Reference in New Issue
Block a user