From c20c4ab16c714f4e5f5db679bc33bc7130bea624 Mon Sep 17 00:00:00 2001 From: Marc Michalsky forumZFD Date: Mon, 22 Feb 2021 20:03:02 +0100 Subject: [PATCH] bug-fix in soft credit creation --- CRM/TwingleCampaign/Utils/APIWrapper.php | 19 +++++++++++-------- .../resources/option_values.json | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CRM/TwingleCampaign/Utils/APIWrapper.php b/CRM/TwingleCampaign/Utils/APIWrapper.php index bed4113..c495b6f 100644 --- a/CRM/TwingleCampaign/Utils/APIWrapper.php +++ b/CRM/TwingleCampaign/Utils/APIWrapper.php @@ -134,18 +134,21 @@ class CRM_TwingleCampaign_Utils_APIWrapper { array $event): array { try { return civicrm_api3('ContributionSoft', 'create', [ - 'contribution_id' => $contribution['id'], - 'amount' => $contribution['total_amount'], - 'currency' => $contribution['currency'], - 'contact_id' => $event['contact_id'], - 'soft_credit_type' => 'twingle_event', + 'contribution_id' => $contribution['id'], + 'amount' => $contribution['total_amount'], + 'currency' => $contribution['currency'], + 'contact_id' => $event['contact_id'], + 'soft_credit_type_id' => 'twingle_event_donation', ]); } catch (CiviCRM_API3_Exception $e) { Civi::log()->error( E::LONG_NAME . - ' could not create TwingleProject: ' . - $e->getMessage(), - $project->getResponse() + ' could not create soft credit: ', + [ + 'contact_id' => $event['contact_id'], + 'contact' => $event['contact'], + 'contribution_id' => $contribution['id'], + ] ); } } diff --git a/CRM/TwingleCampaign/resources/option_values.json b/CRM/TwingleCampaign/resources/option_values.json index a51121e..03b6564 100644 --- a/CRM/TwingleCampaign/resources/option_values.json +++ b/CRM/TwingleCampaign/resources/option_values.json @@ -1,6 +1,6 @@ { - "twingle_event": { - "name": "twingle_event", + "twingle_event_donation": { + "name": "twingle_event_donation", "label": "Twingle Event", "description": "A soft credit type for TwingleEvent initiators.", "option_group_id": "soft_credit_type"