Merge commit 'origin/fusionax' into account
[platal.git] / modules / payment.php
index 13c853c..48c9144 100644 (file)
@@ -217,6 +217,16 @@ class PaymentModule extends PLModule
                            VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
                      $champ901, $user->id(), $ref, $champ200, $montant, $champ905, Env::v('comment'));
 
+        // We check if it is an Xnet payment and then update the related ML.
+        $res = XDB::query('SELECT  eid
+                             FROM  groupex.evenements
+                            WHERE  paiement_id = {?}', $ref);
+        if ($eid = $res->fetchOneCell()) {
+            $this->load('xnetevents.inc.php');
+            $evt = get_event_detail($eid);
+            subscribe_lists_event(0, $uid, $evt, $montant, true);
+        }
+
         /* on genere le mail de confirmation */
         $conf_text = str_replace(
             array('<prenom>', '<nom>', '<promo>', '<montant>', '<salutation>', '<cher>', 'comment>'),
@@ -301,6 +311,16 @@ class PaymentModule extends PLModule
                            VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
                     $no_transaction, $user->id(), $ref, $fullref, $montant, $clef, Env::v('comment'));
 
+        // We check if it is an Xnet payment and then update the related ML.
+        $res = XDB::query('SELECT  eid
+                             FROM  groupex.evenements
+                            WHERE  paiement_id = {?}', $ref);
+        if ($eid = $res->fetchOneCell()) {
+            $this->load('xnetevents.inc.php');
+            $evt = get_event_detail($eid);
+            subscribe_lists_event(0, $uid, $evt, $montant, true);
+        }
+
         /* on genere le mail de confirmation */
         $conf_text = str_replace(array('<prenom>', '<nom>', '<promo>', '<montant>', '<salutation>', '<cher>'),
                                  array($user->firstName(), $user->lastName(), $user->promo(), $montant,