Fixes error in alternate sector and adds explanation for sector modification (Closes...
authorStéphane Jacob <sj@m4x.org>
Mon, 7 Jun 2010 15:25:16 +0000 (17:25 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 7 Jun 2010 15:25:16 +0000 (17:25 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/profile.php
templates/profile/jobs.alternates.tpl

index fd61642..077b3dc 100644 (file)
@@ -443,10 +443,13 @@ class ProfileModule extends PLModule
                             ORDER BY  id',
                              $sssect);
         $page->changeTpl('profile/jobs.alternates.tpl', NO_SKIN);
-        $alternate  = $res->next();
-        $alternates = $alternate['name'];
-        while ($alternate  = $res->next()) {
-            $alternates .= ', ' . $alternate['name'];
+        $alternates = '';
+        if ($res->total() > 0) {
+            $alternate  = $res->next();
+            $alternates = $alternate['name'];
+            while ($alternate  = $res->next()) {
+                $alternates .= ', ' . $alternate['name'];
+            }
         }
         $page->assign('alternates', $alternates);
     }
index c0707f1..46e06f8 100644 (file)
 {**************************************************************************}
 
 <?xml version="1.0" encoding="utf-8"?>
-<small>({$alternates})</small>
+{if $alternates}
+  <small>({$alternates})</small>
+{else}
+  <small class="erreur">Il faut renseigner les 3 champs concernant le secteur
+    pour que celui-ci soit pris en compte lors de la validation.</small>
+{/if}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}