) {
$this->buildMembershipBlock(
$this->_membershipContactID,
- FALSE,
- $params['selectMembership'],
- FALSE
+ $params['selectMembership']
);
if (!empty($params['auto_renew'])) {
$this->assign('auto_renew', TRUE);
*
* @param int $cid
* Contact checked for having a current membership for a particular membership.
- * @param bool $isContributionMainPage
- * Is this the main page? If so add form input fields.
- * (or better yet don't have this functionality in a function shared with forms that don't share it).
* @param int|array $selectedMembershipTypeID
* Selected membership id.
- * @param bool $thankPage
- * Thank you page.
* @param null $isTest
*
* @return bool
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
- protected function buildMembershipBlock(
- $cid,
- $isContributionMainPage = FALSE,
- $selectedMembershipTypeID = NULL,
- $thankPage = FALSE,
- $isTest = NULL
- ) {
-
+ private function buildMembershipBlock($cid, $selectedMembershipTypeID = NULL, $isTest = NULL) {
$separateMembershipPayment = FALSE;
if ($this->_membershipBlock) {
$this->_currentMemberships = [];
if ($memType['id'] == $selectedMembershipTypeID) {
$this->assign('minimum_fee', $memType['minimum_fee'] ?? NULL);
$this->assign('membership_name', $memType['name']);
- if (!$thankPage && $cid) {
+ if ($cid) {
$membership = new CRM_Member_DAO_Membership();
$membership->contact_id = $cid;
$membership->membership_type_id = $memType['id'];
}
$this->assign('membershipBlock', $this->_membershipBlock);
- $this->assign('showRadio', $isContributionMainPage);
+ $this->assign('showRadio', FALSE);
$this->assign('membershipTypes', $membershipTypes);
$this->assign('allowAutoRenewMembership', $allowAutoRenewMembership);
$this->assign('autoRenewMembershipTypeOptions', json_encode($autoRenewMembershipTypeOptions));
else {
$this->assign('autoRenewOption', $autoRenewOption);
}
-
- if ($isContributionMainPage) {
- 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.'));
- }
- else {
- $this->addElement('checkbox', 'auto_renew', ts('Please renew my membership automatically.'));
- }
- }
-
- }
}
return $separateMembershipPayment;
$this->_separateMembershipPayment = $this->buildMembershipBlock(
$this->_membershipContactID,
- TRUE, NULL, FALSE,
+ NULL,
$isTest
);
}
*
* @param int $cid
* Contact checked for having a current membership for a particular membership.
- * @param bool $isContributionMainPage
- * Is this the main page? If so add form input fields.
- * (or better yet don't have this functionality in a function shared with forms that don't share it).
* @param int|array $selectedMembershipTypeID
* Selected membership id.
- * @param bool $thankPage
- * Thank you page.
* @param null $isTest
*
* @return bool
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
- protected function buildMembershipBlock(
- $cid,
- $isContributionMainPage = FALSE,
- $selectedMembershipTypeID = NULL,
- $thankPage = FALSE,
- $isTest = NULL
- ) {
-
+ private function buildMembershipBlock($cid, $selectedMembershipTypeID = NULL, $isTest = NULL) {
$separateMembershipPayment = FALSE;
if ($this->_membershipBlock) {
$this->_currentMemberships = [];
if ($memType['id'] == $selectedMembershipTypeID) {
$this->assign('minimum_fee', $memType['minimum_fee'] ?? NULL);
$this->assign('membership_name', $memType['name']);
- if (!$thankPage && $cid) {
+ if ($cid) {
$membership = new CRM_Member_DAO_Membership();
$membership->contact_id = $cid;
$membership->membership_type_id = $memType['id'];
}
$this->assign('membershipBlock', $this->_membershipBlock);
- $this->assign('showRadio', $isContributionMainPage);
+ $this->assign('showRadio', TRUE);
$this->assign('membershipTypes', $membershipTypes);
$this->assign('allowAutoRenewMembership', $allowAutoRenewMembership);
$this->assign('autoRenewMembershipTypeOptions', json_encode($autoRenewMembershipTypeOptions));
$this->assign('autoRenewOption', $autoRenewOption);
}
- if ($isContributionMainPage) {
- 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 (!$membershipPriceset) {
+ if (!$this->_membershipBlock['is_required']) {
+ $this->assign('showRadioNoThanks', TRUE);
+ $radio['no_thanks'] = NULL;
+ $this->addRadio('selectMembership', NULL, $radio, [], NULL, FALSE, $radioOptAttrs);
}
-
- 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.'));
- }
- else {
- $this->addElement('checkbox', 'auto_renew', ts('Please renew my membership automatically.'));
+ 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.'));
+ }
+ else {
+ $this->addElement('checkbox', 'auto_renew', ts('Please renew my membership automatically.'));
+ }
+ }
+
}
return $separateMembershipPayment;
$this->buildMembershipBlock(
$this->_membershipContactID,
- FALSE,
$membershipTypeID,
- TRUE,
NULL
);
*
* @param int $cid
* Contact checked for having a current membership for a particular membership.
- * @param bool $isContributionMainPage
- * Is this the main page? If so add form input fields.
- * (or better yet don't have this functionality in a function shared with forms that don't share it).
* @param int|array $selectedMembershipTypeID
* Selected membership id.
- * @param bool $thankPage
- * Thank you page.
* @param null $isTest
*
* @return bool
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
- protected function buildMembershipBlock(
- $cid,
- $isContributionMainPage = FALSE,
- $selectedMembershipTypeID = NULL,
- $thankPage = FALSE,
- $isTest = NULL
- ) {
-
+ private function buildMembershipBlock($cid, $selectedMembershipTypeID = NULL, $isTest = NULL) {
$separateMembershipPayment = FALSE;
if ($this->_membershipBlock) {
$this->_currentMemberships = [];
if ($memType['id'] == $selectedMembershipTypeID) {
$this->assign('minimum_fee', $memType['minimum_fee'] ?? NULL);
$this->assign('membership_name', $memType['name']);
- if (!$thankPage && $cid) {
- $membership = new CRM_Member_DAO_Membership();
- $membership->contact_id = $cid;
- $membership->membership_type_id = $memType['id'];
- if ($membership->find(TRUE)) {
- $this->assign('renewal_mode', TRUE);
- $memType['current_membership'] = $membership->end_date;
- $this->_currentMemberships[$membership->membership_type_id] = $membership->membership_type_id;
- }
- }
$membershipTypes[] = $memType;
}
}
}
$this->assign('membershipBlock', $this->_membershipBlock);
- $this->assign('showRadio', $isContributionMainPage);
+ $this->assign('showRadio', FALSE);
$this->assign('membershipTypes', $membershipTypes);
$this->assign('allowAutoRenewMembership', $allowAutoRenewMembership);
$this->assign('autoRenewMembershipTypeOptions', json_encode($autoRenewMembershipTypeOptions));
else {
$this->assign('autoRenewOption', $autoRenewOption);
}
-
- if ($isContributionMainPage) {
- 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.'));
- }
- else {
- $this->addElement('checkbox', 'auto_renew', ts('Please renew my membership automatically.'));
- }
- }
-
- }
}
return $separateMembershipPayment;