Skip to content

Commit

Permalink
Fix to not show payment for templates
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Feb 10, 2022
1 parent 63db51f commit 9fa586c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CRM/Contribute/Form/ContributionView.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ public function preProcess() {
if (($context === 'fulltext' || $context === 'search') && $searchKey) {
$urlParams = "reset=1&id={$id}&cid={$values['contact_id']}&action=update&context={$context}&key={$searchKey}";
}
foreach (CRM_Contribute_BAO_Contribution::getContributionPaymentLinks($this->getID(), $contributionStatus) as $paymentButton) {
$paymentButton['icon'] = 'fa-plus-circle';
$linkButtons[] = $paymentButton;
if (!$contribution['is_template']) {
foreach (CRM_Contribute_BAO_Contribution::getContributionPaymentLinks($this->getID(), $contributionStatus) as $paymentButton) {
$paymentButton['icon'] = 'fa-plus-circle';
$linkButtons[] = $paymentButton;
}
}
$linkButtons[] = [
'title' => ts('Edit'),
Expand All @@ -244,7 +246,7 @@ public function preProcess() {
$pdfUrlParams = "reset=1&id={$id}&cid={$values['contact_id']}";
$emailUrlParams = "reset=1&id={$id}&cid={$values['contact_id']}&select=email";
if (Civi::settings()->get('invoicing') && !$contribution['is_template']) {
if (($values['contribution_status'] != 'Refunded') && ($values['contribution_status'] != 'Cancelled')) {
if (($values['contribution_status'] !== 'Refunded') && ($values['contribution_status'] !== 'Cancelled')) {
$invoiceButtonText = ts('Download Invoice');
}
else {
Expand All @@ -264,6 +266,7 @@ public function preProcess() {
];
}
$this->assign('linkButtons', $linkButtons ?? []);
// These next 3 parameters are used to construct a url in PaymentInfo.tpl
$this->assign('contactId', $values['contact_id']);
$this->assign('componentId', $id);
$this->assign('component', 'contribution');
Expand Down

0 comments on commit 9fa586c

Please sign in to comment.