en partie #155 : ajoute un commentaire pour les paiements
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 18 Nov 2006 23:36:53 +0000 (23:36 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 18 Nov 2006 23:36:53 +0000 (23:36 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1106 839d8a87-29fc-0310-9880-83ba4fa771e5

ChangeLog
modules/payment.php
modules/payment/money/cyberpaiement.inc.php
modules/payment/money/paypal.inc.php
templates/payment/index.tpl
upgrade/0.9.12/04_paiement.sql [new file with mode: 0644]

index cb0a04d..6e14b7b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,9 @@ Bug/Wish:
         - #520: Can moderate several mails at once                         -FRU
         - #532: Fix case sensitivity issues in emails processing.          -FRU
 
+    * Payment:
+        - #155: Add a free comment for payments.                           -Car
+
     * Profile:
         - #385: Add section, binets and groupes-X in vCard.                -FRU
         - #451: vCard are RFC compliant.                                   -FRU
index ff5c432..8ce2dbc 100644 (file)
@@ -123,6 +123,7 @@ class PaymentModule extends PLModule
 
         $val = floor($val).".".substr(floor(($val - floor($val))*100+100),1);
         $page->assign('montant',$val);
+        $page->assign('comment',Env::v('comment'));
 
         $page->assign('meth', $meth);
         $page->assign('pay',  $pay);
@@ -188,9 +189,9 @@ class PaymentModule extends PLModule
         }
 
         /* on fait l'insertion en base de donnees */
-        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle)
-                                     VALUES  ({?},{?},{?},{?},{?},{?})",
-                                $champ901, $uid, $ref, $champ200, $montant, $champ905);
+        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle,comment)
+                                     VALUES  ({?},{?},{?},{?},{?},{?},{?})",
+                                $champ901, $uid, $ref, $champ200, $montant, $champ905,Env::v('comment'));
 
         /* on genere le mail de confirmation */
         $conf_text = str_replace("<prenom>",$prenom,$conf_text);
@@ -277,9 +278,9 @@ class PaymentModule extends PLModule
         }
 
         /* on fait l'insertion en base de donnees */
-        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle)
-                                     VALUES  ({?},{?},{?},{?},{?},{?})",
-                                $no_transaction, $uid, $ref, $fullref, $montant, $clef);
+        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle,comment)
+                                     VALUES  ({?},{?},{?},{?},{?},{?},{?})",
+                                $no_transaction, $uid, $ref, $fullref, $montant, $clef, Env::v('comment'));
 
         /* on genere le mail de confirmation */
         $conf_text = str_replace("<prenom>",$prenom,$conf_text);
index 0030fc5..9a35d41 100644 (file)
@@ -48,7 +48,7 @@ class CyberPayment
         global $globals;
 
         $roboturl = str_replace("https://","http://",$globals->baseurl)
-            ."/payment/cyber_return/".S::v('uid')."?CHAMPBPX";
+            ."/payment/cyber_return/".S::v('uid')."?comment=".urlencode(Env::v('comment'))."&CHAMPBPX";
         if (Cookie::has(session_name())) {
             $returnurl .= "?".SID;
         }
index 910c016..edc5924 100644 (file)
@@ -56,7 +56,7 @@ class PayPal
        $name = $req->fetchOneCell();
 
         $roboturl = str_replace("https://","http://",$globals->baseurl)
-            ."/payment/paypal_return/".S::v('uid');
+            ."/payment/paypal_return/".S::v('uid')."?comment=".urlencode(Env::v('comment'));
 
        $this->infos = Array();
        
@@ -78,9 +78,9 @@ class PayPal
                        a.city, a.postcode AS zip, a.country,
                        IF(t.tel, t.tel, q.profile_mobile) AS night_phone_b
                   FROM auth_user_quick AS q
-             LEFT JOIN adresses        AS a ON (q.user_id = a.uid)
+             LEFT JOIN adresses        AS a ON (q.user_id = a.uid AND FIND_IN_SET('active', a.statut))
              LEFT JOIN tels        AS t ON (t.uid = a.uid AND t.adrid = a.adrid)
-                 WHERE q.user_id = {?} AND FIND_IN_SET('active', a.statut)
+                 WHERE q.user_id = {?}
                  LIMIT 1", S::v('uid'));
        $this->infos['client']=array_merge($info_client, $res->fetchOneAssoc());
 
index 0fccf8c..a2726b3 100644 (file)
     <td><b>Montant (euros)</b></td>
     <td>{$montant}</td>
   </tr>
+{if $comment}
+  <tr>
+    <td><b>Commentaire</b>
+    <td>{$comment}</td>
+  </tr>
+{/if}
   <tr>
     <td>&nbsp;</td>
     <td>
@@ -98,7 +104,7 @@ function payment_submit(form)
 <form method="post" action="{$platal->pl_self()}">
   <p> Si tu ne souhaites pas utiliser notre interface de
   télépaiement, tu peux virer directement la somme de ton choix sur notre compte
-  30004 00314 00010016782 60. Nous veillerons à ce que ton paiement parvienne à
+  <strong>30004 00314 00010016782 60</strong>. Nous veillerons à ce que ton paiement parvienne à
   son destinataire.  Pense toutefois à le préciser dans le motif du
   versement.
   <br /><br />
@@ -132,6 +138,10 @@ function payment_submit(form)
       <td><input type="text" name="montant" size="13" class='right' value="{$montant}" /></td>
     </tr>
     <tr>
+      <td>Commentaire</td>
+      <td><textarea name="comment" rows="5" cols="30"></textarea></td>
+    </tr>
+    <tr>
       <td>&nbsp;</td>
       <td>
         <input type="hidden" name="op" value="submit" />
diff --git a/upgrade/0.9.12/04_paiement.sql b/upgrade/0.9.12/04_paiement.sql
new file mode 100644 (file)
index 0000000..ffcd486
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE paiement.transactions ADD `comment` VARCHAR(255) NOT NULL DEFAULT '';\r