Uses updated phonebook code

This commit is contained in:
Len 2020-09-28 14:20:33 -04:00 committed by GitHub
parent e591ab9ce2
commit 0745457145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 149 additions and 47 deletions

View File

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