|
|
|
@@ -680,8 +680,8 @@ class AdminControllerCore extends Controller
|
|
|
|
|
'export_precontent' => "\xEF\xBB\xBF",
|
|
|
|
|
'export_headers' => $headers,
|
|
|
|
|
'export_content' => $content
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
$this->layout = 'layout-export.tpl';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -720,7 +720,7 @@ class AdminControllerCore extends Controller
|
|
|
|
|
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token;
|
|
|
|
|
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
|
|
|
|
if ($res)
|
|
|
|
|
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id);
|
|
|
|
|
Logger::addLog(sprintf($this->l('%s deletion', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@@ -771,7 +771,7 @@ class AdminControllerCore extends Controller
|
|
|
|
|
/* voluntary do affectation here */
|
|
|
|
|
elseif (($_POST[$this->identifier] = $this->object->id) && $this->postImage($this->object->id) && !count($this->errors) && $this->_redirect)
|
|
|
|
|
{
|
|
|
|
|
Logger::addLog(sprintf($this->l('%s addition'), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id);
|
|
|
|
|
Logger::addLog(sprintf($this->l('%s addition', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id);
|
|
|
|
|
$parent_id = (int)Tools::getValue('id_parent', 1);
|
|
|
|
|
$this->afterAdd($this->object);
|
|
|
|
|
$this->updateAssoShop($this->object->id);
|
|
|
|
@@ -868,10 +868,10 @@ class AdminControllerCore extends Controller
|
|
|
|
|
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=4&token='.$this->token;
|
|
|
|
|
|
|
|
|
|
// Default behavior (save and back)
|
|
|
|
|
if (empty($this->redirect_after))
|
|
|
|
|
if (empty($this->redirect_after) && $this->redirect_after !== false)
|
|
|
|
|
$this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=4&token='.$this->token;
|
|
|
|
|
}
|
|
|
|
|
Logger::addLog(sprintf($this->l('%s edition'), $this->className), 1, null, $this->className, (int)$object->id, true, (int)$this->context->employee->id);
|
|
|
|
|
Logger::addLog(sprintf($this->l('%s edition', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$object->id, true, (int)$this->context->employee->id);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
$this->errors[] = Tools::displayError('An error occurred while updating an object.').
|
|
|
|
@@ -2296,6 +2296,7 @@ class AdminControllerCore extends Controller
|
|
|
|
|
*/
|
|
|
|
|
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!isset($this->list_id))
|
|
|
|
|
$this->list_id = $this->table;
|
|
|
|
|
|
|
|
|
@@ -2350,12 +2351,20 @@ class AdminControllerCore extends Controller
|
|
|
|
|
$order_by = $this->fields_list[$order_by]['order_key'];
|
|
|
|
|
|
|
|
|
|
/* Determine offset from current page */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((isset($_POST['submitFilter'.$this->list_id]) ||
|
|
|
|
|
isset($_POST['submitFilter'.$this->list_id.'_x']) ||
|
|
|
|
|
isset($_POST['submitFilter'.$this->list_id.'_y'])) &&
|
|
|
|
|
!empty($_POST['submitFilter'.$this->list_id]) &&
|
|
|
|
|
is_numeric($_POST['submitFilter'.$this->list_id]))
|
|
|
|
|
$start = ((int)$_POST['submitFilter'.$this->list_id] - 1) * $limit;
|
|
|
|
|
elseif (empty($start) && isset($this->context->cookie->{$this->list_id.'_start'}) && Tools::isSubmit('export'.$this->table))
|
|
|
|
|
$start = $this->context->cookie->{$this->list_id.'_start'};
|
|
|
|
|
else
|
|
|
|
|
$start = 0;
|
|
|
|
|
|
|
|
|
|
$this->context->cookie->{$this->list_id.'_start'} = $start;
|
|
|
|
|
|
|
|
|
|
/* Cache */
|
|
|
|
|
$this->_lang = (int)$id_lang;
|
|
|
|
@@ -2425,8 +2434,6 @@ class AdminControllerCore extends Controller
|
|
|
|
|
$having_clause .= $this->_having.' ';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->_listsql = '
|
|
|
|
|
SELECT SQL_CALC_FOUND_ROWS
|
|
|
|
|
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '');
|
|
|
|
@@ -2611,7 +2618,12 @@ class AdminControllerCore extends Controller
|
|
|
|
|
$class_name = $this->className;
|
|
|
|
|
|
|
|
|
|
$object = new $class_name();
|
|
|
|
|
$definition = ObjectModel::getDefinition($class_name);
|
|
|
|
|
|
|
|
|
|
if (method_exists($this, 'getValidationRules'))
|
|
|
|
|
$definition = $this->getValidationRules();
|
|
|
|
|
else
|
|
|
|
|
$definition = ObjectModel::getDefinition($class_name);
|
|
|
|
|
|
|
|
|
|
$default_language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
|
|
|
|
|
|
|
|
|
foreach ($definition['fields'] as $field => $def)
|
|
|
|
@@ -2643,8 +2655,27 @@ class AdminControllerCore extends Controller
|
|
|
|
|
$this->errors[$field] = $error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Overload this method for custom checking */
|
|
|
|
|
$this->_childValidation();
|
|
|
|
|
|
|
|
|
|
/* Checking for multilingual fields validity */
|
|
|
|
|
if (isset($rules['validateLang']) && is_array($rules['validateLang']))
|
|
|
|
|
foreach ($rules['validateLang'] as $field_lang => $function)
|
|
|
|
|
foreach ($languages as $language)
|
|
|
|
|
if (($value = Tools::getValue($field_lang.'_'.$language['id_lang'])) !== false && !empty($value))
|
|
|
|
|
{
|
|
|
|
|
if (Tools::strtolower($function) == 'iscleanhtml' && Configuration::get('PS_ALLOW_HTML_IFRAME'))
|
|
|
|
|
$res = Validate::$function($value, true);
|
|
|
|
|
else
|
|
|
|
|
$res = Validate::$function($value);
|
|
|
|
|
if (!$res)
|
|
|
|
|
$this->errors[$field_lang.'_'.$language['id_lang']] = sprintf(
|
|
|
|
|
Tools::displayError('The %1$s field (%2$s) is invalid.'),
|
|
|
|
|
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
|
|
|
|
$language['name']
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -2921,7 +2952,7 @@ class AdminControllerCore extends Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($delete_ok)
|
|
|
|
|
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$to_delete->id, true, (int)$this->context->employee->id);
|
|
|
|
|
Logger::addLog(sprintf($this->l('%s deletion', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$to_delete->id, true, (int)$this->context->employee->id);
|
|
|
|
|
else
|
|
|
|
|
$this->errors[] = sprintf(Tools::displayError('Can\'t delete #%d'), $id);
|
|
|
|
|
}
|
|
|
|
|