Skip to content

Commit

Permalink
Move handling for soft credits to the only form that uses it
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Mar 25, 2021
1 parent 6ecf28f commit a6caa0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 0 additions & 11 deletions CRM/Contribute/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -61,10 +54,6 @@ public static function preProcessCommon(&$form): void {
$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'));
}
Expand Down
9 changes: 7 additions & 2 deletions CRM/Contribute/Form/Task/PDFLetterCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static function buildQuickForm(&$form) {
*
* @param \CRM_Contribute_Form_Task_PDFLetter $form
* @param array $formValues
*
* @throws \CRM_Core_Exception
*/
public static function postProcess(&$form, $formValues = NULL) {
if (empty($formValues)) {
Expand Down Expand Up @@ -79,8 +81,11 @@ public static function postProcess(&$form, $formValues = NULL) {
$skipDeceased = $form->skipDeceased ?? TRUE;
$contributionIDs = $form->getVar('_contributionIds');
if ($form->isQueryIncludesSoftCredits()) {
//@todo - comment on what is stored there
$contributionIDs = $form->getVar('_contributionContactIds');
$contributionIDs = [];
foreach ($form->getSearchQueryResults() as $result) {
$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 = [];
Expand Down

0 comments on commit a6caa0a

Please sign in to comment.