jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/339341 )
Change subject: Major gifts requests, Do not send thank you for Benevity import, Set Restrictions, Gift Source. ...................................................................... Major gifts requests, Do not send thank you for Benevity import, Set Restrictions, Gift Source. Major gifts have confirmed Benevity send out emails & we should no. This fixes the import to set no_thank_you on imported contributions. This also implements the following logic: We would definitely want to include the Gift Data info for these donations, both the Restrictions and Gift Source fields. Could we have the following? - For organization gift (i.e. matching gift portion): Restriction = Restricted - Foundation/ Gift Source = Matching Gift - For individual gift under ,000: Restriction = Unrestricted - General / Gift Source = Community Gift - For individual gift ,000 and over: Restriction = Unrestricted - General / Gift Source = Benefactor Gift Note that Restriction has the custom field name 'Fund' but is handled as 'restriction' in the import code. Gift source is AKA 'Campaign' and gift_source Bug: T115044 Change-Id: I08e4e3c9b7d72128ab93d070963a627e7eadecb0 --- M sites/all/modules/offline2civicrm/BenevityFile.php M sites/all/modules/offline2civicrm/tests/BenevityTest.php M sites/all/modules/offline2civicrm/tests/data/benevity_mice_no_email.csv 3 files changed, 50 insertions(+), 2 deletions(-) Approvals: jenkins-bot: Verified Ejegg: Looks good to me, approved diff --git a/sites/all/modules/offline2civicrm/BenevityFile.php b/sites/all/modules/offline2civicrm/BenevityFile.php index 64c82b3..a9c8f81 100644 --- a/sites/all/modules/offline2civicrm/BenevityFile.php +++ b/sites/all/modules/offline2civicrm/BenevityFile.php @@ -50,6 +50,12 @@ if (!isset($msg['gross'])) { $msg['gross'] = 0; } + if ($msg['gross'] >= 1000) { + $msg['gift_source'] = 'Benefactor Gift'; + } + else { + $msg['gift_source'] = 'Community Gift'; + } foreach ($msg as $field => $value) { if ($value == 'Not shared by donor') { $msg[$field] = ''; @@ -98,6 +104,12 @@ 'contact_type' => 'Individual', 'country' => 'US', 'currency' => 'USD', + // Setting this avoids emails going out. We could set the thank_you_date + // instead to reflect Benevity having sent them out + // but we don't actually know what date they did that on, + // and recording it in our system would seem to imply we know for + // sure it happened (as opposed to Benevity says it happens). + 'no_thank_you' => 1, ); } @@ -146,6 +158,8 @@ $matchedMsg['soft_credit_to_id'] = ($msg['contact_id'] == $this->getAnonymousContactID() ? NULL : $msg['contact_id']); $matchedMsg['gross'] = $msg['matching_amount']; $matchedMsg['gateway_txn_id'] = $msg['gateway_txn_id'] . '_matched'; + $matchedMsg['gift_source'] = 'Matching Gift'; + $matchedMsg['restrictions'] = 'Restricted - Foundation'; $this->unsetAddressFields($matchedMsg); $matchingContribution = wmf_civicrm_contribution_message_import($matchedMsg); } diff --git a/sites/all/modules/offline2civicrm/tests/BenevityTest.php b/sites/all/modules/offline2civicrm/tests/BenevityTest.php index e0083cb..7f4d582 100644 --- a/sites/all/modules/offline2civicrm/tests/BenevityTest.php +++ b/sites/all/modules/offline2civicrm/tests/BenevityTest.php @@ -191,8 +191,42 @@ $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $minnie['id'])); $this->assertEquals(0, $contributions['count']); - $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $betterMinnie['id'])); + $contributions = $this->callAPISuccess('Contribution', 'get', array( + 'contact_id' => $betterMinnie['id'], + 'sequential' => 1, + 'return' => array( + wmf_civicrm_get_custom_field_name('no_thank_you'), + wmf_civicrm_get_custom_field_name('Fund'), + wmf_civicrm_get_custom_field_name('Campaign') + ), + )); $this->assertEquals(2, $contributions['count']); + $contribution1 = $contributions['values'][0]; + $this->assertEquals(1, $contribution1[wmf_civicrm_get_custom_field_name('no_thank_you')], 'No thank you should be set'); + $this->assertEquals('Community Gift', $contribution1[wmf_civicrm_get_custom_field_name('Campaign')]); + $this->assertEquals('Unrestricted - General', $contribution1[wmf_civicrm_get_custom_field_name('Fund')]); + + $contribution2 = $contributions['values'][1]; + $this->assertEquals(1, $contribution2[wmf_civicrm_get_custom_field_name('no_thank_you')]); + // This contribution was over $1000 & hence is a benefactor gift. + $this->assertEquals('Benefactor Gift', $contribution2[wmf_civicrm_get_custom_field_name('Campaign')]); + $this->assertEquals('Unrestricted - General', $contribution2[wmf_civicrm_get_custom_field_name('Fund')]); + + $organizationContributions = $this->callAPISuccess('Contribution', 'get', array( + 'contact_id' => $organization['id'], + 'sequential' => 1, + 'return' => array( + wmf_civicrm_get_custom_field_name('no_thank_you'), + wmf_civicrm_get_custom_field_name('Fund'), + wmf_civicrm_get_custom_field_name('Campaign') + ), + )); + foreach ($organizationContributions['values'] as $contribution) { + $this->assertEquals(1, $contribution[wmf_civicrm_get_custom_field_name('no_thank_you')]); + $this->assertEquals('Restricted - Foundation', $contribution[wmf_civicrm_get_custom_field_name('Fund')]); + $this->assertEquals('Matching Gift', $contribution[wmf_civicrm_get_custom_field_name('Campaign')]); + } + } /** diff --git a/sites/all/modules/offline2civicrm/tests/data/benevity_mice_no_email.csv b/sites/all/modules/offline2civicrm/tests/data/benevity_mice_no_email.csv index 4634be7..6b83125 100644 --- a/sites/all/modules/offline2civicrm/tests/data/benevity_mice_no_email.csv +++ b/sites/all/modules/offline2civicrm/tests/data/benevity_mice_no_email.csv @@ -1,3 +1,3 @@ Participating Corporation,Project,Date of Donation,Donor First Name,Donor Last Name,Email,Address,City,State/Province,Postal Code,Comment,Transaction ID,Donation Frequency,Donation Amount,Matched Amount,Total Mickey Mouse Inc,,2015-11-02,Minnie,Mouse,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,90210,Very stingy,trxn-AARF,Recurring,10,0.5,10.5 -Mickey Mouse Inc,,2015-11-02,Not shared by donor,Mouse,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,90210,,trxn-PEEP,Recurring,10,0.5,10.5 +Mickey Mouse Inc,,2015-11-02,Not shared by donor,Mouse,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,90210,,trxn-PEEP,Recurring,1500,10000.5,11500.5 -- To view, visit https://gerrit.wikimedia.org/r/339341 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I08e4e3c9b7d72128ab93d070963a627e7eadecb0 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org> Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits