Fixes changes in graduation year.
authorStéphane Jacob <jacou@melix.net>
Sat, 11 Apr 2009 16:28:11 +0000 (18:28 +0200)
committerStéphane Jacob <jacou@melix.net>
Sat, 11 Apr 2009 16:29:41 +0000 (18:29 +0200)
include/validations/orange.inc.php
templates/include/form.valid.orange.tpl

index ae5f3ee..1d2acda 100644 (file)
@@ -27,7 +27,9 @@ class OrangeReq extends Validate
 
     public $unique = true;
 
-    public $promo_sortie;
+    public $oldGradYear;
+    public $newGradYear;
+    public $entryYear;
 
     public $rules = "À priori accepter (la validation sert à repousser les
     petits malins). Refuse si tu connais la personne et que tu es sûr
@@ -36,14 +38,15 @@ class OrangeReq extends Validate
     // }}}
     // {{{ constructor
 
-    public function __construct(User &$_user, $_sortie)
+    public function __construct(User &$_user, $_newGradYear)
     {
         parent::__construct($_user, true, 'orange');
-        $this->promo_sortie  = $_sortie;
+        $this->newGradYear  = $_newGradYear;
         $res = XDB::query("SELECT  entry_year
                              FROM  profile_education
-                            WHERE  uid = {?} AND FIND_IN_SET('primary', flags)", $_uid);
-        $this->promo = $res->fetchOneCell();
+                            WHERE  uid = {?} AND FIND_IN_SET('primary', flags)", $this->user->id());
+        $this->entryYear   = $res->fetchOneCell();
+        $this->oldGradYear = $this->entryYear + 3;
     }
 
     // }}}
@@ -83,7 +86,7 @@ class OrangeReq extends Validate
     {
         XDB::execute("UPDATE  profile_education
                          SET  grad_year = {?}
-                       WHERE  uid = {?} AND FIND_IN_SET('primary', flags)", $this->promo_sortie, $this->uid);
+                       WHERE  uid = {?} AND FIND_IN_SET('primary', flags)", $this->newGradYear, $this->user->id());
         return true;
     }
 
index d4c4741..6b8a357 100644 (file)
 
 <tr class="impair">
   <td class="titre">Promotion&nbsp;:</td>
-  <td>{$valid->user->promo()}</td>
+  <td>{$valid->entryYear}</td>
 </tr>
 <tr class="impair">
   <td class="titre">Année de sortie&nbsp;:</td>
-  <td>{$valid->promo_sortie} au lieu de {math equation="a + b" a=$valid->user->promo() b=3}</td>
+  <td>{$valid->newGradYear} au lieu de {$valid->oldGradYear}</td>
 </tr>
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}