Fixes display names and promo saving.
authorStéphane Jacob <jacou@melix.net>
Sun, 11 Jan 2009 12:58:08 +0000 (13:58 +0100)
committerStéphane Jacob <jacou@melix.net>
Tue, 13 Jan 2009 14:02:02 +0000 (15:02 +0100)
modules/profile/general.inc.php
templates/profile/general.tpl
templates/profile/orange.tpl

index 5ef6455..80037d5 100644 (file)
@@ -239,7 +239,8 @@ class ProfileGeneral extends ProfilePage
     public function __construct(PlWizard &$wiz)
     {
         parent::__construct($wiz);
-        $this->settings['naissance'] = new ProfileDate();
+        $this->settings['naissance'] 
+                                  = new ProfileDate();
         $this->settings['freetext_pub']
                                   = $this->settings['photo_pub']
                                   = new ProfilePub();
@@ -251,8 +252,7 @@ class ProfileGeneral extends ProfilePage
                                   = $this->settings['yourself']
                                   = $this->settings['display_name']
                                   = $this->settings['sort_name']
-                                  = $this->settings['tooltip_name']
-                                  = $this->settings['promo_display']
+                                  = $this->settings['promo']
                                   = $this->settings['search_names']
                                   = null;
         $this->settings['synchro_ax']
@@ -273,7 +273,7 @@ class ProfileGeneral extends ProfilePage
     protected function _fetchData()
     {
         // Checkout all data...
-        $res = XDB::query("SELECT  p.promo AS promo_display, e.entry_year AS entry_year, e.grad_year AS grad_year,
+        $res = XDB::query("SELECT  p.promo, e.entry_year AS entry_year, e.grad_year AS grad_year,
                                    u.nationalite, u.nationalite2, u.nationalite3, u.naissance,
                                    t.display_tel as mobile, t.pub as mobile_pub,
                                    d.email_directory as email_directory,
@@ -337,7 +337,7 @@ class ProfileGeneral extends ProfilePage
             $this->values['search_names'][] = $sn;
         } while ($sn = $sn_all->next());
 
-        // Proposes choice for promo_display
+        // Proposes choice for promotion
         if ($this->values['entry_year'] != $this->values['grad_year'] - 3) {
             for ($i = $this->values['entry_year']; $i < $this->values['grad_year'] - 2; $i++) {
                 $this->values['promo_choice'][] = "X" . $i;
@@ -436,7 +436,8 @@ class ProfileGeneral extends ProfilePage
                 $short_name     = short_name($search_names, $sn_types_public);
                 $sort_name      = short_name($search_names, $sn_types_public);
                 $this->values['public_name']  = build_public_name($search_names, $sn_types_public, $full_name);
-                $this->values['private_name'] = $public_name . build_private_name($search_names, $sn_types_private);
+                $this->values['private_name'] = $this->values['public_name'] .
+                                                build_private_name($search_names, $sn_types_private);
                 XDB::execute("UPDATE  profile_display
                                  SET  yourself = {?}, public_name = {?}, private_name = {?},
                                       directory_name = {?}, short_name = {?}, sort_name = {?}
@@ -455,11 +456,11 @@ class ProfileGeneral extends ProfilePage
                              $this->values['yourself'], S::v('uid'));
             }
         }
-        if ($this->changed['promo_display']) {
+        if ($this->changed['promo']) {
             XDB::execute("UPDATE  profile_display
                              SET  promo = {?}
                            WHERE  pid = {?}",
-                         $this->values['promo_display'], S::v('uid'));
+                         $this->values['promo'], S::v('uid'));
         }
     }
 
index 3cabb1c..dc96e35 100644 (file)
     </td>
     <td>
       {if !$promo_choice}
-        <span class="nom">{$promo_display}</span>
+        <span class="nom">{$promo}</span>
+        <input type="hidden" name="promo" value="{$promo}"/>
       {else}
-        <select name="promo_display">
+        <select name="promo">
         {foreach from=$promo_choice item="promo_to_display"}
-          <option value="{$promo_to_display}" {if $promo_to_display eq $promo_display}selected="selected"{/if}>{$promo_to_display}</option>
+          <option value="{$promo_to_display}" {if $promo_to_display eq $promo}selected="selected"{/if}>{$promo_to_display}</option>
         {/foreach}
         </select>
       {/if}
index 7ce37cc..628ad9a 100644 (file)
@@ -35,7 +35,7 @@
   Afin de pouvoir être considéré{if $sexe}e{/if} à la fois dans ta promotion d'origine et ta
   ou tes promotions d'adoption tu peux entrer ici ton année de sortie de l'école.
   Plus précisément, il s'agit de l'année d'entrée en quatrième année ou année d'application.
-  Pour tes cocons d'origine ({$promo_display}) il s'agit de l'année {math equation="a + b" a=$promo b=3}.
+  Pour tes cocons d'origine ({$promo}) il s'agit de l'année {math equation="a + b" a=$promo b=3}.
 </p>
 
 <br />