diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 05ef72b26f00..9d9eddde3430 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -1322,7 +1322,7 @@ public static function validatePriceSet(&$form, $params) { $feeBlock = $priceSetDetails['fields']; } - $optionMaxValues = $fieldSelected = $priceFieldCheck = array(); + $optionMaxValues = $fieldSelected = array(); foreach ($params as $pNum => $values) { if (!is_array($values) || $values == 'skip') { continue; @@ -1345,11 +1345,6 @@ public static function validatePriceSet(&$form, $params) { continue; } - // Make an array for selected price fields. - if (!empty($priceFieldId) && !empty($value)) { - $priceFieldCheck[] = $priceFieldId; - } - $fieldSelected[$pNum] = TRUE; if (!$hasOptMaxValue || !is_array($value)) { @@ -1379,7 +1374,7 @@ public static function validatePriceSet(&$form, $params) { } //validate for price field selection. - if (empty($fieldSelected[$pNum]) || empty($priceFieldCheck)) { + if (empty($fieldSelected[$pNum])) { $errors[$pNum]['_qf_default'] = ts('Select at least one option from Event Fee(s).'); } } diff --git a/tests/phpunit/CRM/Event/Form/RegistrationTest.php b/tests/phpunit/CRM/Event/Form/RegistrationTest.php deleted file mode 100644 index 74c4393aca12..000000000000 --- a/tests/phpunit/CRM/Event/Form/RegistrationTest.php +++ /dev/null @@ -1,74 +0,0 @@ -controller = new CRM_Core_Controller(); - - $feeAmt = 100; - $priceSetId = $this->eventPriceSetCreate($feeAmt); - $priceSet = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId)); - $form->_feeBlock = $priceSet['fields']; - $priceField = $this->callAPISuccess('PriceField', 'get', array('price_set_id' => $priceSetId)); - $params = array( - array( - 'priceSetId' => $priceSetId, - ), - ); - // Check empty values for price fields. - foreach (array_keys($priceField['values']) as $fieldId) { - $params[0]['price_' . $fieldId] = NULL; - } - $form->set('priceSetId', $priceSetId); - $form->set('priceSet', $priceSet); - $form->set('name', 'CRM_Event_Form_Registration'); - $errors = CRM_Event_Form_Registration::validatePriceSet($form, $params); - - //Assert the validation Error. - $expectedResult = array( - array( - '_qf_default' => 'Select at least one option from Event Fee(s).', - ), - ); - $this->checkArrayEquals($expectedResult, $errors); - } - -}