Fixes phone display in profile (Closes #1202).
authorStéphane Jacob <sj@m4x.org>
Thu, 22 Jul 2010 12:41:27 +0000 (14:41 +0200)
committerStéphane Jacob <sj@m4x.org>
Thu, 22 Jul 2010 12:41:27 +0000 (14:41 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
plugins/function.display_address.php
templates/profile/profile.tpl

index 00a6fb6..4e51c99 100644 (file)
@@ -101,7 +101,7 @@ function smarty_function_display_address($param, &$smarty)
     if ($adr->phones() != null) {
         require_once 'function.display_phones.php';
         $txthtml .= smarty_function_display_phones(array('tels' => $adr->phones()),$smarty);
-    } else if ($param['phones'] != null) {
+    } else if (isset($param['phones']) && count($param['phones'])) {
         require_once 'function.display_phones.php';
         $txthtml .= smarty_function_display_phones(array('tels' => $param['phones']),$smarty);
     }
index 759bff1..4402224 100644 (file)
@@ -210,13 +210,13 @@ function chgMainWinLoc(strPage)
       {/if}
       {if $address->hasFlag('current')}
       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" actuelle&nbsp;:"
-               for="`$profile->firstname` `$profile->lastname`" pos=$pos}
+               for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
       {elseif $address->hasFlag('secondary')}
       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" secondaire&nbsp;:"
-               for="`$profile->firstname` `$profile->lastname`" pos=$pos}
+               for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
       {else}
       {include file="geoloc/address.tpl" address=$address titre_div=true titre=$address_name|@cat:" principale&nbsp;:"
-               for="`$profile->firstname` `$profile->lastname`" pos=$pos}
+               for="`$profile->firstname` `$profile->lastname`" pos=$pos phones=null}
       {/if}
       {if $smarty.foreach.addresses.iteration is even}<div class="spacer"></div>{/if}
     {/foreach}
@@ -230,11 +230,11 @@ function chgMainWinLoc(strPage)
     {foreach from=$jobs item="job" key="i"}
       {if $i neq 0}<hr />{/if}
       {include file="include/emploi.tpl" job=$job}
-      {assign var=phones value=$job->phones()}
+      {assign var=jobPhones value=$job->phones()}
       {if $job->address()}
-        {include file="geoloc/address.tpl" address=$job->address() titre="Adresse&nbsp;: " for=$job->company->name pos="left" phones=$phones}
-      {elseif $phones}
-        {display_phones tels=$phones}
+        {include file="geoloc/address.tpl" address=$job->address() titre="Adresse&nbsp;: " for=$job->company->name pos="left" phones=$jobPhones}
+      {elseif $jobPhones|@count neq 0}
+        {display_phones tels=$jobPhones}
       {/if}
       <div class="spacer">&nbsp;</div>
     {/foreach}