Mwalker has uploaded a new change for review.
https://gerrit.wikimedia.org/r/71557
Change subject: Making Check Imports More Agnostic
......................................................................
Making Check Imports More Agnostic
Change-Id: I0d6640e1b8857571ac50dd5b66c3e164c1d637f2
---
M sites/all/modules/offline2civicrm/import_checks.drush.inc
M sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.install
M sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
3 files changed, 43 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/57/71557/1
diff --git a/sites/all/modules/offline2civicrm/import_checks.drush.inc
b/sites/all/modules/offline2civicrm/import_checks.drush.inc
index 4187e0e..e9d300d 100644
--- a/sites/all/modules/offline2civicrm/import_checks.drush.inc
+++ b/sites/all/modules/offline2civicrm/import_checks.drush.inc
@@ -77,7 +77,6 @@
"city" => _get_value( "City", $row, $headers ),
"state_province" => _get_value( "State", $row,
$headers ),
"postal_code" => _get_value( "Postal Code",
$row, $headers ),
- "gateway" => "merkle",
"payment_method" => _get_value( "Payment
Instrument", $row, $headers ),
"payment_submethod" => "",
"check_number" => _get_value( "Check Number",
$row, $headers ),
@@ -95,14 +94,37 @@
"import_batch_number" => _get_value( "Batch",
$row, $headers ),
);
- if( _get_value( 'Organization Name', $row, $headers,
FALSE ) === FALSE ){
+ $contype = _get_value( 'Contribution Type', $row,
$headers );
+ switch ( $contype ) {
+ case "Merkle":
+ $msg['gateway'] = "merkle";
+ break;
+
+ case "Arizona Lockbox":
+ $msg['gateway'] = "arizonalockbox";
+ break;
+
+ default:
+ throw new WmfException(
'CIVI_REQ_FIELD', "Contribution Type '$contype' is unknown whilst importing
checks!" );
+ break;
+ }
+
+ // Attempt to get the organization name if it exists...
+ // Merkle used the "Organization Name" column header
where AZL uses "Company"
+ $orgname = _get_value( 'Organization Name', $row,
$headers, FALSE );
+ if ( $orgname === FALSE ) {
+ $orgname = _get_value( 'Company', $row,
$headers, FALSE );
+ }
+
+ if( $orgname === FALSE ) {
+ // If it's still false let's just assume it's
an individual
$msg['contact_type'] = "Individual";
$msg["first_name"] = _get_value( "First Name",
$row, $headers );
$msg["middle_name"] = _get_value( "Middle
Name", $row, $headers );
$msg["last_name"] = _get_value( "Last Name",
$row, $headers );
} else {
$msg['contact_type'] = "Organization";
- $msg['organization_name'] = _get_value(
"Organization Name", $row, $headers );
+ $msg['organization_name'] = $orgname;
}
// check for additional address information
@@ -141,7 +163,7 @@
$msg['gateway_txn_id'] = md5( $msg['check_number'] .
$name_salt );
// check to see if we have already processed this check
- if ( $existing =
wmf_civicrm_get_contributions_from_gateway_id( "merkle", $msg['gateway_txn_id']
) ){
+ if ( $existing =
wmf_civicrm_get_contributions_from_gateway_id( $msg['gateway'],
$msg['gateway_txn_id'] ) ){
// if so, move on
watchdog('offline2civicrm', 'Contribution
matches existing contribution (id: ' . $existing[0]['id'] .
') Skipping', array(), WATCHDOG_INFO);
diff --git a/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.install
b/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.install
index 11f138a..f161318 100644
--- a/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.install
@@ -479,3 +479,14 @@
$ret[] = array( 'success' => false, 'query' => $api->errorMsg() );
}
}
+
+/**
+ * Add new check processor!
+ */
+function wmf_civicrm_update_6008()
+{
+ wmf_civicrm_bootstrap_civi();
+ wmf_civicrm_create_contribution_types(array(
+ 'ArizonaLockbox',
+ ));
+}
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 76141bd..bb84ee0 100644
--- a/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
@@ -409,10 +409,12 @@
}
function wmf_civicrm_get_message_contribution_type( $msg ) {
- if ($msg['gateway'] == 'merkle') {
- return 'merkle';
- }
- return 'cash';
+ $gateway = strtolower( $msg['gateway'] );
+ if ( ( $gateway === 'merkle' ) || ( $gateway === 'arizonalockbox' ) ) {
+ return $gateway;
+ } else {
+ return 'cash';
+ }
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/71557
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d6640e1b8857571ac50dd5b66c3e164c1d637f2
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits