$this->_currentMemberships = [];
$membershipTypeIds = $membershipTypes = $radio = $radioOptAttrs = [];
+ // This is always true if this line is reachable - remove along with the upcoming if.
$membershipPriceset = (!empty($this->_priceSetId) && $this->isMembershipPriceSet());
$allowAutoRenewMembership = $autoRenewOption = FALSE;
$autoRenewOption = CRM_Price_BAO_PriceSet::checkAutoRenewForPriceSet($this->_priceSetId);
$this->assign('autoRenewOption', $autoRenewOption);
- if (!$membershipPriceset) {
- if (!$this->_membershipBlock['is_required']) {
- $this->assign('showRadioNoThanks', TRUE);
- $radio['no_thanks'] = NULL;
- $this->addRadio('selectMembership', NULL, $radio, [], NULL, FALSE, $radioOptAttrs);
- }
- elseif ($this->_membershipBlock['is_required'] && count($radio) == 1) {
- $temp = array_keys($radio);
- $this->add('hidden', 'selectMembership', $temp[0], ['id' => 'selectMembership']);
- $this->assign('singleMembership', TRUE);
- $this->assign('showRadio', FALSE);
- }
- else {
- foreach ($radioOptAttrs as $opt => $attrs) {
- $attrs['class'] = ' required';
- }
- $this->addRadio('selectMembership', NULL, $radio, [], NULL, FALSE, $radioOptAttrs);
- }
-
- $this->addRule('selectMembership', ts('Please select one of the memberships.'), 'required');
- }
-
if ((!$this->_values['is_pay_later'] || is_array($this->_paymentProcessors)) && ($allowAutoRenewMembership || $autoRenewOption)) {
if ($autoRenewOption == 2) {
$this->addElement('hidden', 'auto_renew', ts('Please renew my membership automatically.'));
$self->_useForMember
)
) {
+
+ // appears to be unreachable - selectMembership never set...
$isTest = $self->_action & CRM_Core_Action::PREVIEW;
$lifeMember = CRM_Member_BAO_Membership::getAllContactMembership($self->_membershipContactID, $isTest, TRUE);
{foreach from=$membershipTypes item=row}
<tr {if $context EQ "makeContribution"}class="odd-row" {/if}valign="top">
{if $showRadio }
+ {* unreachable - show radio is never true *}
{assign var="pid" value=$row.id}
<td style="width: 1em;">{$form.selectMembership.$pid.html}</td>
{else}
</td>
</tr>
{/if}
- {if $showRadio}
+ {if $showRadio}{* unreachable *}
{if $showRadioNoThanks } {* Provide no-thanks option when Membership signup is not required - per membership block configuration. *}
<tr class="odd-row">
<td>{$form.selectMembership.no_thanks.html}</td>