}
}
}
+ // Return error if empty $self->_memTypeSelected
+ if (empty($errors) && empty($selectedMemberships)) {
+ $errors['_qf_default'] = ts('Select at least one membership option.');
+ }
+ if (!$self->_mode && empty($params['record_contribution'])) {
+ $errors['record_contribution'] = ts('Record Membership Payment is required when you use a price set.');
+ }
}
- elseif (empty($params['membership_type_id'][1])) {
- $errors['membership_type_id'] = ts('Please select a membership type.');
- }
-
- if (!$priceSetId) {
+ else {
+ if (empty($params['membership_type_id'][1])) {
+ $errors['membership_type_id'] = ts('Please select a membership type.');
+ }
$numterms = CRM_Utils_Array::value('num_terms', $params);
if ($numterms && intval($numterms) != $numterms) {
$errors['num_terms'] = ts('Please enter an integer for the number of terms.');
}
- }
- // Return error if empty $self->_memTypeSelected
- if ($priceSetId && empty($errors) && empty($selectedMemberships)) {
- $errors['_qf_default'] = ts('Select at least one membership option.');
+ if ($self->_mode || isset($params['record_contribution']) && empty($params['financial_type_id'])) {
+ $errors['financial_type_id'] = ts('Please enter the financial Type.');
+ }
}
if (!empty($errors) && (count($selectedMemberships) > 1)) {
return $errors;
}
- if ($priceSetId && !$self->_mode && empty($params['record_contribution'])) {
- $errors['record_contribution'] = ts('Record Membership Payment is required when you using price set.');
- }
-
- if (!$priceSetId && $self->_mode && empty($params['financial_type_id'])) {
- $errors['financial_type_id'] = ts('Please enter the financial Type.');
- }
if (!empty($params['record_contribution']) && empty($params['payment_instrument_id'])) {
$errors['payment_instrument_id'] = ts('Payment Method is a required field.');
//total amount condition arise when membership type having no
//minimum fee
if (isset($params['record_contribution'])) {
- if (!$params['financial_type_id']) {
- $errors['financial_type_id'] = ts('Please enter the financial Type.');
- }
if (CRM_Utils_System::isNull($params['total_amount'])) {
$errors['total_amount'] = ts('Please enter the contribution.');
}
$priceSetDetails[$priceSetID],
$formValues
);
+ if (empty($formValues['financial_type_id'])) {
+ $formValues['financial_type_id'] = $priceSetDetails[$priceSetID]['financial_type_id'];
+ }
$config = CRM_Core_Config::singleton();