Adamw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/72611
Change subject: * Do some required field enforcement. * thankyou_date column
header has changed to "Thank You Letter Date". Be sure to correct in incoming
documents. * Include a recent db schema migration in the fresh install script.
......................................................................
* Do some required field enforcement.
* thankyou_date column header has changed to "Thank You Letter Date". Be sure
to correct in incoming documents.
* Include a recent db schema migration in the fresh install script.
Change-Id: I681960d2af28345657864b89f2e0f191b4d6b172
---
M sites/all/modules/offline2civicrm/import_checks.drush.inc
M sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.install
2 files changed, 23 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/11/72611/1
diff --git a/sites/all/modules/offline2civicrm/import_checks.drush.inc
b/sites/all/modules/offline2civicrm/import_checks.drush.inc
index e9d300d..9a817d1 100644
--- a/sites/all/modules/offline2civicrm/import_checks.drush.inc
+++ b/sites/all/modules/offline2civicrm/import_checks.drush.inc
@@ -43,6 +43,15 @@
function drush_import_checks() {
require_once 'offline2civicrm.common.inc';
+ $required_fields = array(
+ 'date',
+ 'gross',
+ 'gift_source',
+ 'import_batch_number',
+ 'check_number',
+ 'restrictions',
+ );
+
$args = drush_get_arguments();
$filename = $args[1];
@@ -87,7 +96,7 @@
"gross" => _get_value( "Total Amount", $row,
$headers ),
"net" => _get_value( "Total Amount", $row,
$headers ),
"date" => strtotime( _get_value( "Received
Date", $row, $headers ) ),
- "thankyou_date" => strtotime( _get_value(
"Thank You Date", $row, $headers ) ),
+ "thankyou_date" => strtotime( _get_value(
"Thank You Letter Date", $row, $headers ) ),
"restrictions" => _get_value( "Restrictions",
$row, $headers ),
"gift_source" => _get_value( "Gift Source",
$row, $headers ),
"direct_mail_appeal" => _get_value( "Direct
Mail Appeal", $row, $headers ),
@@ -106,7 +115,6 @@
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...
@@ -170,7 +178,19 @@
continue;
}
+ $failed = array();
+ foreach ( $required_fields as $key ) {
+ if ( !array_key_exists( $key, $msg ) or empty(
$msg[$key] ) ) {
+ $failed[] = $key;
+ }
+ }
+ if ( $failed ) {
+ throw new WmfException( 'CIVI_REQ_FIELD', t(
"Missing required fields :keys during check import", array( ":keys" => implode(
", ", $failed ) ) ) );
+ }
+
$contribution =
wmf_civicrm_contribution_message_import( $msg );
+
+ watchdog('offline2civicrm', 'Import checks:
Contribution imported successfully (!id): !msg', array('!id' =>
$contribution['id'], '!msg' => print_r( $msg, true )), WATCHDOG_INFO);
}
catch (WmfException $ex) {
watchdog('offline2civicrm', 'Import checks: error
during import ' + $ex->getMessage(), NULL, WATCHDOG_ERROR);
@@ -185,8 +205,6 @@
} catch ( Exception $e ){
watchdog('offline2civicrm', 'Import checks: Unknown
exception thrown during check processing: ' . print_r( $e, true ), array(),
WATCHDOG_ERROR);
}
-
- watchdog('offline2civicrm', 'Import checks: Contribution
imported successfully (!id): !msg', array('!id' => $contribution['id'], '!msg'
=> print_r( $msg, true )), WATCHDOG_INFO);
}
watchdog( 'offline2civicrm', 'Import checks: finished', null,
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 de53ae0..ba08096 100644
--- a/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.install
@@ -12,6 +12,7 @@
wmf_civicrm_update_6005();
wmf_civicrm_update_6006();
wmf_civicrm_update_6007();
+ wmf_civicrm_update_6008();
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/72611
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I681960d2af28345657864b89f2e0f191b4d6b172
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