diff --git a/resources/templates/provision/yealink/t19p/directory.xml b/resources/templates/provision/yealink/t19p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t19p/directory.xml
+++ b/resources/templates/provision/yealink/t19p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t20p/directory.xml b/resources/templates/provision/yealink/t20p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t20p/directory.xml
+++ b/resources/templates/provision/yealink/t20p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t21p/directory.xml b/resources/templates/provision/yealink/t21p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t21p/directory.xml
+++ b/resources/templates/provision/yealink/t21p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t22p/directory.xml b/resources/templates/provision/yealink/t22p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t22p/directory.xml
+++ b/resources/templates/provision/yealink/t22p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t23g/directory.xml b/resources/templates/provision/yealink/t23g/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t23g/directory.xml
+++ b/resources/templates/provision/yealink/t23g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t23p/directory.xml b/resources/templates/provision/yealink/t23p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t23p/directory.xml
+++ b/resources/templates/provision/yealink/t23p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t26p/directory.xml b/resources/templates/provision/yealink/t26p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t26p/directory.xml
+++ b/resources/templates/provision/yealink/t26p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t27g/directory.xml b/resources/templates/provision/yealink/t27g/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t27g/directory.xml
+++ b/resources/templates/provision/yealink/t27g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t27p/directory.xml b/resources/templates/provision/yealink/t27p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t27p/directory.xml
+++ b/resources/templates/provision/yealink/t27p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t28p/directory.xml b/resources/templates/provision/yealink/t28p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t28p/directory.xml
+++ b/resources/templates/provision/yealink/t28p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t29g/directory.xml b/resources/templates/provision/yealink/t29g/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t29g/directory.xml
+++ b/resources/templates/provision/yealink/t29g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t2x/directory.xml b/resources/templates/provision/yealink/t2x/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t2x/directory.xml
+++ b/resources/templates/provision/yealink/t2x/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t31g/directory.xml b/resources/templates/provision/yealink/t31g/directory.xml
index 8dd8e49035..7c447455ef 100644
--- a/resources/templates/provision/yealink/t31g/directory.xml
+++ b/resources/templates/provision/yealink/t31g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
@@ -81,4 +83,3 @@
{/if}
{/foreach}
-
diff --git a/resources/templates/provision/yealink/t32g/directory.xml b/resources/templates/provision/yealink/t32g/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t32g/directory.xml
+++ b/resources/templates/provision/yealink/t32g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t33g/directory.xml b/resources/templates/provision/yealink/t33g/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t33g/directory.xml
+++ b/resources/templates/provision/yealink/t33g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t38g/directory.xml b/resources/templates/provision/yealink/t38g/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t38g/directory.xml
+++ b/resources/templates/provision/yealink/t38g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t40g/directory.xml b/resources/templates/provision/yealink/t40g/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t40g/directory.xml
+++ b/resources/templates/provision/yealink/t40g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t40p/directory.xml b/resources/templates/provision/yealink/t40p/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t40p/directory.xml
+++ b/resources/templates/provision/yealink/t40p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t41p/directory.xml b/resources/templates/provision/yealink/t41p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t41p/directory.xml
+++ b/resources/templates/provision/yealink/t41p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t41s/directory.xml b/resources/templates/provision/yealink/t41s/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t41s/directory.xml
+++ b/resources/templates/provision/yealink/t41s/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t42g/directory.xml b/resources/templates/provision/yealink/t42g/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t42g/directory.xml
+++ b/resources/templates/provision/yealink/t42g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t43u/directory.xml b/resources/templates/provision/yealink/t43u/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t43u/directory.xml
+++ b/resources/templates/provision/yealink/t43u/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t46g/directory.xml b/resources/templates/provision/yealink/t46g/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t46g/directory.xml
+++ b/resources/templates/provision/yealink/t46g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t46s/directory.xml b/resources/templates/provision/yealink/t46s/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t46s/directory.xml
+++ b/resources/templates/provision/yealink/t46s/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t46u/directory.xml b/resources/templates/provision/yealink/t46u/directory.xml
new file mode 100644
index 0000000000..7c447455ef
--- /dev/null
+++ b/resources/templates/provision/yealink/t46u/directory.xml
@@ -0,0 +1,85 @@
+
+{foreach $contacts as $row}
+{if $smarty.get.contacts == "users" && $row.category == "users"}
+
+{if $row.contact_name_given != ""}
+{if $row.contact_organization != ""}
+ {$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{else}
+ {$row.contact_name_given} {$row.contact_name_family}
+{/if}
+{else}
+{$row.effective_caller_id_name}
+{/if}
+{foreach $row.numbers as $number}
+{if $number.phone_number != ""}
+ {$number.phone_number}
+{else}
+ {$number.phone_extension}
+{/if}
+{/foreach}
+
+{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
+
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
+ {$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
+{else}
+ {$row.contact_name_given} {$row.contact_name_family}
+{/if}
+{else}
+ {$row.effective_caller_id_name}
+{/if}
+{foreach $row.numbers as $number}
+{if $number.phone_number != ""}
+ {$number.phone_number}
+{else}
+ {$number.phone_extension}
+{/if}
+{/foreach}
+
+{elseif $smarty.get.contacts == "extensions" && $row.category == "extensions"}
+
+{if $row.contact_name_given != ""}
+ {$row.contact_name_given} {$row.contact_name_family}
+{else}
+ {$row.effective_caller_id_name}
+{/if}
+{if $row.phone_number != ""}
+ {$row.phone_number}
+{else}
+ {$row.phone_extension}
+{/if}
+
+{elseif $smarty.get.contacts == "all"}
+
+{if $row.contact_name_given != ""}
+{if $row.contact_organization != ""}
+ {$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{else}
+ {$row.contact_name_given} {$row.contact_name_family}
+{/if}
+{else}
+ {$row.effective_caller_id_name}
+{/if}
+{if $row.category == "extensions"}
+{if $row.phone_number != ""}
+ {$row.phone_number}
+{else}
+ {$row.phone_extension}
+{/if}
+{else}
+{foreach $row.numbers as $number}
+{if $number.phone_number != ""}
+ {$number.phone_number}
+{else}
+ {$number.phone_extension}
+{/if}
+{/foreach}
+{/if}
+
+{/if}
+{/foreach}
+
diff --git a/resources/templates/provision/yealink/t48g/directory.xml b/resources/templates/provision/yealink/t48g/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t48g/directory.xml
+++ b/resources/templates/provision/yealink/t48g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t48s/directory.xml b/resources/templates/provision/yealink/t48s/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t48s/directory.xml
+++ b/resources/templates/provision/yealink/t48s/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t49g/directory.xml b/resources/templates/provision/yealink/t49g/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t49g/directory.xml
+++ b/resources/templates/provision/yealink/t49g/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t4x/directory.xml b/resources/templates/provision/yealink/t4x/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t4x/directory.xml
+++ b/resources/templates/provision/yealink/t4x/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t52s/directory.xml b/resources/templates/provision/yealink/t52s/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t52s/directory.xml
+++ b/resources/templates/provision/yealink/t52s/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t53/directory.xml b/resources/templates/provision/yealink/t53/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t53/directory.xml
+++ b/resources/templates/provision/yealink/t53/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t53w/directory.xml b/resources/templates/provision/yealink/t53w/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t53w/directory.xml
+++ b/resources/templates/provision/yealink/t53w/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t54s/directory.xml b/resources/templates/provision/yealink/t54s/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t54s/directory.xml
+++ b/resources/templates/provision/yealink/t54s/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t54w/directory.xml b/resources/templates/provision/yealink/t54w/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t54w/directory.xml
+++ b/resources/templates/provision/yealink/t54w/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t56a/directory.xml b/resources/templates/provision/yealink/t56a/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t56a/directory.xml
+++ b/resources/templates/provision/yealink/t56a/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t57w/directory.xml b/resources/templates/provision/yealink/t57w/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t57w/directory.xml
+++ b/resources/templates/provision/yealink/t57w/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t58a/directory.xml b/resources/templates/provision/yealink/t58a/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/t58a/directory.xml
+++ b/resources/templates/provision/yealink/t58a/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/t5x/directory.xml b/resources/templates/provision/yealink/t5x/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/t5x/directory.xml
+++ b/resources/templates/provision/yealink/t5x/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/vp530/directory.xml b/resources/templates/provision/yealink/vp530/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/vp530/directory.xml
+++ b/resources/templates/provision/yealink/vp530/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/vp59/directory.xml b/resources/templates/provision/yealink/vp59/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/vp59/directory.xml
+++ b/resources/templates/provision/yealink/vp59/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/w52p/directory.xml b/resources/templates/provision/yealink/w52p/directory.xml
index 3e319dfb50..cf26bdc8bb 100644
--- a/resources/templates/provision/yealink/w52p/directory.xml
+++ b/resources/templates/provision/yealink/w52p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/w56p/directory.xml b/resources/templates/provision/yealink/w56p/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/w56p/directory.xml
+++ b/resources/templates/provision/yealink/w56p/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/w60b/directory.xml b/resources/templates/provision/yealink/w60b/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/w60b/directory.xml
+++ b/resources/templates/provision/yealink/w60b/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}
diff --git a/resources/templates/provision/yealink/w7xp/directory.xml b/resources/templates/provision/yealink/w7xp/directory.xml
index 297b9e4108..7c447455ef 100644
--- a/resources/templates/provision/yealink/w7xp/directory.xml
+++ b/resources/templates/provision/yealink/w7xp/directory.xml
@@ -14,16 +14,18 @@
{foreach $row.numbers as $number}
{if $number.phone_number != ""}
{$number.phone_number}
-{else}
+{else}
{$number.phone_extension}
{/if}
{/foreach}
{elseif $smarty.get.contacts == "groups" && $row.category == "groups"}
-{if $row.contact_name_given != ""}
-{if $row.contact_organization != ""}
+{if $row.contact_organization != "" || $row.contact_name_given == "" || $row.contact_name_family == ""}
+{if $row.contact_organization != "" && $row.contact_name_given != "" && $row.contact_name_family != ""}
{$row.contact_organization} {$row.contact_name_given} {$row.contact_name_family}
+{elseif $row.contact_organization != "" && $row.contact_name_given == ""}
+ {$row.contact_organization}
{else}
{$row.contact_name_given} {$row.contact_name_family}
{/if}