Updated phonebook code

This commit is contained in:
Len
2020-09-28 14:19:05 -04:00
committed by GitHub
parent e591ab9ce2
commit 36a433fcb0

View File

@@ -1,49 +1,151 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="UTF-8"?>
<AddressBook> <AddressBook>
<version>1</version>
{foreach $contacts as $contact} <pbgroup>
{if $contact.contact_type == "group"} <id>1</id>
<pbgroup> <name>Users</name>
<id>{$contact.id}</id> <ringtones>default ringtone</ringtones>
<name>{$contact.group_description|truncate:10}</name> </pbgroup>
</pbgroup> <pbgroup>
{/if} <id>2</id>
{/foreach} <name>Groups</name>
{$i=0} <ringtones>default ringtone</ringtones>
{foreach $contacts as $contact} </pbgroup>
{if $contact.contact_name_given != "" && $contact.contact_type == "contact"} <pbgroup>
<Contact> <id>3</id>
<FirstName>{$contact.contact_name_given}</FirstName> <name>Extensions</name>
<LastName>{$contact.contact_name_family}</LastName> <ringtones>system</ringtones>
{if $contact.contact_role != "" } </pbgroup>
<JobTitle>{$contact.contact_role}</JobTitle>
{/if} {$start_id=0}
{if $contact.contact_category != "" } {foreach $contacts as $row}
<Department>{$contact.contact_category}</Department> {if $row.category == "users"}
{/if} <Contact>
<Phone type="Work"> <id>{$start_id++}</id>
<phonenumber>{$contact.contact_work}</phonenumber> {if $row.contact_name_given != ""}
<accountindex>1</accountindex> {if $row.contact_organization != ""}
</Phone> <FirstName>{$row.contact_name_given} {$row.contact_name_family}</FirstName>
{if $contact.contact_home != "" } <FirstName>{$row.contact_name_given} {$row.contact_name_family}</FirstName>
<Phone type="Home"> <Company>{$row.contact_organization}</Company>
<phonenumber>{$contact.contact_home}</phonenumber> {else}
<accountindex>1</accountindex> <FirstName>{$row.contact_name_given}</FirstName>
</Phone> <LastName>{$row.contact_name_family}</LastName>
{/if} {/if}
{if $contact.contact_cell != "" } {else}
<Phone type="Cell"> <FirstName>{$row.effective_caller_id_name}</FirstName>
<phonenumber>{$contact.contact_cell}</phonenumber> {/if}
<accountindex>1</accountindex> <JobTitle></JobTitle>
</Phone> <Frequent>0</Frequent>
{/if} {foreach $row.numbers as $number}
{if $contact.contact_organization != "" } {if $number.phone_number != ""}
<Company>{$contact.contact_organization}</Company> {if $number.phone_label == "work"}
{/if} <Phone type="Work">
{foreach $contact.groups as $group} <phonenumber>{$number.phone_number}</phonenumber>
<Group>{$group}</Group> <accountindex>0</accountindex>
{/foreach} </Phone>
</Contact> {/if}
{/if} {if $number.phone_label == "home"}
{/foreach} <Phone type="Home">
<phonenumber>{$number.phone_number}</phonenumber>
<accountindex>0</accountindex>
</Phone>
{/if}
{if $number.phone_label == "mobile"}
<Phone type="Cell">
<phonenumber>{$number.phone_number}</phonenumber>
<accountindex>0</accountindex>
</Phone>
{/if}
{/if}
{/foreach}
<Group>1</Group>
<Primary>0</Primary>
<Department></Department>
<Job></Job>
<Company></Company>
</Contact>
{elseif $row.category == "groups"}
<Contact>
<id>{$start_id++}</id>
{if $row.contact_name_given != ""}
{if $row.contact_organization != ""}
<FirstName>{$row.contact_name_given} {$row.contact_name_family}</FirstName>
<FirstName>{$row.contact_name_given} {$row.contact_name_family}</FirstName>
<Company>{$row.contact_organization}</Company>
{else}
<FirstName>{$row.contact_name_given}</FirstName>
<LastName>{$row.contact_name_family}</LastName>
{/if}
{else}
<FirstName>{$row.effective_caller_id_name}</FirstName>
{/if}
<JobTitle></JobTitle>
<Frequent>0</Frequent>
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{if $number.phone_label == "work"}
<Phone type="Work">
<phonenumber>{$number.phone_number}</phonenumber>
<accountindex>0</accountindex>
</Phone>
{/if}
{if $number.phone_label == "home"}
<Phone type="Home">
<phonenumber>{$number.phone_number}</phonenumber>
<accountindex>0</accountindex>
</Phone>
{/if}
{if $number.phone_label == "mobile"}
<Phone type="Cell">
<phonenumber>{$number.phone_number}</phonenumber>
<accountindex>0</accountindex>
</Phone>
{/if}
{/if}
{/foreach}
<Group>2</Group>
<Primary>0</Primary>
<Department></Department>
<Job></Job>
<Company></Company>
</Contact>
{elseif $row.category == "extensions"}
<Contact>
<id>{$start_id++}</id>
{if $row.contact_name_given != ""}
{if $row.contact_organization != ""}
<FirstName>{$row.contact_name_given} {$row.contact_name_family}</FirstName>
<FirstName>{$row.contact_name_given} {$row.contact_name_family}</FirstName>
<Company>{$row.contact_organization}</Company>
{else}
<FirstName>{$row.contact_name_given}</FirstName>
<LastName>{$row.contact_name_family}</LastName>
{/if}
{else}
<FirstName>{$row.effective_caller_id_name}</FirstName>
{/if}
<JobTitle></JobTitle>
<Frequent>0</Frequent>
{if $row.phone_number != ""}
<Phone type="Work">
<phonenumber>{$row.phone_number}</phonenumber>
<accountindex>0</accountindex>
</Phone>
{else}
<Phone type="Work">
<phonenumber>{$row.phone_extension}</phonenumber>
<accountindex>0</accountindex>
</Phone>
{/if}
<Group>3</Group>
<Primary>0</Primary>
<Department></Department>
<Job></Job>
<Company></Company>
</Contact>
{/if}
{/foreach}
</AddressBook> </AddressBook>