amelioration du lien paiement / evenements + choix pour la synchro ax dans le profil
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 26 Aug 2005 08:14:23 +0000 (08:14 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 26 Aug 2005 08:14:23 +0000 (08:14 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@28 839d8a87-29fc-0310-9880-83ba4fa771e5

14 files changed:
ChangeLog
htdocs.net/groupe/evenements.php
htdocs.net/groupe/evt-detail.php
htdocs/paiement/index.php
include/money.inc.php
include/profil/assign_general.inc.php
include/profil/get_general.inc.php
include/profil/update_general.inc.php
include/tabs.inc.php
templates/paiement/index.tpl
templates/profil/general.tpl
templates/xnet/groupe/evenements.tpl
templates/xnet/groupe/evt-detail.tpl
templates/xnet/groupe/form_evenement.tpl

index bff3a1c..3cafdcf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,20 +13,22 @@ Bug/Wish :
 
        * Paiments :
                - #336 : Micro -> Tele(payments).                                                                       -MC
-               - Fixed little text mistake in Payments menu                                            -CAT
+               - Fixed little text mistake in Payments menu.                                           -CAT
+               - Direct link from and to events.                                                                       -Car
 
        * Profile :
                - #330,333: Interface improvements.                                                                     -Car
                - #332: User can precise why he asks for a usage name.                          -Car
-               - #335: Already assigned promotion don't generate a request                     -CAT
+               - #335: Already assigned promotion don't generate a request.            -CAT
+               - User can accept/refuse synchronisatio from AX by admin.                       -Car
        
        * Xnet :
                - Various bug fixes in events management.                                                       -Car
                - #334: Interface improvements.                                                                         -Car
        
        * User Interface:
-               - #337: Added link to trackers and support website for admins           -CAT
-               - #338: Broken FSF link fixed on donation page                                          -CAT
+               - #337: Added link to trackers and support website for admins.          -CAT
+               - #338: Broken FSF link fixed on donation page.                                         -CAT
        
 ================================================================================
 VERSION 0.9.8                                                                                                           18 Jul 2005
index f3fd9c0..bcd71ac 100644 (file)
@@ -23,13 +23,17 @@ if ($eid = Env::get('eid')) {
 if (may_update() && Post::get('intitule')) {
        $short_name = Env::get('short_name');
        //Quelques vérifications sur l'alias (caractères spéciaux)
-       if ($short_name && !preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $short_name)) {
+       if ($short_name && !preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $short_name))
+       {
                $page->trig("Le raccourci demandé n'est pas valide.
                            Vérifie qu'il comporte entre 3 et 20 caractères
                            et qu'il ne contient que des lettres non accentuées,
                            des chiffres ou les caractères - et .");
                $short_name = $infos['short_name'];
                $page->assign('get_form', true);
+               $get_form = true;
+               // set the field to the previously requested field
+               $page->assign('evt', $_REQUEST);
        }
        //vérifier que l'alias n'est pas déja pris
        if ($short_name && $short_name != $infos['short_name']) {
@@ -38,6 +42,9 @@ if (may_update() && Post::get('intitule')) {
                        $page->trig("Le raccourci demandé est déjà utilisé. Choisis en un autre.");
                        $short_name = $infos['short_name'];
                        $page->assign('get_form', true);
+                       $get_form = true;
+                       // set the field to the previously requested field
+                       $page->assign('evt', $_REQUEST);
                }
        }
        if ($short_name && $infos['short_name'] && $short_name != $infos['short_name']) {
@@ -78,7 +85,7 @@ if (may_update() && Post::get('intitule')) {
                debut = {?}, fin = {?},
                membres_only = {?}, advertise = {?}, show_participants = {?}, short_name = {?}",
                $eid, $globals->asso('id'), Session::get('uid'), Post::get('intitule'),
-               (Post::get('paiement')>0)?Post::get('paiement'):NULL, Post::get('descriptif'),
+               (Post::get('paiement_id')>0)?Post::get('paiement_id'):NULL, Post::get('descriptif'),
                Post::get('deb_Year')."-".Post::get('deb_Month')."-".Post::get('deb_Day')." ".Post::get('deb_Hour').":".Post::get('deb_Minute').":00",
                Post::get('fin_Year')."-".Post::get('fin_Month')."-".Post::get('fin_Day')." ".Post::get('fin_Hour').":".Post::get('fin_Minute').":00",
                Post::get('membres_only'), Post::get('advertise'), Post::get('show_participants'), $short_name, $eid);
@@ -103,7 +110,7 @@ if (may_update() && Post::get('intitule')) {
        }
 
        // request for a new payment
-       if (Post::get('paiement') == -1 && $money_defaut >= 0) {
+       if (Post::get('paiement_id') == -1 && $money_defaut >= 0) {
                require_once ('validations.inc.php');
                $p = new PayReq(Session::get('uid'), Post::get('intitule')." - ".$globals->asso('nom'), Post::get('site'), $money_defaut, Post::get('confirmation'),0, 999, $globals->asso('id'), $eid);
                $p->submit();
@@ -129,7 +136,7 @@ if (may_update() && Env::has('sup') && $eid) {
        $globals->xdb->execute("DELETE FROM requests WHERE type = 'paiements' AND data  LIKE {?}", PayReq::same_event($eid, $globals->asso('id')));
 }
 
-if (may_update() && (Env::has('add') || (Env::has('mod') && $eid))) {
+if (may_update() && (Env::has('add') || (Env::has('mod') && $eid || $get_form))) {
        $page->assign('get_form', true);
        $res = $globals->xdb->iterator
                ("SELECT id, text FROM {$globals->money->mpay_tprefix}paiements WHERE asso_id = {?}", $globals->asso('id'));
index bf49dbe..eeabdeb 100644 (file)
@@ -47,6 +47,10 @@ if (Env::get('ins')) {
 
 require_once('xnet/evenements.php');
 $evt = get_event_detail(Env::get('eid'));
+
+if (!$evt)
+    header("Location: evenements.php");
+    
 if (Env::has('ins')) {
     subscribe_lists_event($participate, Session::get("uid"), $evt['participant_list'], $evt['absent_list']);
     header("Location: evenements.php?backfrom=".Env::get('eid'));
index 0d1c1cb..5990ae7 100644 (file)
@@ -33,7 +33,7 @@ if($pay->flags->hasflag('old')){
     $page->trig("La transaction selectionnée est périmée.");
     $pay = new Payment();
 }
-$val  = ($op=="submit" && Env::has('montant')) ? Env::get('montant') : $pay->montant_def;
+$val  = (Env::has('montant')) ? Env::get('montant') : $pay->montant_def;
 
 if (($e = $pay->check($val)) !== true) {
     $page->trig($e);
@@ -48,10 +48,12 @@ if ($op=='submit') {
     if ($res->total()) $page->assign('transactions', $res);
 }
 
+$val = floor($val).".".substr(floor(($val - floor($val))*100+100),1);
 $page->assign('montant',$val);
 
 $page->assign('meth', $meth);
 $page->assign('pay',  $pay);
+$page->assign('evtlink', $pay->event());
 
 $page->assign('prefix',$globals->money->mpay_tprefix);
 $page->run();
index 78979ba..196153e 100644 (file)
@@ -33,6 +33,7 @@ class Payment
     var $montant_min;
     var $montant_max;
     var $montant_def;
+    var $asso_id;
 
     var $api = null;
 
@@ -43,14 +44,16 @@ class Payment
     {
         global $globals;
         $r   = $ref==-1 ? $globals->money->mpay_def_id : $ref;
-        $res = $globals->xdb->query("SELECT  id, text, url, flags, mail, montant_min, montant_max, montant_def
+        $res = $globals->xdb->query("SELECT  id, text, url, flags, mail, montant_min, montant_max, montant_def, asso_id
                                        FROM  {$globals->money->mpay_tprefix}paiements WHERE id={?}", $r);
         list($this->id, $this->text, $this->url, $flags, $this->mail,
-                $this->montant_min, $this->montant_max, $this->montant_def) = $res->fetchOneRow();
+                $this->montant_min, $this->montant_max, $this->montant_def, $this->asso_id) = $res->fetchOneRow();
         
         $this->montant_min = (float)$this->montant_min;
         $this->montant_max = (float)$this->montant_max;
         $this->flags       = new Flagset($flags);
+
+        return $link;
     }
 
     // }}}
@@ -84,6 +87,17 @@ class Payment
     {
         return $this->api->prepareform($this);
     }
+
+    function event()
+    {
+        global $globals;
+        if ($this->asso_id)
+        {
+            $res = $globals->xdb->query("SELECT eid, a.diminutif FROM groupex.evenements AS e, groupex.asso AS a WHERE e.asso_id = {?} AND a.id = {?}", $this->asso_id, $this->asso_id);
+            return $res->fetchOneAssoc();
+        }
+        return null;
+    }
 }
 
 // }}}
index 1823b75..ef2d1c7 100644 (file)
@@ -45,4 +45,6 @@ $page->assign('appli_type2',$appli_type2);
 $page->assign('photo_pub',$photo_pub);
 $page->assign('nouvellephoto', $nouvellephoto);
 $page->assign('nickname', $nickname);
+
+$page->assign('synchro_ax', $synchro_ax);
 ?>
index 67ea33f..c6c7e5a 100644 (file)
@@ -22,6 +22,7 @@
 // on ramène les données du profil connecté (uid paramètre de session)
 $sql = "SELECT  u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.promo_sortie, u.nom_usage, u.nationalite,
                q.profile_mobile, q.profile_mobile_pub, q.profile_web, q.profile_web_pub, q.profile_freetext, q.profile_freetext_pub, q.profile_nick,
+                q.profile_from_ax,
                 a1.aid, a1.type, a2.aid, a2.type
           FROM  auth_user_md5   AS u
     INNER JOIN  auth_user_quick AS q  USING(user_id)
@@ -32,6 +33,7 @@ $sql = "SELECT  u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.promo_sorti
 $result = $globals->xdb->query($sql, Session::getInt('uid', -1));
 list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $promo_sortie, $nom_usage, $nationalite,
        $mobile, $mobile_pub, $web, $web_pub, $freetext, $freetext_pub, $nickname, 
+        $synchro_ax,
         $appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow();
 
 $result = $globals->xdb->query("SELECT pub FROM photo WHERE uid = {?}", Session::getInt('uid', -1));
@@ -54,11 +56,12 @@ replace_ifset($appli_type1,"appli_type1");
 replace_ifset($appli_type2,"appli_type2");
 replace_ifset($nickname,"nickname");
 
-if(Env::has('modifier') || Env::has('suivant')) {
+if(Env::has('modifier') || Env::has('suivant') && Env::get('old_tab') == 'general') {
     $mobile_pub = Env::get('mobile_pub');
     $web_pub = Env::has('web_pub')?'public':'private';
     $freetext_pub = Env::has('freetext_pub')?'public':'private';
     $photo_pub = Env::has('photo_pub')?'public':'private';
+    $synchro_ax = Env::has("synchro_ax")?1:0;
 }
 
 require_once("xorg.misc.inc.php");
index ea784a5..8921abc 100644 (file)
@@ -41,12 +41,14 @@ $globals->xdb->execute(
             profile_nick={?},
             profile_mobile={?}, profile_mobile_pub={?},
             profile_web={?}, profile_web_pub={?},
-            profile_freetext={?}, profile_freetext_pub={?}
+            profile_freetext={?}, profile_freetext_pub={?},
+            profile_from_ax = {?}
         WHERE user_id = {?}",
             $nickname,
             $mobile, $mobile_pub,
             $web, $web_pub,
             $freetext, $freetext_pub,
+            $synchro_ax,
             Session::getInt('uid', -1));
 
 if ($nickname != $nickname_anc) {
index 559179f..9bffc5b 100644 (file)
@@ -21,9 +21,9 @@
 
 
 $tabname_array = Array(
-    "general"  => "Informations\ngénérales",
+    "general"  => "Général",
     "adresses" => "Adresses\npersonnelles",
-    "poly"     => "Informations\npolytechniciennes",
+    "poly"     => "Groupes X\nBinets",
     "deco"     => "Décorations\nMédailles",
     "emploi"   => "Informations\nprofessionnelles",
     "skill"    => "Compétences\ndiverses",
index b17a55d..5b1790d 100644 (file)
@@ -75,6 +75,11 @@ recevras une confirmation par email.
 {$pay->api->text}
 </p>
 {/if}
+{if $evtlink}
+<p class="erreur">
+Si tu n'es pas encore inscrit à cet événement, n'oublie pas d'aller t'<a href='http://www.polytechnique.net/{$evtlink.diminutif}/evt-detail.php?eid={$evtlink.eid}'>inscrire</a>.
+</p>
+{/if}
 
 {else}
 
index 8a54ec7..68c45c8 100644 (file)
 </div>
 
 <div class="blocunite">
+  <table class="bicol" cellspacing="0" cellpadding="0" 
+    summary="Profil : Informations générales">
+    <tr>
+      <th>
+        Synchronisation avec l'AX
+      </th>
+    </tr>
+    <tr>
+      <td class"col">
+        Le service annuaire de l'<a href='http://www.polytechniciens.com'>AX</a> met à jour l'annuaire papier à partir des informations que tu lui envoies. Tu peux choisir ici de récupérer directement ces données pour l'annuaire en ligne.
+      </td>
+    </tr>
+    <tr>
+      <td class="col">
+        <table class="flags" cellspacing="0" summary="Flags">
+          <tr>
+            <td class="orange">
+              <input type="checkbox" name="synchro_ax" {if $synchro_ax}checked="checked" {/if}/>
+            </td>
+            <td class="texte">
+              Autoriser la synchronisation depuis l'AX.
+            </td>
+          </tr>
+        </table>
+      </td>
+    </tr>
+  </table>
+</div>
+    
+<div class="blocunite">
   <table class="bicol" cellspacing="0" cellpadding="0"
     summary="Profil: Trombinoscope">
     <tr>
index a2a637a..2d8b228 100644 (file)
@@ -21,7 +21,7 @@
 {**************************************************************************}
 
 <h1>{$asso.nom} :
-{if ($smarty.request.add || $smarty.request.mod) && $admin}
+{if ($smarty.request.add || $smarty.request.mod || $get_form) && $admin}
 <a href='{$smarty.server.PHP_SELF}'>Evénements</a>
 {else}
 Evénements
index 29e4d48..7a195e7 100644 (file)
@@ -89,7 +89,7 @@
   {if $montant > 0 || $paid > 0}
   <p {if $montant > $paid}class="erreur"{/if}>
   Pour cet événement tu dois payer {$montant|replace:'.':','}&nbsp;&euro; {if $paid > 0}, et tu as déjà payé {$paid|replace:'.':','}&nbsp;&euro;{/if}
-  {if $evt.paiement_id} [<a href="https://www.polytechnique.org/paiement/?ref={$evt.paiement_id}">Effectuer le paiement</a>]{/if}
+  {if $evt.paiement_id && $montant > $paid} [<a href="https://www.polytechnique.org/paiement/?ref={$evt.paiement_id}&montant={math equation="x - y" x=$montant y=$paid}">Effectuer le paiement</a>]{/if}
   </p>
   {/if}
   <div class="center">
index f6f2d3a..72eb71d 100644 (file)
   <hr />
   <table>
     <tr>
-      <td>Intitulé de l'événement :</td>
+      <td>Intitulé de l'événement&nbsp;:</td>
       <td>
         <input type="hidden" name="eid" value="{$evt.eid}" />
         <input type="text" name="intitule" value="{$evt.intitule}" size="45" maxlength="100" />
       </td>
     </tr>
     <tr>
-      <td>Evénement en raccourci (pour les mailings listes) :</td>
+      <td>Evénement en raccourci (pour les mailings listes)&nbsp;:</td>
       <td><input type="text" name="short_name" value="{$evt.short_name}" size="20"/></td>
     </tr>
     <tr>
       </td>
     </tr>
     <tr>
-      <td>Référence de paiement :
+      <td>Référence de paiement&nbsp;:
       </td>
       <td>
-        <select name="paiement" onchange="document.getElementById('new_pay').style.display=(value &lt; 0?'block':'none')">
+        <select name="paiement_id" onchange="document.getElementById('new_pay').style.display=(value &lt; 0?'block':'none')">
           {if $evt.paiement_id eq -2}
           <option value='-2'>Paiement en attente de validation</option>
           {/if}