From 7656ed4290a6b49431beaa923912f1e33324fd55 Mon Sep 17 00:00:00 2001 From: Patrick Figel Date: Wed, 4 Aug 2021 17:20:48 +0200 Subject: [PATCH] dev/core#2739 - Fix contribution tasks using wrong IDs This fixes an issue where contribution tasks may perform actions on unrelated contribution IDs when they're called via contact search forms. --- CRM/Contribute/Form/Task/TaskTrait.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Contribute/Form/Task/TaskTrait.php b/CRM/Contribute/Form/Task/TaskTrait.php index 2534bb0a551d..04e64a349bfe 100644 --- a/CRM/Contribute/Form/Task/TaskTrait.php +++ b/CRM/Contribute/Form/Task/TaskTrait.php @@ -114,7 +114,9 @@ public function getIDs() { * @throws \CRM_Core_Exception */ protected function calculateIDS() { - if ($this->controller->get('id')) { + // contact search forms use the id property to store the selected uf_group_id + // rather than entity (contribution) IDs, so don't use the property in that case + if (!$this->controller instanceof CRM_Contact_Controller_Search && $this->controller->get('id')) { return explode(',', $this->controller->get('id')); } $ids = $this->getSelectedIDs($this->getSearchFormValues());