From: eileen Date: Tue, 27 Apr 2021 06:52:29 +0000 (+1200) Subject: Remove apparent copy & paste from Contribution pdf letter function X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1a90603e74a5ae39ffb762a6effc8137ef865359;p=civicrm-core.git Remove apparent copy & paste from Contribution pdf letter function I have done a bit of digging and I can't see any way these url parameters could be passed in to this form. I also can't think of any reason, other than our old friend copy & paste, for us to be retrieving activity or case in the url I kept the isSingle logic but redirected it to focus on a single contribution which is something we do want --- diff --git a/CRM/Contribute/Form/Task/PDFLetter.php b/CRM/Contribute/Form/Task/PDFLetter.php index 246990ecaa..6bfe80dab3 100644 --- a/CRM/Contribute/Form/Task/PDFLetter.php +++ b/CRM/Contribute/Form/Task/PDFLetter.php @@ -37,26 +37,8 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task { public function preProcess() { $this->skipOnHold = $this->skipDeceased = FALSE; CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this); - // store case id if present - $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'CommaSeparatedIntegers', $this, FALSE); - if (!empty($this->_caseId) && strpos($this->_caseId, ',')) { - $this->_caseIds = explode(',', $this->_caseId); - unset($this->_caseId); - } - - // retrieve contact ID if this is 'single' mode - $cid = CRM_Utils_Request::retrieve('cid', 'CommaSeparatedIntegers', $this, FALSE); - - $this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); - - if ($cid) { - CRM_Contact_Form_Task_PDFLetterCommon::preProcessSingle($this, $cid); - $this->_single = TRUE; - } - else { - parent::preProcess(); - } - $this->assign('single', $this->_single); + parent::preProcess(); + $this->assign('single', $this->isSingle()); } /** diff --git a/CRM/Contribute/Form/Task/TaskTrait.php b/CRM/Contribute/Form/Task/TaskTrait.php index 6dedf99ec3..9f57723b72 100644 --- a/CRM/Contribute/Form/Task/TaskTrait.php +++ b/CRM/Contribute/Form/Task/TaskTrait.php @@ -138,4 +138,13 @@ trait CRM_Contribute_Form_Task_TaskTrait { return ' civicrm_contribution.id IN ( ' . implode(',', $this->getIDs()) . ' ) '; } + /** + * Is only one entity being processed? + * + * @return false + */ + public function isSingle() { + return $this->_single ?? FALSE; + } + }