From: Stéphane Jacob Date: Tue, 17 May 2011 11:10:09 +0000 (+0200) Subject: User can choose to have her name displayed for donations. X-Git-Tag: xorg/1.1.2~80 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=fbb196fa48be340d43f25fbab1752724e9e0802c;p=platal.git User can choose to have her name displayed for donations. Signed-off-by: Stéphane Jacob --- diff --git a/modules/payment.php b/modules/payment.php index 59f4574..4926187 100644 --- a/modules/payment.php +++ b/modules/payment.php @@ -182,6 +182,7 @@ class PaymentModule extends PLModule $page->assign('pay', $pay); $page->assign('evtlink', $pay->event()); $page->assign('sex', S::user()->isFemale()); + $page->assign('donation', $pay->flags->hasflag('donation')); } function handler_cyber2_return($page, $uid = null) @@ -233,9 +234,9 @@ class PaymentModule extends PLModule } /* on fait l'insertion en base de donnees */ - XDB::execute('INSERT INTO payment_transactions (id, uid, ref, fullref, amount, pkey, comment) - VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})', - Env::v('vads_trans_date'), $user->id(), $ref, Env::v('vads_order_id'), $montant, '', Env::v('vads_order_info')); + XDB::execute('INSERT INTO payment_transactions (id, uid, ref, fullref, amount, pkey, comment, display) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', + Env::v('vads_trans_date'), $user->id(), $ref, Env::v('vads_order_id'), $montant, '', Env::v('vads_order_info'), Env::i('vads_order_info2')); echo "Paiement stored.\n"; // We check if it is an Xnet payment and then update the related ML. @@ -331,9 +332,9 @@ class PaymentModule extends PLModule } /* on fait l'insertion en base de donnees */ - XDB::execute("INSERT INTO payment_transactions (id, uid, ref, fullref, amount, pkey, comment) - VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})", - $no_transaction, $user->id(), $ref, $fullref, $montant, $clef, Env::v('comment')); + XDB::execute("INSERT INTO payment_transactions (id, uid, ref, fullref, amount, pkey, comment, display) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, '?})", + $no_transaction, $user->id(), $ref, $fullref, $montant, $clef, Env::v('comment'), Get::i('display')); // We check if it is an Xnet payment and then update the related ML. $res = XDB::query('SELECT eid diff --git a/modules/payment/money/bplccyberplus.inc.php b/modules/payment/money/bplccyberplus.inc.php index 28f69aa..f0b40e4 100644 --- a/modules/payment/money/bplccyberplus.inc.php +++ b/modules/payment/money/bplccyberplus.inc.php @@ -89,7 +89,8 @@ class BPLCCyberPlus 'vads_trans_date' => $trans_date, 'vads_trans_id' => $trans_id, 'vads_order_id' => $fullref, - 'vads_order_info' => substr(self::replaceNonAlpha(replace_accent(Env::v('comment'))), 0, 255)); + 'vads_order_info' => substr(self::replaceNonAlpha(replace_accent(Env::v('comment'))), 0, 255), + 'vads_order_info2' => Post::i('display')); $this->infos['divers'] = Array( 'vads_version' => 'V2', 'vads_ctx_mode' => $globals->money->cyperplus_prod, diff --git a/modules/payment/money/paypal.inc.php b/modules/payment/money/paypal.inc.php index ab1ed47..23c8cfc 100644 --- a/modules/payment/money/paypal.inc.php +++ b/modules/payment/money/paypal.inc.php @@ -47,7 +47,7 @@ class PayPal $roboturl = str_replace("https://","http://",$globals->baseurl) . '/' . $platal->ns . "payment/paypal_return/" . S::v('uid') - . "?comment=" . urlencode(Env::v('comment')); + . "?comment=" . urlencode(Env::v('comment')) . '?display=' . Post::i('display'); $this->infos = array( 'commercant' => array( diff --git a/templates/payment/index.tpl b/templates/payment/index.tpl index dc40971..18b55b9 100644 --- a/templates/payment/index.tpl +++ b/templates/payment/index.tpl @@ -140,9 +140,20 @@ function payment_submit(form) Commentaire + {if t($donation)} + + Afficher ton nom dans la liste des donateurs sur {#globals.core.sitename#} + + +  -  + + + + {/if}   + {if !t($donation)}{/if} diff --git a/upgrade/1.1.2/02_payments.sql b/upgrade/1.1.2/02_payments.sql index 2362194..64359f7 100644 --- a/upgrade/1.1.2/02_payments.sql +++ b/upgrade/1.1.2/02_payments.sql @@ -1,3 +1,4 @@ ALTER TABLE payments MODIFY COLUMN flags SET('unique', 'old', 'donation') NOT NULL DEFAULT ''; +ALTER TABLE payment_transactions ADD COLUMN display BOOL NOT NULL DEFAULT FALSE; -- vim:set syntax=mysql: