/** * @return RequestValidator */ public function createFormValidator($rpp) { $validator = $this->getValidator('RecurringProductPeriodForm_' . ($rpp['ID'] ? $rpp['ID'] : ''), $this->request); $validator->addCheck('name', new IsNotEmptyCheck($this->translate('_error_the_name_should_not_be_empty'))); $validator->addCheck('periodLength', new IsNotEmptyCheck($this->translate('_error_period_length_should_not_be_empty'))); // $validator->addCheck('rebillCount', new IsNotEmptyCheck($this->translate('_error_rebill_count_should_not_be_empty'))); $validator->addCheck('periodLength', new IsNumericCheck($this->translate('_error_period_length_expected_positive_numeric'))); // $validator->addCheck('rebillCount', new IsNumericCheck($this->translate('_error_rebill_count_expected_positive_numeric'))); $validator->addCheck('periodLength', new MinValueCheck($this->translate('_error_period_length_expected_positive_numeric'), 1)); // $validator->addCheck('rebillCount', new MinValueCheck($this->translate('_error_rebill_count_expected_positive_numeric'), 1)); $validator->addFilter('periodLength', new NumericFilter()); // $validator->addFilter('rebillCount', new NumericFilter()); ProductController::addPricesValidator($validator, 'ProductPrice_period_'); // setup price is not required. $validator->addFilter('ProductPrice_setup_price', new NumericFilter()); foreach ($this->getApplication()->getCurrencyArray() as $currency) { $validator->addFilter('ProductPrice_setup_price_' . $currency, new NumericFilter()); } return $validator; }