/** * Check if field is valid and (if needed) set an error message * * @param array $data Current section data * @param string $section Current section name * * @return void */ protected function validateFields(array $data, $section) { parent::validateFields($data, $section); $orderCounterNumber = (int) \XLite\Core\Config::getInstance()->General->order_number_counter; $orderCounterNumberToChange = (int) \XLite\Core\Request::getInstance()->order_number_counter; if ($orderCounterNumberToChange < $orderCounterNumber) { $this->addErrorMessage(static::SECTION_PARAM_FIELDS, 'The next order number should be greater than the current one'); } }
/** * Check if field is valid and (if needed) set an error message * * @param array $data Current section data * @param string $section Current section name * * @return void */ protected function validateFields(array $data, $section) { parent::validateFields($data, $section); if ('default' == $section && \XLite::getController() instanceof \XLite\Controller\Admin\Module && 'CDev\\AmazonS3Images' == $this->getModule()->getActualName() && !$this->errorMessages) { $vars = array(); foreach ($data[self::SECTION_PARAM_FIELDS] as $field) { $vars[$field->getName()] = $field->getValue(); } $client = \XLite\Module\CDev\AmazonS3Images\Core\S3::getInstance(); if (!empty($vars['access_key']) && !empty($vars['secret_key']) && !empty($vars['bucket']) && !$client->checkSettings($vars['access_key'], $vars['secret_key'], $vars['bucket'])) { $this->addErrorMessage('access_key', 'Connection to Amazon S3 failed.' . ' Check whether the AWS Access key и AWS Secret key specified in the module settings are correct.', $data); } } }