Ejegg has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374597 )
Change subject: WIP fix c_t.country population, add test ...................................................................... WIP fix c_t.country population, add test Oops, the last code was never inserting because the pseudoConstant::countryIsoCode function expected the numeric ID, not the ISO code. Bug: T171658 Change-Id: Ie7de69e0722e5bc23a8c1439c74338debfa6214b --- M sites/all/modules/offline2civicrm/tests/ChecksFileTest.php M sites/all/modules/wmf_civicrm/wmf_civicrm.module 2 files changed, 33 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm refs/changes/97/374597/1 diff --git a/sites/all/modules/offline2civicrm/tests/ChecksFileTest.php b/sites/all/modules/offline2civicrm/tests/ChecksFileTest.php index 469c2bc..e1f6d12 100644 --- a/sites/all/modules/offline2civicrm/tests/ChecksFileTest.php +++ b/sites/all/modules/offline2civicrm/tests/ChecksFileTest.php @@ -25,4 +25,35 @@ $importer = new ChecksFileProbe( "no URI" ); $output = $importer->_parseRow( $data ); } + + /** + * Populate contribution_tracking.country + */ + function testImportCountry() { + // A few kinds of empty. + $data = array( + 'Check Number' => mt_rand(), + 'City' => 'blah city', + 'Country' => 'AR', + 'Direct Mail Appeal' => 'direct_mail_appeal', + 'Email' => 'em...@phony.com', + 'External Batch Number' => mt_rand(), + 'First Name' => 'Test_first_name', + 'Gift Source' => 'Test_gift_source', + 'Last Name' => 'Test_last_name', + 'Original Amount' => '123', + 'Original Currency' => 'USD', + 'Postal Code' => '90210', + 'Postmark Date' => '2012-02-02', + 'Received Date' => '2017-07-07', + 'State' => 'CA', + 'Street Address' => '123 Sunset Boulevard', + 'Transaction ID' => mt_rand(), + ); + + $importer = new ChecksFileProbe( "no URI" ); + $message = $importer->_parseRow( $data ); + $importer->doImport( $message ); + + } } diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module b/sites/all/modules/wmf_civicrm/wmf_civicrm.module index 81f2be6..631a4ad 100644 --- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module +++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module @@ -1623,6 +1623,7 @@ array( '%txt' => $raw ), WATCHDOG_NOTICE ); + return false; } /** @@ -1812,7 +1813,7 @@ ); if ( !empty( $msg['country'] ) && - CRM_Core_PseudoConstant::countryIsoCode( $msg['country'] ) !== null + array_search( $msg['country'], CRM_Core_PseudoConstant::countryIsoCode() ) !== false ) { $tracking['country'] = $msg['country']; } -- To view, visit https://gerrit.wikimedia.org/r/374597 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie7de69e0722e5bc23a8c1439c74338debfa6214b Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits