Better fix for [1276]
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 16 Dec 2006 09:51:32 +0000 (09:51 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 16 Dec 2006 09:51:32 +0000 (09:51 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1280 839d8a87-29fc-0310-9880-83ba4fa771e5

modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php
templates/xnetevents/index.tpl

index 75b1bfe..bee8a2e 100644 (file)
@@ -347,14 +347,16 @@ class XnetEventsModule extends PLModule
         new_groupadmin_page('xnetevents/edit.tpl');
 
         $moments    = range(1, 4);
-        $short_name = '';
+        $error      = false;
         $page->assign('moments', $moments);
 
         if (Post::v('intitule')) {
             require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
             $short_name = event_change_shortname($page, $infos['short_name'],
                                                  Env::v('short_name', ''));
-
+            if ($short_name != Env::v('short_name')) {
+                $error = true;
+            }
             $evt = array(
                 'eid'              => $eid,
                 'asso_id'          => $globals->asso('id'),
@@ -365,7 +367,7 @@ class XnetEventsModule extends PLModule
                 'fin'              => Post::v('fin_Year').'-'.Post::v('fin_Month')
                                       .'-'.Post::v('fin_Day').' '.Post::v('fin_Hour')
                                       .':'.Post::v('fin_Minute').':00',
-                'short_name'       => is_null($short_name) ? '' : $short_name,
+                'short_name'       => $short_name,
             );
 
             $trivial = array('intitule', 'descriptif', 'noinvite',
@@ -422,7 +424,6 @@ class XnetEventsModule extends PLModule
                                             WHERE eid = {?} AND item_id = {?}", $eid, $i);
                 }
             }
-
             // request for a new payment
             if (Post::v('paiement_id') == -1 && $money_defaut >= 0) {
                 require_once 'validations.inc.php';
@@ -440,7 +441,7 @@ class XnetEventsModule extends PLModule
                                         VALUES ({?}, {?}, '', '', 0)", $eid, 1);
             }
 
-            if (!is_null($short_name)) {
+            if (!$error) {
                 pl_redirect('events');
             }
         }
@@ -470,7 +471,7 @@ class XnetEventsModule extends PLModule
                                PayReq::same_event($eid, $globals->asso('id')));
             $stamp = $res->fetchOneCell();
             if ($stamp) {
-                $evt['paiement_id'] = -2;
+                $evt['paiement_id']  = -2;
                 $evt['paiement_req'] = $stamp;
             }
             $page->assign('evt', $evt);
index ed5794c..455641f 100644 (file)
@@ -233,6 +233,9 @@ function event_change_shortname(&$page, $old, $new)
 {
     global $globals;
 
+    if (is_null($old)) {
+        $old = '';
+    }
     // Quelques vérifications sur l'alias (caractères spéciaux)
     if ($new && !preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $new)) {
         $page->trig("Le raccourci demandé n'est pas valide.
index aed7bd2..ed5a33f 100644 (file)
         Tu dois encore payer {math equation="a-b" a=$e.topay b=$e.paid|replace:'.':','}&nbsp;&euro;
         (tu as déjà payé {$e.paid|replace:'.':','}&nbsp;&euro;)
         {else}
-        Tu as déjà payé {$e.paid|replace:'.':','}&nbsp;&euro; pour ton inscription.
+        Tu as déjà payé les {$e.paid|replace:'.':','}&nbsp;&euro; de ton inscription.
         {/if}
         {if $e.paiement_id &&  $e.paid < $e.topay}
         [<a href="{$platal->ns}payment/{$e.paiement_id}?montant={math equation="a-b" a=$e.topay b=$e.paid}">