public function buildQuickForm() {
$this->assign('currency', CRM_Core_Config::singleton()->defaultCurrencySymbol);
-
+ $isUpdateToExistingRecurringMembership = $this->isUpdateToExistingRecurringMembership();
// build price set form.
$buildPriceSet = FALSE;
if ($this->_priceSetId || !empty($_POST['price_set_id'])) {
);
$sel->setOptions(array($selMemTypeOrg, $selOrgMemType));
- $elementsFrozenOnMembershipsAlreadyRecurring = array();
- if ($sel) {
- $elementsFrozenOnMembershipsAlreadyRecurring[] = $sel;
+ if ($isUpdateToExistingRecurringMembership) {
+ $sel->freeze();
}
$this->applyFilter('__ALL__', 'trim');
$this->addDate('join_date', ts('Member Since'), FALSE, array('formatType' => 'activityDate'));
$this->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'activityDate'));
$endDate = $this->addDate('end_date', ts('End Date'), FALSE, array('formatType' => 'activityDate'));
- if ($endDate) {
- $elementsFrozenOnMembershipsAlreadyRecurring[] = $endDate;
+ if ($endDate && $isUpdateToExistingRecurringMembership) {
+ $endDate->freeze();
}
$this->add('text', 'source', ts('Source'),
$statusOverride = $this->addElement('select', 'is_override', ts('Status Override?'),
CRM_Member_StatusOverrideTypes::getSelectOptions()
);
- if ($statusOverride) {
- $elementsFrozenOnMembershipsAlreadyRecurring[] = $statusOverride;
+ if ($statusOverride && $isUpdateToExistingRecurringMembership) {
+ $statusOverride->freeze();
}
$this->add('datepicker', 'status_override_end_date', ts('Status Override End Date'), '', FALSE, array('minDate' => time(), 'time' => FALSE));
$this->assign('displayName', $this->_memberDisplayName);
}
- $isUpdateToExistingRecurringMembership = $this->isUpdateToExistingRecurringMembership();
if ($isUpdateToExistingRecurringMembership && CRM_Member_BAO_Membership::isCancelSubscriptionSupported($this->_id)) {
$this->assign('cancelAutoRenew',
CRM_Utils_System::url('civicrm/contribute/unsubscribe', "reset=1&mid={$this->_id}")
);
}
- if ($isUpdateToExistingRecurringMembership) {
- foreach ($elementsFrozenOnMembershipsAlreadyRecurring as $elem) {
- $elem->freeze();
- }
- }
+
$this->assign('isRecur', $isUpdateToExistingRecurringMembership);
$this->addFormRule(array('CRM_Member_Form_Membership', 'formRule'), $this);