Fixes display of new promotion in profile edition.
authorStéphane Jacob <sj@m4x.org>
Fri, 17 Jun 2011 20:07:27 +0000 (22:07 +0200)
committerStéphane Jacob <sj@m4x.org>
Fri, 17 Jun 2011 20:07:27 +0000 (22:07 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/profile/general.inc.php

index 6eef643..12731d2 100644 (file)
@@ -507,7 +507,13 @@ class ProfileSettingPromo implements ProfileSetting
                 }
                 Platal::page()->assign('promo_choice', $promoChoice);
             }
-            return $yearpromo;
+
+            // If this profile belongs to an X, return grad year minus education duration.
+            if ($page->profile->mainEducation() == 'X') {
+                return $gradYear - $page->profile->mainEducationDuration();
+            }
+
+            return $gradYear;
         }
 
         // If this profile belongs to an X, $promoNew needs to be changed to