From 93d9702a1018fee7525c38e2678090454124c2ad Mon Sep 17 00:00:00 2001 From: Justin Freeman Date: Tue, 4 Apr 2023 15:51:34 +1000 Subject: [PATCH] CIVICRM-2120 Payment API creates Activity with subject: "$x Offline Payment for Contribution" even when a payment was captured online --- CRM/Contribute/BAO/Contribution.php | 2 +- tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 04e9608983..15cca651f5 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3522,7 +3522,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac */ public static function addActivityForPayment($targetCid, $activityType, $title, $contributionId, $totalAmount, $currency, $trxn_date) { $paymentAmount = CRM_Utils_Money::format($totalAmount, $currency); - $subject = "{$paymentAmount} - Offline {$activityType} for {$title}"; + $subject = "{$paymentAmount} - {$activityType} for {$title}"; $date = CRM_Utils_Date::isoToMysql($trxn_date); // source record id would be the contribution id $srcRecId = $contributionId; diff --git a/tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php b/tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php index 54c6e69507..46b2215435 100644 --- a/tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php +++ b/tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php @@ -179,8 +179,8 @@ class CRM_Contribute_Form_AdditionalPaymentTest extends CiviUnitTestCase { 'return' => ['target_contact_id', 'assignee_contact_id', 'subject'], ])['values']; $this->assertCount(3, $activities); - $this->assertEquals('$ 50.00 - Offline Payment for Contribution', $activities[1]['subject']); - $this->assertEquals('$ 20.00 - Offline Payment for Contribution', $activities[2]['subject']); + $this->assertEquals('$ 50.00 - Payment for Contribution', $activities[1]['subject']); + $this->assertEquals('$ 20.00 - Payment for Contribution', $activities[2]['subject']); $this->assertEquals(CRM_Core_Session::singleton()->getLoggedInContactID(), $activities[0]['source_contact_id']); $this->assertEquals([$this->_individualId], $activities[0]['target_contact_id']); $this->assertEquals([], $activities[0]['assignee_contact_id']); -- 2.25.1