r107585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107584‎ | r107585 | r107586 >
Date:18:31, 29 December 2011
Author:khorn
Status:deferred
Tags:fundraising 
Comment:
followup r107551
...dumb.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/DataValidator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/DataValidator.php
@@ -159,7 +159,7 @@
160160 }
161161 }
162162
163 - if ( $type === 'valid_type' ) {
 163+ if ( $type === 'valid_type' || $type === 'calculated' ) {
164164 //NOTE: We are just using the next bit because it's convenient.
165165 //getErrorToken is actually for something entirely different:
166166 //Figuring out where on the form the error should land.
@@ -168,8 +168,10 @@
169169 switch ($token){
170170 case 'amount':
171171 $suffix = 'invalid-amount';
 172+ break;
172173 case 'emailAdd':
173174 $suffix = 'email';
 175+ break;
174176 case 'card_num': //god damn it.
175177 $suffix = 'card_num'; //more defaultness.
176178 if (!is_null($value)){
@@ -276,6 +278,8 @@
277279 //Note: We could do something like also validate amount not empty, and then that it's numeric
278280 //That way we'd get more precisely granular error messages.
279281 $check_type = 'calculated';
 282+ $instructions['non_empty']['amount'] = 'validate_not_empty';
 283+ $instructions['valid_type']['amount'] = 'validate_numeric';
280284 $instructions['non_empty']['currency_code'] = 'validate_not_empty';
281285 $instructions['valid_type']['currency_code'] = self::getValidationFunction( 'currency_code' );
282286 $instructions['non_empty']['gateway'] = 'validate_not_empty';
@@ -360,8 +364,8 @@
361365 throw new MWException( __FUNCTION__ . " BAD PROGRAMMER. No $function function. ('calculated' rule for $field)" );
362366 }
363367 }
364 - //error_log( __FUNCTION__ . " " . print_r( $instructions, true ) );
365 - //error_log( print_r( $errors, true ) );
 368+// error_log( __FUNCTION__ . " " . print_r( $instructions, true ) );
 369+// error_log( print_r( $errors, true ) );
366370 return $errors;
367371 }
368372

Follow-up revisions

RevisionCommit summaryAuthorDate
r112245New DataValidator class, and donationinterface.php Only: MFT r107299, r10755...khorn21:42, 23 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107551DataValidator class, initial commit....khorn02:01, 29 December 2011

Status & tagging log