Fix payment comment decoder
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 10 Oct 2007 20:02:12 +0000 (22:02 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 10 Oct 2007 20:17:36 +0000 (22:17 +0200)
modules/payment.php
templates/payment/xnet.tpl

index d71b26d..ca19fb2 100644 (file)
@@ -71,6 +71,16 @@ function cle_accept($d1,$d2,$d3,$d4,$d5)
     return $alpha{$n-1}.$m1.$m2.$m3.$m4;
 }
 
+/* decode the comment */
+function comment_decode($comment) {
+    $comment = urldecode($comment);
+    if (is_utf8($comment)) {
+        return $comment;
+    } else {
+        return utf8_encode($comment);
+    }
+}
+
 
 class PaymentModule extends PLModule
 {
@@ -448,6 +458,7 @@ class PaymentModule extends PLModule
                 $event[$pid]['paid'] += trim($p);
             }
         }
+        $page->register_modifier('decode_comment', 'decode_comment');
         $page->assign('trans', $trans);
         $page->assign('event', $event);
     }
index 74ad3f5..076c1fa 100644 (file)
@@ -122,7 +122,7 @@ Voici la liste des paiements en ligne possible pour le groupe {$asso.nom}
       <a href="mailto:{$p.alias}@{#globals.mail.domain#}">{icon name=email title="mail"}</a>
     </td>
     <td class="center">{$p.promo}</td>
-    <td>{$p.comment|urldecode}</td>
+    <td>{$p.comment|comment_decode}</td>
     <td class="right">{$p.montant}</td>
   </tr>
   {elseif $smarty.foreach.people.first}