From: eileen Date: Thu, 25 Mar 2021 07:18:56 +0000 (+1300) Subject: Move handling for soft credits to the only form that uses it X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=32a5a2cedc0ba1ef265e123300759d7039b708d4;p=civicrm-core.git Move handling for soft credits to the only form that uses it --- diff --git a/CRM/Contribute/Form/Task.php b/CRM/Contribute/Form/Task.php index f73b7c0934..53df76a8b5 100644 --- a/CRM/Contribute/Form/Task.php +++ b/CRM/Contribute/Form/Task.php @@ -30,13 +30,6 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task { */ protected $_contributionIds; - /** - * The array that holds all the mapping contribution and contact ids. - * - * @var array - */ - protected $_contributionContactIds = []; - /** * Build all the data structures needed to build the form. */ @@ -61,10 +54,6 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task { $result = $form->getSearchQueryResults(); while ($result->fetch()) { $ids[] = $result->contribution_id; - if ($form->isQueryIncludesSoftCredits()) { - $form->_contactIds[$result->contact_id] = $result->contact_id; - $form->_contributionContactIds["{$result->contact_id}-{$result->contribution_id}"] = $result->contribution_id; - } } $form->assign('totalSelectedContributions', $form->get('rowCount')); } diff --git a/CRM/Contribute/Form/Task/PDFLetterCommon.php b/CRM/Contribute/Form/Task/PDFLetterCommon.php index af0b20f90c..e776799ada 100644 --- a/CRM/Contribute/Form/Task/PDFLetterCommon.php +++ b/CRM/Contribute/Form/Task/PDFLetterCommon.php @@ -25,6 +25,8 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF * * @param \CRM_Contribute_Form_Task_PDFLetter $form * @param array $formValues + * + * @throws \CRM_Core_Exception */ public static function postProcess(&$form, $formValues = NULL) { if (empty($formValues)) { @@ -79,8 +81,12 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF $skipDeceased = $form->skipDeceased ?? TRUE; $contributionIDs = $form->getVar('_contributionIds'); if ($form->isQueryIncludesSoftCredits()) { - //@todo - comment on what is stored there - $contributionIDs = $form->getVar('_contributionContactIds'); + $contributionIDs = []; + $result = $form->getSearchQueryResults(); + while ($result->fetch()) { + $form->_contactIds[$result->contact_id] = $result->contact_id; + $contributionIDs["{$result->contact_id}-{$result->contribution_id}"] = $result->contribution_id; + } } [$contributions, $contacts] = self::buildContributionArray($groupBy, $contributionIDs, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $task, $separator, $form->isQueryIncludesSoftCredits()); $html = [];