r103611 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103610‎ | r103611 | r103612 >
Date:20:23, 18 November 2011
Author:kaldari
Status:ok
Tags:
Comment:
make sure that we only use amount_given if amount is not a number
Modified paths:
  • /trunk/extensions/ContributionTracking/ContributionTracking.processor.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionTracking/ContributionTracking.processor.php
@@ -408,10 +408,12 @@
409409 }
410410
411411 // Normalized amount
412 - $repost['fields'][$amount_field_name] = $input['amount'];
413 - if ( $input['amount_given'] ) {
414 - $repost['fields'][$amount_field_name] = $input['amount_given'];
 412+ $amount = $input['amount'];
 413+ // If amount is not a number, use amount_given
 414+ if ( !( preg_match( '/^\d+(\.(\d+)?)?$/', $amount ) ) && $input['amount_given'] ) {
 415+ $amount = $input['amount_given'];
415416 }
 417+ $repost['fields'][$amount_field_name] = $amount
416418
417419 // Tracking
418420 $repost['fields']['custom'] = $input['contribution_tracking_id'];

Follow-up revisions

RevisionCommit summaryAuthorDate
r103620follow-up to r103611, missing semicolonkaldari22:31, 18 November 2011
r106375MFT r103611, r103620, r103622, r104210, r104368, r106136, r106367awjrichards21:29, 15 December 2011

Status & tagging log