*/
private function buildMembershipBlock() {
$cid = $this->_membershipContactID;
- $isTest = (bool) ($this->getAction() & CRM_Core_Action::PREVIEW);
$separateMembershipPayment = FALSE;
$this->addOptionalQuickFormElement('auto_renew');
if ($this->_membershipBlock) {
->addWhere('contact_id', '=', $cid)
->addWhere('membership_type_id', '=', $memType['id'])
->addWhere('status_id:name', 'NOT IN', ['Cancelled', 'Pending'])
- ->addWhere('is_test', '=', (bool) $isTest)
+ ->addWhere('is_test', '=', $this->isTest())
->addOrderBy('end_date', 'DESC')
->execute()
->first();
) {
// appears to be unreachable - selectMembership never set...
- $isTest = $self->_action & CRM_Core_Action::PREVIEW;
- $lifeMember = CRM_Member_BAO_Membership::getAllContactMembership($self->_membershipContactID, $isTest, TRUE);
+ $lifeMember = CRM_Member_BAO_Membership::getAllContactMembership($self->_membershipContactID, $self->isTest(), TRUE);
$membershipOrgDetails = CRM_Member_BAO_MembershipType::getAllMembershipTypes();
$unallowedOrgs = [];
return $this->getPriceSetID() && CRM_Price_BAO_PriceSet::isQuickConfig($this->getPriceSetID());
}
+ /**
+ * Is the form being submitted in test mode.
+ *
+ * @api this function is supported for external use.
+ *
+ * @return bool
+ */
+ public function isTest(): bool {
+ return (bool) ($this->getAction() & CRM_Core_Action::PREVIEW);
+ }
+
/**
* Get the price set for the contribution page.
*