r100670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100669‎ | r100670 | r100671 >
Date:00:27, 25 October 2011
Author:jpostlethwaite
Status:ok
Tags:fundraising 
Comment:
Changed validateForm() to how it was prior to r100666.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/GatewayForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php
@@ -78,8 +78,6 @@
7979 /**
8080 * Checks posted form data for errors and returns array of messages
8181 *
82 - * This is update to GatewayForm::fnValidateForm().
83 - *
8482 * @param array $data Reference to the data of the form
8583 * @param array $error Reference to the error messages of the form
8684 * @param array $options
@@ -91,39 +89,37 @@
9290 * - name - Validates: fname, lname
9391 *
9492 * @return 0|1 Returns 0 on success and 1 on failure
95 - *
96 - * @see GatewayForm::fnValidateForm()
9793 */
98 - public function validateForm( &$data, &$error, $options = false ) {
 94+ public function validateForm( &$data, &$error, $options = array() ) {
9995
100 - $validateAll = false;
101 - if ($options === false){
102 - $validateAll = true;
103 - }
104 -
105 - if ( is_array( $options ) ){
106 - extract( $options );
107 - }
 96+ extract( $options );
10897
 98+ // Set which items will be validated
 99+ $address = isset( $address ) ? ( boolean ) $address : true;
 100+ $amount = isset( $amount ) ? ( boolean ) $amount : true;
 101+ $creditCard = isset( $creditCard ) ? ( boolean ) $creditCard : false;
 102+ $email = isset( $email ) ? ( boolean ) $email : true;
 103+ $name = isset( $name ) ? ( boolean ) $name : true;
 104+
109105 // These are set in the order they will most likely appear on the form.
110 -
111 - if ( $validateAll || isset( $name ) ) {
 106+
 107+ if ( $name ) {
112108 $this->validateName( $data, $error );
113109 }
114110
115 - if ( $validateAll || isset( $address ) ) {
 111+ if ( $address ) {
116112 $this->validateAddress( $data, $error );
117113 }
118114
119 - if ( $validateAll || isset( $amount ) ) {
 115+ if ( $amount ) {
120116 $this->validateAmount( $data, $error );
121117 }
122118
123 - if ( $validateAll || isset( $email ) ) {
 119+ if ( $email ) {
124120 $this->validateEmail( $data, $error );
125121 }
126122
127 - if ( $validateAll || isset( $creditCard ) ) {
 123+ if ( $creditCard ) {
128124 $this->validateCreditCard( $data, $error );
129125 }
130126

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100666A bare-minimum fix to get GC credit card forms back off the ground, with a sl...khorn23:59, 24 October 2011

Status & tagging log