/**
  * 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');
     }
 }
Exemple #2
0
 /**
  * Get form field by option
  *
  * @param \XLite\Model\Config $option Option
  *
  * @return array
  */
 protected function getFormFieldByOption(\XLite\Model\Config $option)
 {
     $cell = parent::getFormFieldByOption($option);
     if ('redirect_to_cart' == $option->getName() && $cell) {
         $module = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->findModuleByName('XC\\Add2CartPopup');
         $url = $module->getInstalledURL();
         $cell[static::SCHEMA_COMMENT] = static::t('This option is ignored as Add to Cart Popup module is installed and enabled.', array('url' => $url));
     }
     return $cell;
 }
Exemple #3
0
 /**
  * Return list of the "Button" widgets
  *
  * @return array
  */
 protected function getFormButtons()
 {
     $result = parent::getFormButtons();
     $returnTarget = \XLite\Core\Request::getInstance()->returnTarget;
     if ('layout' === $returnTarget) {
         $result['layout'] = new \XLite\View\Button\SimpleLink(array(\XLite\View\Button\AButton::PARAM_LABEL => static::t('Back to layout settings'), \XLite\View\Button\AButton::PARAM_STYLE => 'action addons-list-back-button', \XLite\View\Button\Link::PARAM_LOCATION => $this->buildURL('layout')));
     } else {
         $result['addons-list'] = new \XLite\View\Button\BackToModulesLink(array(\XLite\View\Button\BackToModulesLink::PARAM_MODULE_ID => \XLite\Core\Request::getInstance()->moduleId, \XLite\View\Button\AButton::PARAM_STYLE => 'action addons-list-back-button'));
     }
     return $result;
 }
Exemple #4
0
 /**
  * Get form field by option
  *
  * @param \XLite\Model\Config $option Option
  *
  * @return array
  */
 protected function getFormFieldByOption(\XLite\Model\Config $option)
 {
     $cell = parent::getFormFieldByOption($option);
     if ('redirect_to_cart' == $option->getName() && $cell) {
         $limit = \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage();
         $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId('XC', 'Add2CartPopup', $limit);
         $params = array('clearCnd' => 1, 'page' => $pageId);
         $url = $this->buildURL('addons_list_installed', '', $params) . '#' . 'Add2CartPopup';
         $cell[static::SCHEMA_COMMENT] = static::t('This option is ignored as Add to Cart Popup module is installed and enabled.', array('url' => $url));
     }
     return $cell;
 }
Exemple #5
0
 /**
  * Get form field by option
  *
  * @param \XLite\Model\Config $option Option
  *
  * @return array
  */
 protected function getFormFieldByOption(\XLite\Model\Config $option)
 {
     $cell = parent::getFormFieldByOption($option);
     switch ($option->getName()) {
         case 'trialEnabled':
         case 'entryPointSeparator':
         case 'entryPointDHL':
         case 'DHLAccessKey':
         case 'entryPointFEDEX':
         case 'entryPointUPS':
         case 'entryPointUSPS':
             $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('accountId' => array('')));
             break;
         case 'fallbackRateValue':
             $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('fallbackRate' => array('I', 'O')));
             break;
         case 'package':
         case 'insurable':
             $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('calculationMethod' => array('C')));
             break;
         case 'fixedFeeMode':
             $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('calculationMethod' => array('F')));
             break;
         case 'fixedFeeCode':
             $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('calculationMethod' => array('F'), 'fixedFeeMode' => array('C')));
             break;
         case 'fixedFee1':
         case 'fixedFee2':
             $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('calculationMethod' => array('F'), 'fixedFeeMode' => array('F')));
             break;
     }
     if ($option->getName() == 'trialEnabled') {
         if (!\XLite\Module\XC\AuctionInc\Main::isXSTrialPeriodValid()) {
             $cell[static::SCHEMA_VALUE] = false;
             $cell[\XLite\View\FormField\Input\Checkbox\OnOff::PARAM_DISABLED] = true;
         }
     }
     return $cell;
 }
Exemple #6
0
 /**
  * Populate model object properties by the passed data
  *
  * @param array $data Data to set
  *
  * @return void
  */
 protected function setModelProperties(array $data)
 {
     $options = $this->getOptions();
     $dir = LC_DIR_SKINS . \XLite\Core\Layout::PATH_COMMON . LC_DS;
     if ('CDev\\SimpleCMS' == $options[0]->category) {
         if ($_FILES && $_FILES['logo'] && $_FILES['logo']['name']) {
             $path = \Includes\Utils\FileManager::moveUploadedFile('logo', $dir);
             if ($path) {
                 if ($options[0]->value) {
                     \Includes\Utils\FileManager::deleteFile($dir . $options[0]->value);
                 }
                 $data['logo'] = basename($path);
             }
         } elseif (\XLite\Core\Request::getInstance()->useDefaultLogo) {
             $data['logo'] = '';
             if ($options[0]->value) {
                 \Includes\Utils\FileManager::deleteFile($dir . $options[0]->value);
             }
         } else {
             $data['logo'] = $options[0]->value;
         }
     }
     parent::setModelProperties($data);
 }
Exemple #7
0
 /**
  * Check - option is required or not
  *
  * @param \XLite\Model\Config $option Option
  *
  * @return boolean
  */
 protected function isOptionRequired(\XLite\Model\Config $option)
 {
     return parent::isOptionRequired($option) || 'CDev\\AmazonS3Images' == $option->getCategory() && in_array($option->getName(), $this->amazonS3RequiredSettings);
 }
 /**
  * Return list of the "Button" widgets
  *
  * @return array
  */
 protected function getFormButtons()
 {
     $result = parent::getFormButtons();
     $result['shipping_methods'] = new \XLite\View\Button\SimpleLink(array(\XLite\View\Button\AButton::PARAM_LABEL => static::t('Back to shipping methods'), \XLite\View\Button\AButton::PARAM_STYLE => 'action shipping-list-back-button', \XLite\View\Button\Link::PARAM_LOCATION => $this->buildURL('shipping_methods')));
     return $result;
 }
Exemple #9
0
 /**
  * Get editable options
  *
  * @return array
  */
 protected function getEditableOptions()
 {
     return $this->preparePaypalOptions(parent::getEditableOptions());
 }