From: Eileen McNaughton Date: Mon, 20 Nov 2023 22:39:34 +0000 (+1300) Subject: Fix access to undeclared property, remove unreachable code X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a7fd48c298868178b7e0afcb9b8bfbb92ff22efa;p=civicrm-core.git Fix access to undeclared property, remove unreachable code --- diff --git a/CRM/Contribute/Form/ContributionPage/Premium.php b/CRM/Contribute/Form/ContributionPage/Premium.php index 258c4e1cba..53cde454f2 100644 --- a/CRM/Contribute/Form/ContributionPage/Premium.php +++ b/CRM/Contribute/Form/ContributionPage/Premium.php @@ -68,20 +68,6 @@ class CRM_Contribute_Form_ContributionPage_Premium extends CRM_Contribute_Form_C $this->add('text', 'premiums_nothankyou_label', ts('No Thank-you Label'), $attributes['premiums_nothankyou_label']); $positions = [1 => ts('Before Premiums'), 2 => ts('After Premiums')]; $this->add('select', 'premiums_nothankyou_position', ts('No Thank-you Option'), $positions); - $showForm = TRUE; - - if ($this->_single) { - if ($this->_id) { - $daoPremium = new CRM_Contribute_DAO_Premium(); - $daoPremium->entity_id = $this->_id; - $daoPremium->entity_table = 'civicrm_contribution_page'; - $daoPremium->premiums_active = 1; - if ($daoPremium->find(TRUE)) { - $showForm = FALSE; - } - } - } - $this->assign('showForm', $showForm); parent::buildQuickForm(); $this->addFormRule(['CRM_Contribute_Form_ContributionPage_Premium', 'formRule'], $this); diff --git a/templates/CRM/Contribute/Page/Premium.tpl b/templates/CRM/Contribute/Page/Premium.tpl index 377ff12a2f..336e5877c1 100644 --- a/templates/CRM/Contribute/Page/Premium.tpl +++ b/templates/CRM/Contribute/Page/Premium.tpl @@ -48,16 +48,14 @@ {/if} {else} - {if $showForm eq false} -
- {if $products ne null} - {icon icon="fa-info-circle"}{/icon} - {capture assign=crmURL}{crmURL p='civicrm/admin/contribute/addProductToPage' q="reset=1&action=update&id=$id"}{/capture} - {ts 1=$crmURL}There are no premiums offered on this contribution page yet. You can add one.{/ts} - {else} - {icon icon="fa-info-circle"}{/icon} - {ts 1=$managePremiumsURL}There are no active premiums for your site. You can create and/or enable premiums here.{/ts} - {/if} -
- {/if} +
+ {if $products ne null} + {icon icon="fa-info-circle"}{/icon} + {capture assign=crmURL}{crmURL p='civicrm/admin/contribute/addProductToPage' q="reset=1&action=update&id=$id"}{/capture} + {ts 1=$crmURL}There are no premiums offered on this contribution page yet. You can add one.{/ts} + {else} + {icon icon="fa-info-circle"}{/icon} + {ts 1=$managePremiumsURL}There are no active premiums for your site. You can create and/or enable premiums here.{/ts} + {/if} +
{/if}