Exemple #1
0
 protected function processAddCustomCriterion()
 {
     $objCriterion = new AdvancedSearchCriterionClass(null, (int) Tools::getValue('id_search'));
     $objCriterion->id_criterion_group = (int) Tools::getValue('id_criterion_group');
     $objCriterion->id_criterion_linked = 0;
     $objCriterion->is_custom = 1;
     $this->copyFromPost($objCriterion);
     $validationErrors = AdvancedSearchCoreClass::_retroValidateController($objCriterion);
     if (!self::_isFilledArray($validationErrors)) {
         if ($objCriterion->add()) {
             $this->_html .= 'parent.show_info("' . $this->l('Saved') . '");';
             $this->_html .= 'this.location.reload(true);';
         } else {
             $this->_html .= 'parent.show_error("' . $this->l('Error while adding criterion') . '");';
         }
     } else {
         $this->_html .= 'parent.show_error("' . $this->l('Error while adding criterion') . '");';
         foreach ($validationErrors as $error) {
             $this->_html .= 'parent.show_error("' . $error . '");';
         }
     }
 }