r100889 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100888‎ | r100889 | r100890 >
Date:22:24, 26 October 2011
Author:kaldari
Status:ok
Tags:fundraising 
Comment:
follow-up to r100886, fixing error messages
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/GatewayForm.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter3.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter3.php
@@ -15,27 +15,6 @@
1616 public function loadPlaceholders() {
1717 global $wgOut;
1818
19 -
20 - $scriptVars = array(
21 - 'payflowproGatewayErrorMsgJs' => wfMsg( 'donate_interface-error-msg-js' ),
22 - 'payflowproGatewayErrorMsgEmail' => wfMsg( 'donate_interface-error-msg-email' ),
23 - 'payflowproGatewayErrorMsgAmount' => wfMsg( 'donate_interface-error-msg-amount' ),
24 - 'payflowproGatewayErrorMsgEmailAdd' => wfMsg( 'donate_interface-error-msg-emailAdd' ),
25 - 'payflowproGatewayErrorMsgFname' => wfMsg( 'donate_interface-error-msg-fname' ),
26 - 'payflowproGatewayErrorMsgLname' => wfMsg( 'donate_interface-error-msg-lname' ),
27 - 'payflowproGatewayErrorMsgStreet' => wfMsg( 'donate_interface-error-msg-street' ),
28 - 'payflowproGatewayErrorMsgCity' => wfMsg( 'donate_interface-error-msg-city' ),
29 - 'payflowproGatewayErrorMsgState' => wfMsg( 'donate_interface-error-msg-state' ),
30 - 'payflowproGatewayErrorMsgZip' => wfMsg( 'donate_interface-error-msg-zip' ),
31 - 'payflowproGatewayErrorMsgCountry' => wfMsg( 'donate_interface-error-msg-country' ),
32 - 'payflowproGatewayErrorMsgCardNum' => wfMsg( 'donate_interface-error-msg-card_num' ),
33 - 'payflowproGatewayErrorMsgExpiration' => wfMsg( 'donate_interface-error-msg-expiration' ),
34 - 'payflowproGatewayErrorMsgCvv' => wfMsg( 'donate_interface-error-msg-cvv' ),
35 - 'payflowproGatewayCVVExplain' => wfMsg( 'donate_interface-cvv-explain' ),
36 - );
37 -
38 - $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) );
39 -
4019 // form placeholder values
4120 $first = wfMsg( 'donate_interface-donor-fname' );
4221 $last = wfMsg( 'donate_interface-donor-lname' );
Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php
@@ -145,28 +145,28 @@
146146
147147 if ( empty( $data['street'] ) ) {
148148
149 - $error['street'] = 'dontate_interface-error-msg-street' );
 149+ $error['street'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-street' ) );
150150
151151 $this->setValidateFormResult( false );
152152 }
153153
154154 if ( empty( $data['city'] ) ) {
155155
156 - $error['city'] = 'dontate_interface-error-msg-city' );
 156+ $error['city'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-city' ) );
157157
158158 $this->setValidateFormResult( false );
159159 }
160160
161161 if ( empty( $data['state'] ) ) {
162162
163 - $error['state'] = 'dontate_interface-error-msg-state' );
 163+ $error['state'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-state' ) );
164164
165165 $this->setValidateFormResult( false );
166166 }
167167
168168 if ( empty( $data['zip'] ) && $data['state'] != 'XX') {
169169
170 - $error['zip'] = 'dontate_interface-error-msg-zip' );
 170+ $error['zip'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-zip' ) );
171171
172172 $this->setValidateFormResult( false );
173173 }
@@ -184,7 +184,7 @@
185185
186186 if ( empty( $data['amount'] ) ) {
187187
188 - $error['amount'] = 'dontate_interface-error-msg-amount' );
 188+ $error['amount'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-amount' ) );
189189
190190 $this->setValidateFormResult( false );
191191 }
@@ -196,7 +196,7 @@
197197 ( ( float ) $this->convert_to_usd( $data['currency'], $data['amount'] ) < ( float ) $priceFloor ||
198198 ( float ) $this->convert_to_usd( $data['currency'], $data['amount'] ) > ( float ) $priceCeiling ) ) {
199199
200 - $error['invalidamount'] = 'dontate_interface-error-msg-invalid-amount' );
 200+ $error['invalidamount'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-invalid-amount' ) );
201201
202202 $this->setValidateFormResult( false );
203203 }
@@ -214,21 +214,21 @@
215215
216216 if ( empty( $data['card_num'] ) ) {
217217
218 - $error['card_num'] = 'dontate_interface-error-msg-card_num' );
 218+ $error['card_num'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-card_num' ) );
219219
220220 $this->setValidateFormResult( false );
221221 }
222222
223223 if ( empty( $data['cvv'] ) ) {
224224
225 - $error['cvv'] = 'dontate_interface-error-msg-cvv' );
 225+ $error['cvv'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-cvv' ) );
226226
227227 $this->setValidateFormResult( false );
228228 }
229229
230230 if ( empty( $data['expiration'] ) ) {
231231
232 - $error['expiration'] = 'dontate_interface-error-msg-expiration' );
 232+ $error['expiration'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-expiration' ) );
233233
234234 $this->setValidateFormResult( false );
235235 }
@@ -243,7 +243,7 @@
244244 } elseif ( preg_match( '/^6(?:011|5[0-9]{2})[0-9]{12}$/', $data['card_num'] ) ) { // discover
245245 $data['card'] = 'discover';
246246 } else { // an invalid credit card number was entered
247 - $error['card_num'] = 'dontate_interface-error-msg-card-num' );
 247+ $error['card_num'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-card-num' ) );
248248
249249 $this->setValidateFormResult( false );
250250 }
@@ -261,7 +261,7 @@
262262
263263 if ( empty( $data['email'] ) ) {
264264
265 - $error['email'] = 'dontate_interface-error-email-empty' );
 265+ $error['email'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-email-empty' ) );
266266
267267 $this->setValidateFormResult( false );
268268 }
@@ -271,7 +271,7 @@
272272
273273 // create error message (supercedes empty field message)
274274 if ( !$isEmail ) {
275 - $error['email'] = 'dontate_interface-error-msg-email' );
 275+ $error['email'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-email' ) );
276276
277277 $this->setValidateFormResult( false );
278278 }
@@ -289,14 +289,14 @@
290290
291291 if ( empty( $data['fname'] ) ) {
292292
293 - $error['fname'] = 'dontate_interface-error-msg-fname' );
 293+ $error['fname'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-fname' ) );
294294
295295 $this->setValidateFormResult( false );
296296 }
297297
298298 if ( empty( $data['lname'] ) ) {
299299
300 - $error['lname'] = 'dontate_interface-error-msg-lname' );
 300+ $error['lname'] = wfMsg( 'donate_interface-error-msg', wfMsg( 'donate_interface-error-msg-lname' ) );
301301
302302 $this->setValidateFormResult( false );
303303 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100878Updating message names tb donate_interface-<msg> rather than payflowpro_gatew...awjrichards21:35, 26 October 2011
r100886fixing form validation broken by message migrationkaldari22:13, 26 October 2011

Status & tagging log