Adamw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/82121
Change subject: Max field length validation during import
......................................................................
Max field length validation during import
Change-Id: I41548da856d405f14a1fecf94d5d36c16f347bec
TODO: fix Civi schema so that we can store emails up to 254 chars
---
M sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
1 file changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/21/82121/1
diff --git a/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
b/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
index 5d60b86..9d12393 100644
--- a/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
@@ -636,6 +636,26 @@
throw new WmfException('CIVI_REQ_FIELD', $err, $msg);
}
+ $max_lengths = array(
+ 'check_number' => 255,
+ 'city' => 64,
+ //FIXME: the IETF max length for an email address is 254. fix the Civi
schema.
+ 'email' => 64,
+ 'first_name' => 64,
+ 'last_name' => 64,
+ 'middle_name' => 64,
+ 'organization_name' => 128,
+ 'postal_code' => 12,
+ 'street_address' => 96,
+ 'supplemental_address_1' => 96,
+ 'supplemental_address_2' => 96,
+ );
+ foreach ( $max_lengths as $key => $limit ) {
+ if ( strlen( $msg[$key] ) > $limit ) {
+ throw new WmfException( 'INVALID_MESSAGE', "Field '{$key}' is too
long.", $msg );
+ }
+ }
+
//Now check to make sure this isn't going to be a duplicate message for
this gateway.
if ( wmf_civicrm_get_contributions_from_gateway_id( $msg['gateway'],
$msg['gateway_txn_id'] ) ) {
throw new WmfException('DUPLICATE_CONTRIBUTION',
--
To view, visit https://gerrit.wikimedia.org/r/82121
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I41548da856d405f14a1fecf94d5d36c16f347bec
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits