Allows empty grad years (Closes #1155).
authorStéphane Jacob <sj@m4x.org>
Fri, 25 Jun 2010 22:46:35 +0000 (00:46 +0200)
committerStéphane Jacob <sj@m4x.org>
Fri, 25 Jun 2010 22:46:35 +0000 (00:46 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/profile/general.inc.php
templates/profile/general.edu.tpl

index 13106c1..c0dcfa8 100644 (file)
@@ -237,8 +237,8 @@ class ProfileSettingEdu implements ProfileSetting
     }
 
     static function sortByGradYear($line1, $line2) {
-        $a = (int) $line1['grad_year'];
-        $b = (int) $line2['grad_year'];
+        $a = (isset($line1['grad_year'])) ? (int) $line1['grad_year'] : 0;
+        $b = (isset($line2['grad_year'])) ? (int) $line2['grad_year'] : 0;
         if ($a == $b) {
             return 0;
         }
@@ -259,9 +259,8 @@ class ProfileSettingEdu implements ProfileSetting
             $i = 0;
             foreach ($value as $key=>&$edu) {
                 if (($edu['grad_year'] < 1921) || ($edu['grad_year'] > (date('Y') + 4))) {
-                    Platal::page()->trigError('L\'année d\'obtention du diplôme est mal renseignée, elle doit être du type : 2004.');
-                    $edu['error'] = true;
-                    $success = false;
+                    Platal::page()->trigWarning('L\'année d\'obtention du diplôme est mal ou non renseignée, elle doit être du type : 2004.');
+                    $edu['warning'] = true;
                 }
                 if ($key != $i) {
                     $value[$i] = $edu;
index 8a3c4c5..51ff4c7 100644 (file)
@@ -59,7 +59,7 @@
     <span class="titre">Année d'obtention du diplôme&nbsp;:</span>
   </td>
   <td>
-    <input type="text" {if $edu.error}class="error"{/if} name="{$eduname}[grad_year]"
+    <input type="text" {if $edu.warning}class="warning"{/if} name="{$eduname}[grad_year]"
     value="{$edu.grad_year}" size="4" maxlength="4" />
     <small>(par exemple&nbsp;: 2008)</small>
   </td>