Index: trunk/extensions/DonationInterface/gateway_common/DataValidator.php |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | | - if ( $type === 'valid_type' ) { |
| 163 | + if ( $type === 'valid_type' || $type === 'calculated' ) { |
164 | 164 | //NOTE: We are just using the next bit because it's convenient. |
165 | 165 | //getErrorToken is actually for something entirely different: |
166 | 166 | //Figuring out where on the form the error should land. |
— | — | @@ -168,8 +168,10 @@ |
169 | 169 | switch ($token){ |
170 | 170 | case 'amount': |
171 | 171 | $suffix = 'invalid-amount'; |
| 172 | + break; |
172 | 173 | case 'emailAdd': |
173 | 174 | $suffix = 'email'; |
| 175 | + break; |
174 | 176 | case 'card_num': //god damn it. |
175 | 177 | $suffix = 'card_num'; //more defaultness. |
176 | 178 | if (!is_null($value)){ |
— | — | @@ -276,6 +278,8 @@ |
277 | 279 | //Note: We could do something like also validate amount not empty, and then that it's numeric |
278 | 280 | //That way we'd get more precisely granular error messages. |
279 | 281 | $check_type = 'calculated'; |
| 282 | + $instructions['non_empty']['amount'] = 'validate_not_empty'; |
| 283 | + $instructions['valid_type']['amount'] = 'validate_numeric'; |
280 | 284 | $instructions['non_empty']['currency_code'] = 'validate_not_empty'; |
281 | 285 | $instructions['valid_type']['currency_code'] = self::getValidationFunction( 'currency_code' ); |
282 | 286 | $instructions['non_empty']['gateway'] = 'validate_not_empty'; |
— | — | @@ -360,8 +364,8 @@ |
361 | 365 | throw new MWException( __FUNCTION__ . " BAD PROGRAMMER. No $function function. ('calculated' rule for $field)" ); |
362 | 366 | } |
363 | 367 | } |
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 ) ); |
366 | 370 | return $errors; |
367 | 371 | } |
368 | 372 | |