https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102020
Revision: 102020
Author: awjrichards
Date: 2011-11-04 18:13:43 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
MFT r102011, r102012
Modified Paths:
--------------
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
Property Changed:
----------------
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/
Property changes on:
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface
___________________________________________________________________
Modified: svn:mergeinfo
-
/branches/fundraising/deployment/payments_1.17/extensions/DonationInterface:99568
/trunk/extensions/DonationInterface:75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,92825,96120-96121,96125,97945-99042,99045-99408,99503,99555,99568,99570-101026,101056,101071-101072,101074,101099,101109,101112,101163,101180,101192,101200,101205,101207,101217,101230,101232,101236,101382,101399,101441,101501-101504,101512,101541,101547,101549,101554-101555,101559,101563,101576,101578-101579,101631,101633,101638,101669,101676,101679,101689,101700,101706,101719,101740,101747,101757,101764,101778-101779,101781,101786-101789,101798,101846,101852,101878,101917,101929,101962,101996,102003
+
/branches/fundraising/deployment/payments_1.17/extensions/DonationInterface:99568
/trunk/extensions/DonationInterface:75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,92825,96120-96121,96125,97945-99042,99045-99408,99503,99555,99568,99570-101026,101056,101071-101072,101074,101099,101109,101112,101163,101180,101192,101200,101205,101207,101217,101230,101232,101236,101382,101399,101441,101501-101504,101512,101541,101547,101549,101554-101555,101559,101563,101576,101578-101579,101631,101633,101638,101669,101676,101679,101689,101700,101706,101719,101740,101747,101757,101764,101778-101779,101781,101786-101789,101798,101846,101852,101878,101917,101929,101962,101996,102003,102011-102012
Modified:
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
===================================================================
---
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
2011-11-04 18:08:51 UTC (rev 102019)
+++
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
2011-11-04 18:13:43 UTC (rev 102020)
@@ -244,6 +244,29 @@
unset( $this->normalized[$key] );
}
}
+
+ /**
+ * Returns an array of all the fields that get re-calculated during a
+ * normalizeAndSanitize.
+ * This will most likely be used on the outside when in the process of
+ * adding data.
+ * @return array An array of values matching all recauculated fields.
+ */
+ function getCalculatedFields() {
+ $fields = array(
+ 'utm_source',
+ 'amount',
+ 'order_id',
+ 'i_order_id',
+ 'gateway',
+ 'optout',
+ 'anonymous',
+ 'language',
+ 'contribution_tracking_id', //sort of...
+ 'currency'
+ );
+ return $fields;
+ }
function normalizeAndSanitize() {
if ( !empty( $this->normalized ) ) {
@@ -254,11 +277,26 @@
$this->setNormalizedOptOuts();
$this->setLanguage();
$this->handleContributionTrackingID();
+ $this->setCurrencyCode();
array_walk( $this->normalized, array( $this,
'sanitizeInput' ) );
}
}
/**
+ * normalizeAndSanitize helper function
+ * Setting the currency code correctly.
+ */
+ function setCurrencyCode() {
+ global $wgRequest;
+ if ( !$this->isSomething('currency') ){
+ $code = $wgRequest->getVal('currency', null);
+ if (!is_null($code)){
+ $this->setVal('currency', $code);
+ }
+ }
+ }
+
+ /**
* normalizeAndSanitize helper function.
* Assures that if no contribution_tracking_id is present, a row is
created
* in the Contribution tracking table, and that row is assigned to the
Modified:
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
===================================================================
---
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
2011-11-04 18:08:51 UTC (rev 102019)
+++
branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
2011-11-04 18:13:43 UTC (rev 102020)
@@ -739,7 +739,14 @@
*/
protected function stage_returnto( $type = 'request' ) {
if ( $type === 'request' ) {
- $this->postdata['returnto'] =
$this->postdata['returnto'] . '?' . wfArrayToCGI( array( 'order_id' =>
$this->postdata['order_id'] ) );
+ // Add order ID to the returnto URL, only if it's not
already there.
+ //TODO: This needs to be more robust (like actually
pulling the
+ //qstring keys, resetting the values, and putting it
all back)
+ //but for now it'll keep us alive.
+ if ( !strpos( $this->postdata['returnto'], 'order_id' )
){
+ $queryArray = array( 'order_id' =>
$this->postdata['order_id'] );
+ $this->postdata['returnto'] = wfAppendQuery(
$this->postdata['returnto'], $queryArray );
+ }
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs