r101556 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101555‎ | r101556 | r101557 >
Date:23:59, 1 November 2011
Author:jpostlethwaite
Status:ok (Comments)
Tags:fundraising 
Comment:
Updated validation to accomodate forms without a state input element.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/GatewayForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php
@@ -143,14 +143,18 @@
144144 $this->setValidateFormResult( false );
145145 }
146146
147 - if ( empty( $data['state'] ) ) {
 147+ $validateState = ( $data['country'] == 'US' ) ? true : false ;
148148
 149+ if ( empty( $data['state'] ) && $validateState ) {
 150+
149151 $error['state'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-state' ) );
150152
151153 $this->setValidateFormResult( false );
152154 }
153155
154 - if ( empty( $data['zip'] ) && $data['state'] != 'XX') {
 156+ $validateZip = ( $validateState && isset( $data['state'] ) && $data['state'] != 'XX' ) ? true : false ;
 157+
 158+ if ( empty( $data['zip'] ) && $validateZip ) {
155159
156160 $error['zip'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-zip' ) );
157161

Follow-up revisions

RevisionCommit summaryAuthorDate
r102125Requiring state, country and zip on all forms. See r101556.jpostlethwaite22:32, 5 November 2011

Comments

#Comment by Awjrichards (talk | contribs)   00:20, 5 November 2011

A majority of countries have postal codes (http://en.wikipedia.org/wiki/Postal_code) and I believe are required by Global Collect in some/all instances. please clear up the handling of this as well as states with James

Status & tagging log