// Refactor AdminController::_errors to errors
This commit is contained in:
+65
-67
@@ -92,7 +92,7 @@ class AdminControllerCore extends Controller
|
||||
public $fields_value = false;
|
||||
|
||||
/** @var array Errors displayed after post processing */
|
||||
public $_errors = array();
|
||||
public $errors = array();
|
||||
|
||||
/** @var define if the header of the list contains filter and sorting links or not */
|
||||
protected $list_simple_header;
|
||||
@@ -424,7 +424,7 @@ class AdminControllerCore extends Controller
|
||||
if (isset($value[0]) && !empty($value[0]))
|
||||
{
|
||||
if (!Validate::isDate($value[0]))
|
||||
$this->_errors[] = Tools::displayError('\'from:\' date format is invalid (YYYY-MM-DD)');
|
||||
$this->errors[] = Tools::displayError('\'from:\' date format is invalid (YYYY-MM-DD)');
|
||||
else
|
||||
$sql_filter .= ' AND '.pSQL($key).' >= \''.pSQL(Tools::dateFrom($value[0])).'\'';
|
||||
}
|
||||
@@ -432,7 +432,7 @@ class AdminControllerCore extends Controller
|
||||
if (isset($value[1]) && !empty($value[1]))
|
||||
{
|
||||
if (!Validate::isDate($value[1]))
|
||||
$this->_errors[] = Tools::displayError('\'to:\' date format is invalid (YYYY-MM-DD)');
|
||||
$this->errors[] = Tools::displayError('\'to:\' date format is invalid (YYYY-MM-DD)');
|
||||
else
|
||||
$sql_filter .= ' AND '.pSQL($key).' <= \''.pSQL(Tools::dateTo($value[1])).'\'';
|
||||
}
|
||||
@@ -532,7 +532,7 @@ class AdminControllerCore extends Controller
|
||||
$this->content = 'ok';
|
||||
}
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred during image deletion (cannot load object).');
|
||||
$this->errors[] = Tools::displayError('An error occurred during image deletion (cannot load object).');
|
||||
return $object;
|
||||
}
|
||||
|
||||
@@ -549,12 +549,12 @@ class AdminControllerCore extends Controller
|
||||
// check if request at least one object with noZeroObject
|
||||
if (isset($object->noZeroObject) && count(call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').
|
||||
$this->errors[] = Tools::displayError('You need at least one object.').
|
||||
' <b>'.$this->table.'</b><br />'.
|
||||
Tools::displayError('You cannot delete all of the items.');
|
||||
}
|
||||
else if (array_key_exists('delete', $this->list_skip_actions) && in_array($object->id, $this->list_skip_actions['delete'])) //check if some ids are in list_skip_actions and forbid deletion
|
||||
$this->_errors[] = Tools::displayError('You cannot delete this items.');
|
||||
$this->errors[] = Tools::displayError('You cannot delete this items.');
|
||||
else
|
||||
{
|
||||
if ($this->deleted)
|
||||
@@ -563,7 +563,7 @@ class AdminControllerCore extends Controller
|
||||
$res = $object->deleteImage();
|
||||
|
||||
if (!$res)
|
||||
$this->_errors[] = Tools::displayError('Unable to delete associated images');
|
||||
$this->errors[] = Tools::displayError('Unable to delete associated images');
|
||||
|
||||
$object->deleted = 1;
|
||||
if ($object->update())
|
||||
@@ -575,12 +575,12 @@ class AdminControllerCore extends Controller
|
||||
$object->cleanPositions();
|
||||
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$token;
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').
|
||||
' <b>'.$this->table.'</b> '.
|
||||
Tools::displayError('(cannot load object)');
|
||||
}
|
||||
@@ -611,7 +611,7 @@ class AdminControllerCore extends Controller
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
|
||||
if (count($this->_errors) <= 0)
|
||||
if (count($this->errors) <= 0)
|
||||
{
|
||||
$object = new $this->className();
|
||||
|
||||
@@ -619,11 +619,11 @@ class AdminControllerCore extends Controller
|
||||
$this->beforeAdd($object);
|
||||
if (method_exists($object, 'add') && !$object->add())
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating object.').
|
||||
' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
}
|
||||
/* voluntary do affectation here */
|
||||
else if (($_POST[$this->identifier] = $object->id) && $this->postImage($object->id) && !count($this->_errors) && $this->_redirect)
|
||||
else if (($_POST[$this->identifier] = $object->id) && $this->postImage($object->id) && !count($this->errors) && $this->_redirect)
|
||||
{
|
||||
$parent_id = (int)Tools::getValue('id_parent', 1);
|
||||
$this->afterAdd($object);
|
||||
@@ -640,8 +640,8 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$this->_errors = array_unique($this->_errors);
|
||||
if (count($this->_errors) > 0) {
|
||||
$this->errors = array_unique($this->errors);
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ class AdminControllerCore extends Controller
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
|
||||
if (count($this->_errors) <= 0)
|
||||
if (count($this->errors) <= 0)
|
||||
{
|
||||
$id = (int)Tools::getValue($this->identifier);
|
||||
|
||||
@@ -700,10 +700,10 @@ class AdminControllerCore extends Controller
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').
|
||||
' <b>'.$this->table.'</b> ('.Db::getInstance()->getMsgError().')';
|
||||
}
|
||||
else if ($this->postImage($object->id) && !count($this->_errors))
|
||||
else if ($this->postImage($object->id) && !count($this->errors))
|
||||
{
|
||||
$parent_id = (int)Tools::getValue('id_parent', 1);
|
||||
// Specific back redirect
|
||||
@@ -726,12 +726,12 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').
|
||||
' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
}
|
||||
$this->_errors = array_unique($this->_errors);
|
||||
if (count($this->_errors) > 0)
|
||||
$this->errors = array_unique($this->errors);
|
||||
if (count($this->errors) > 0)
|
||||
return;
|
||||
if (isset($object))
|
||||
return $object;
|
||||
@@ -750,7 +750,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$object = new $this->className();
|
||||
if (!$object->addFieldsRequiredDatabase($fields))
|
||||
$this->_errors[] = Tools::displayError('Error in updating required fields');
|
||||
$this->errors[] = Tools::displayError('Error in updating required fields');
|
||||
else
|
||||
$this->redirect_after = self::$currentIndex.'&conf=4&token='.$token;
|
||||
|
||||
@@ -772,10 +772,10 @@ class AdminControllerCore extends Controller
|
||||
$this->redirect_after = self::$currentIndex.'&conf=5'.$id_category.'&token='.$token;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').
|
||||
' <b>'.$this->table.'</b> '.
|
||||
Tools::displayError('(cannot load object)');
|
||||
|
||||
@@ -791,11 +791,11 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
if (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').
|
||||
' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
$this->errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
{
|
||||
$id_identifier_str = ($id_identifier = (int)Tools::getValue($this->identifier)) ? '&'.$this->identifier.'='.$id_identifier : '';
|
||||
@@ -887,10 +887,10 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
foreach ($languages as $language)
|
||||
if (($value = Tools::getValue($field.'_'.$language['id_lang'])) == false && (string)$value != '0')
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
|
||||
}
|
||||
else if (($value = Tools::getValue($field)) == false && (string)$value != '0')
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
|
||||
|
||||
// Check field validator
|
||||
if (isset($values['type']) && $values['type'] == 'textLang')
|
||||
@@ -898,18 +898,18 @@ class AdminControllerCore extends Controller
|
||||
foreach ($languages as $language)
|
||||
if (Tools::getValue($field.'_'.$language['id_lang']) && isset($values['validation']))
|
||||
if (!Validate::$values['validation'](Tools::getValue($field.'_'.$language['id_lang'])))
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is invalid.');
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is invalid.');
|
||||
}
|
||||
else if (Tools::getValue($field) && isset($values['validation']))
|
||||
if (!Validate::$values['validation'](Tools::getValue($field)))
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is invalid.');
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is invalid.');
|
||||
|
||||
// Set default value
|
||||
if (!Tools::getValue($field) && isset($values['default']))
|
||||
$_POST[$field] = $values['default'];
|
||||
}
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
foreach ($fields as $key => $options)
|
||||
{
|
||||
@@ -938,7 +938,7 @@ class AdminControllerCore extends Controller
|
||||
if (Validate::isCleanHtml($val))
|
||||
$list[$language['id_lang']] = $val;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Can not add configuration '.$key.' for lang '.Language::getIsoById((int)$language['id_lang']));
|
||||
$this->errors[] = Tools::displayError('Can not add configuration '.$key.' for lang '.Language::getIsoById((int)$language['id_lang']));
|
||||
}
|
||||
}
|
||||
Configuration::updateValue($key, $list);
|
||||
@@ -951,17 +951,17 @@ class AdminControllerCore extends Controller
|
||||
if (Validate::isCleanHtml($val))
|
||||
Configuration::updateValue($key, $val);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Can not add configuration '.$key);
|
||||
$this->errors[] = Tools::displayError('Can not add configuration '.$key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($this->_errors) <= 0)
|
||||
if (count($this->errors) <= 0)
|
||||
$this->redirect_after = self::$currentIndex.'&conf=6&token='.$token;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
|
||||
// todo : return value ?
|
||||
}
|
||||
@@ -1030,7 +1030,7 @@ class AdminControllerCore extends Controller
|
||||
if (Validate::isLoadedObject($this->object))
|
||||
return $this->object;
|
||||
// throw exception
|
||||
$this->_errors[] = Tools::displayError('Object cannot be loaded (not found)');
|
||||
$this->errors[] = Tools::displayError('Object cannot be loaded (not found)');
|
||||
return false;
|
||||
}
|
||||
else if ($opt)
|
||||
@@ -1040,7 +1040,7 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Object cannot be loaded (identifier missing or invalid)');
|
||||
$this->errors[] = Tools::displayError('Object cannot be loaded (identifier missing or invalid)');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1107,8 +1107,6 @@ class AdminControllerCore extends Controller
|
||||
$this->context->smarty->assign('display_footer', $this->display_footer);
|
||||
$this->context->smarty->assign('meta_title', $this->meta_title);
|
||||
|
||||
// Template override
|
||||
$tpl = $this->tpl_folder.'content.tpl';
|
||||
$tpl_action = $this->tpl_folder.$this->display.'.tpl';
|
||||
|
||||
// Check if action template has been override
|
||||
@@ -1138,9 +1136,9 @@ class AdminControllerCore extends Controller
|
||||
|
||||
|
||||
if ($this->json)
|
||||
$this->context->smarty->assign('errors', Tools::jsonEncode($this->_errors));
|
||||
$this->context->smarty->assign('errors', Tools::jsonEncode($this->errors));
|
||||
else
|
||||
$this->context->smarty->assign('errors', $this->_errors);
|
||||
$this->context->smarty->assign('errors', $this->errors);
|
||||
|
||||
if ($this->json)
|
||||
$this->context->smarty->assign('warnings', Tools::jsonEncode($this->warnings));
|
||||
@@ -1802,7 +1800,7 @@ class AdminControllerCore extends Controller
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
$this->action = 'delete_image';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
/* Delete object */
|
||||
else if (isset($_GET['delete'.$this->table]))
|
||||
@@ -1810,7 +1808,7 @@ class AdminControllerCore extends Controller
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
$this->action = 'delete';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
/* Change object statuts (active, inactive) */
|
||||
else if ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
|
||||
@@ -1818,7 +1816,7 @@ class AdminControllerCore extends Controller
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->action = 'status';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
/* Move an object */
|
||||
else if (isset($_GET['position']))
|
||||
@@ -1826,7 +1824,7 @@ class AdminControllerCore extends Controller
|
||||
if ($this->tabAccess['edit'] == '1')
|
||||
$this->action = 'position';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if ($submitted_action = Tools::getValue('submitAction'.$this->table))
|
||||
$this->action = $submitted_action;
|
||||
@@ -1843,7 +1841,7 @@ class AdminControllerCore extends Controller
|
||||
$this->display = 'edit';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
// case 2: creating new entry
|
||||
else
|
||||
@@ -1854,7 +1852,7 @@ class AdminControllerCore extends Controller
|
||||
$this->display = 'edit';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
}
|
||||
else if (isset($_GET['add'.$this->table]))
|
||||
@@ -1865,14 +1863,14 @@ class AdminControllerCore extends Controller
|
||||
$this->display = 'add';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
else if (isset($_GET['update'.$this->table]) && isset($_GET['id_'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->display = 'edit';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (isset($_GET['view'.$this->table]))
|
||||
{
|
||||
@@ -1882,7 +1880,7 @@ class AdminControllerCore extends Controller
|
||||
$this->action = 'view';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to view here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to view here.');
|
||||
}
|
||||
/* Cancel all filters for this tab */
|
||||
else if (isset($_POST['submitReset'.$this->table]))
|
||||
@@ -2156,21 +2154,21 @@ class AdminControllerCore extends Controller
|
||||
foreach ($rules['required'] as $field)
|
||||
if (($value = Tools::getValue($field)) == false && (string)$value != '0')
|
||||
if (!Tools::getValue($this->identifier) || ($field != 'passwd' && $field != 'no-picture'))
|
||||
$this->_errors[] = $this->l('the field').
|
||||
$this->errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), $field, $class_name).'</b> '.
|
||||
$this->l('is required');
|
||||
|
||||
/* Checking for multilingual required fields */
|
||||
foreach ($rules['requiredLang'] as $field_lang)
|
||||
if (($empty = Tools::getValue($field_lang.'_'.$default_language->id)) === false || $empty !== '0' && empty($empty))
|
||||
$this->_errors[] = $this->l('the field').
|
||||
$this->errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name).'</b> '.
|
||||
$this->l('is required at least in').' '.$default_language->name;
|
||||
|
||||
/* Checking for maximum fields sizes */
|
||||
foreach ($rules['size'] as $field => $max_length)
|
||||
if (Tools::getValue($field) !== false && Tools::strlen(Tools::getValue($field)) > $max_length)
|
||||
$this->_errors[] = $this->l('the field').
|
||||
$this->errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), $field, $class_name).'</b> '.
|
||||
$this->l('is too long').' ('.$max_length.' '.$this->l('chars max').')';
|
||||
|
||||
@@ -2180,7 +2178,7 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
$field_lang = Tools::getValue($field_lang.'_'.$language['id_lang']);
|
||||
if ($field_lang !== false && Tools::strlen($field_lang) > $max_length)
|
||||
$this->_errors[] = $this->l('the field').
|
||||
$this->errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name).' ('.$language['name'].')</b> '.
|
||||
$this->l('is too long').' ('.$max_length.' '.$this->l('chars max, html chars including').')';
|
||||
}
|
||||
@@ -2191,7 +2189,7 @@ class AdminControllerCore extends Controller
|
||||
foreach ($rules['validate'] as $field => $function)
|
||||
if (($value = Tools::getValue($field)) !== false && ($field != 'passwd'))
|
||||
if (!Validate::$function($value) && !empty($value))
|
||||
$this->_errors[] = $this->l('the field').
|
||||
$this->errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), $field, $class_name).'</b> '.
|
||||
$this->l('is invalid');
|
||||
|
||||
@@ -2199,11 +2197,11 @@ class AdminControllerCore extends Controller
|
||||
if (($value = Tools::getValue('passwd')) != false)
|
||||
{
|
||||
if ($class_name == 'Employee' && !Validate::isPasswdAdmin($value))
|
||||
$this->_errors[] = $this->l('the field').
|
||||
$this->errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name).'</b> '.
|
||||
$this->l('is invalid');
|
||||
else if ($class_name == 'Customer' && !Validate::isPasswd($value))
|
||||
$this->_errors[] = $this->l('the field').
|
||||
$this->errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name).
|
||||
'</b> '.$this->l('is invalid');
|
||||
}
|
||||
@@ -2213,7 +2211,7 @@ class AdminControllerCore extends Controller
|
||||
foreach ($languages as $language)
|
||||
if (($value = Tools::getValue($field_lang.'_'.$language['id_lang'])) !== false && !empty($value))
|
||||
if (!Validate::$function($value))
|
||||
$this->_errors[] = $this->l('the field').
|
||||
$this->errors[] = $this->l('the field').
|
||||
' <b>'.call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name).' ('.$language['name'].')</b> '.
|
||||
$this->l('is invalid');
|
||||
}
|
||||
@@ -2368,7 +2366,7 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
if (!Validate::$field['validation']($value))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError($field['title'].' : Incorrect value');
|
||||
$this->errors[] = Tools::displayError($field['title'].' : Incorrect value');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2398,7 +2396,7 @@ class AdminControllerCore extends Controller
|
||||
foreach ($this->fieldImageSettings as $image)
|
||||
if (isset($image['name']) && isset($image['dir']))
|
||||
$this->uploadImage($id, $image['name'], $image['dir'].'/');
|
||||
return !count($this->_errors) ? true : false;
|
||||
return !count($this->errors) ? true : false;
|
||||
}
|
||||
|
||||
protected function uploadImage($id, $name, $dir, $ext = false, $width = null, $height = null)
|
||||
@@ -2414,7 +2412,7 @@ class AdminControllerCore extends Controller
|
||||
// Check image validity
|
||||
$max_size = isset($this->max_image_size) ? $this->max_image_size : 0;
|
||||
if ($error = checkImage($_FILES[$name], Tools::getMaxUploadSize($max_size)))
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
else if (!$tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES[$name]['tmp_name'], $tmp_name))
|
||||
return false;
|
||||
else
|
||||
@@ -2422,8 +2420,8 @@ class AdminControllerCore extends Controller
|
||||
$tmp_name = $_FILES[$name]['tmp_name'];
|
||||
// Copy new image
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.$dir.$id.'.'.$this->imageType, (int)$width, (int)$height, ($ext ? $ext : $this->imageType)))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while uploading image.');
|
||||
if (count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('An error occurred while uploading image.');
|
||||
if (count($this->errors))
|
||||
return false;
|
||||
if ($this->afterImageUpload())
|
||||
{
|
||||
@@ -2453,7 +2451,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
// Check if all object will be deleted
|
||||
if ($objects_count <= 1 || count($this->boxes) == $objects_count)
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').
|
||||
$this->errors[] = Tools::displayError('You need at least one object.').
|
||||
' <b>'.$this->table.'</b><br />'.
|
||||
Tools::displayError('You cannot delete all of the items.');
|
||||
}
|
||||
@@ -2474,11 +2472,11 @@ class AdminControllerCore extends Controller
|
||||
|
||||
if ($result)
|
||||
$this->redirect_after = self::$currentIndex.'&conf=2&token='.$token;
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
$this->errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -2492,10 +2490,10 @@ class AdminControllerCore extends Controller
|
||||
|
||||
if ($result)
|
||||
$this->redirect_after = self::$currentIndex.'&conf=28&token='.$token;
|
||||
$this->_errors[] = Tools::displayError('An error occurred while affecting a zone to the selection.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while affecting a zone to the selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to affect a new zone.');
|
||||
$this->errors[] = Tools::displayError('You must select at least one element to affect a new zone.');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -135,9 +135,9 @@ class AdminAccountingExportControllerCore extends AdminController
|
||||
private function checkRights()
|
||||
{
|
||||
if (!is_writeable($this->downloadDir))
|
||||
$this->_errors[] = $this->l('The download folder doesn\'t have the sufficient right…');
|
||||
$this->errors[] = $this->l('The download folder doesn\'t have the sufficient right…');
|
||||
if (!($this->fd = fopen($this->downloadFile, 'w+')))
|
||||
$this->_errors[] = $this->l('The file can\'t be opened or created, please check the right');
|
||||
$this->errors[] = $this->l('The file can\'t be opened or created, please check the right');
|
||||
@chmod($this->downloadFile, 0777);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class AdminAccountingExportControllerCore extends AdminController
|
||||
{
|
||||
$this->checkRights();
|
||||
|
||||
if (!count($this->_errors) && $this->fd !== NULL)
|
||||
if (!count($this->errors) && $this->fd !== NULL)
|
||||
{
|
||||
$buffer = '';
|
||||
foreach($this->exportTypeList[$this->exportSelected]['fields'] as $key => $translation)
|
||||
|
||||
@@ -130,7 +130,7 @@ class AdminAccountingManagementControllerCore extends AdminController
|
||||
if (count($tab) && Accounting::setAccountNumberByZoneShop($tab))
|
||||
$this->confirmations[] = $this->l('Account numbers have been updated');
|
||||
else
|
||||
$this->_errors[] = $this->l('Account Numbers could not be updated or added in the database');
|
||||
$this->errors[] = $this->l('Account Numbers could not be updated or added in the database');
|
||||
//$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
//Tools::redirectAdmin(self::$currentIndex.'&token='.$token);
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($customer))
|
||||
$_POST['id_customer'] = $customer->id;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('This e-mail address is not registered.');
|
||||
$this->errors[] = Tools::displayError('This e-mail address is not registered.');
|
||||
}
|
||||
else if ($id_customer = Tools::getValue('id_customer'))
|
||||
{
|
||||
@@ -305,23 +305,23 @@ class AdminAddressesControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($customer))
|
||||
$_POST['id_customer'] = $customer->id;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unknown customer');
|
||||
$this->errors[] = Tools::displayError('Unknown customer');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unknown customer');
|
||||
$this->errors[] = Tools::displayError('Unknown customer');
|
||||
if (Country::isNeedDniByCountryId(Tools::getValue('id_country')) && !Tools::getValue('dni'))
|
||||
$this->_errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
|
||||
$this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
|
||||
|
||||
/* If the selected country does not contain states */
|
||||
$id_state = (int)Tools::getValue('id_state');
|
||||
$id_country = (int)Tools::getValue('id_country');
|
||||
$country = new Country((int)$id_country);
|
||||
if ($country && !(int)$country->contains_states && $id_state)
|
||||
$this->_errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
||||
$this->errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
||||
|
||||
/* If the selected country contains states, then a state have to be selected */
|
||||
if ((int)$country->contains_states && !$id_state)
|
||||
$this->_errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
||||
$this->errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
||||
|
||||
/* Check zip code */
|
||||
if ($country->need_zip_code)
|
||||
@@ -336,14 +336,14 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$zip_regexp = str_replace('L', '[a-zA-Z]', $zip_regexp);
|
||||
$zip_regexp = str_replace('C', $country->iso_code, $zip_regexp);
|
||||
if (!preg_match($zip_regexp, $postcode))
|
||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.').'<br />'.
|
||||
$this->errors[] = Tools::displayError('Your zip/postal code is incorrect.').'<br />'.
|
||||
Tools::displayError('Must be typed as follows:').' '.
|
||||
str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format)));
|
||||
}
|
||||
else if ($zip_code_format)
|
||||
$this->_errors[] = Tools::displayError('Postcode required.');
|
||||
$this->errors[] = Tools::displayError('Postcode required.');
|
||||
else if ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
||||
$this->errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
||||
}
|
||||
|
||||
/* If this address come from order's edition and is the same as the other one (invoice or delivery one)
|
||||
@@ -355,15 +355,15 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$_POST['id_address'] = '';
|
||||
}
|
||||
|
||||
if (empty($this->_errors))
|
||||
if (empty($this->errors))
|
||||
parent::processSave($token);
|
||||
|
||||
/* Reassignation of the order's new (invoice or delivery) address */
|
||||
$address_type = ((int)Tools::getValue('address_type') == 2 ? 'invoice' : ((int)Tools::getValue('address_type') == 1 ? 'delivery' : ''));
|
||||
if ($this->action == 'save' && ($id_order = (int)Tools::getValue('id_order')) && !count($this->_errors) && !empty($address_type))
|
||||
if ($this->action == 'save' && ($id_order = (int)Tools::getValue('id_order')) && !count($this->errors) && !empty($address_type))
|
||||
{
|
||||
if (!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET `id_address_'.$address_type.'` = '.Db::getInstance()->Insert_ID().' WHERE `id_order` = '.$id_order))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while linking this address to its order.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while linking this address to its order.');
|
||||
else
|
||||
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
|
||||
}
|
||||
|
||||
@@ -100,14 +100,14 @@ class AdminAliasesControllerCore extends AdminController
|
||||
$string = strval(Tools::getValue('alias'));
|
||||
$aliases = explode(',', $string);
|
||||
if (empty($search) || empty($string))
|
||||
$this->_errors[] = $this->l('aliases and result are both required');
|
||||
$this->errors[] = $this->l('aliases and result are both required');
|
||||
if (!Validate::isValidSearch($search))
|
||||
$this->_errors[] = $search.' '.$this->l('is not a valid result');
|
||||
$this->errors[] = $search.' '.$this->l('is not a valid result');
|
||||
foreach ($aliases as $alias)
|
||||
if (!Validate::isValidSearch($alias))
|
||||
$this->_errors[] = $alias.' '.$this->l('is not a valid alias');
|
||||
$this->errors[] = $alias.' '.$this->l('is not a valid alias');
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
foreach ($aliases as $alias)
|
||||
{
|
||||
|
||||
@@ -129,7 +129,7 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
@@ -141,12 +141,12 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
$_POST['file'] = $a->file;
|
||||
$_POST['mime'] = $a->mime;
|
||||
}
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (isset($_FILES['file']) && is_uploaded_file($_FILES['file']['tmp_name']))
|
||||
{
|
||||
if ($_FILES['file']['size'] > (Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 * 1024))
|
||||
$this->_errors[] = $this->l('File too large, maximum size allowed:').' '.
|
||||
$this->errors[] = $this->l('File too large, maximum size allowed:').' '.
|
||||
(Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024).' '.$this->l('kb').'. '.
|
||||
$this->l('File size you\'re trying to upload is:').number_format(($_FILES['file']['size'] / 1024), 2, '.', '').$this->l('kb');
|
||||
else
|
||||
@@ -154,7 +154,7 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
do $uniqid = sha1(microtime());
|
||||
while (file_exists(_PS_DOWNLOAD_DIR_.$uniqid));
|
||||
if (!copy($_FILES['file']['tmp_name'], _PS_DOWNLOAD_DIR_.$uniqid))
|
||||
$this->_errors[] = $this->l('File copy failed');
|
||||
$this->errors[] = $this->l('File copy failed');
|
||||
$_POST['file_name'] = $_FILES['file']['name'];
|
||||
@unlink($_FILES['file']['tmp_name']);
|
||||
$_POST['file'] = $uniqid;
|
||||
@@ -166,11 +166,11 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
$max_upload = (int)ini_get('upload_max_filesize');
|
||||
$max_post = (int)ini_get('post_max_size');
|
||||
$upload_mb = min($max_upload, $max_post);
|
||||
$this->_errors[] = $this->l('the File').' <b>'.$_FILES['file']['name'].'</b> '.
|
||||
$this->errors[] = $this->l('the File').' <b>'.$_FILES['file']['name'].'</b> '.
|
||||
$this->l('exceeds the size allowed by the server. This limit is set to').' <b>'.$upload_mb.$this->l('Mb').'</b>';
|
||||
}
|
||||
else if (!empty($_FILES['file']['tmp_name']))
|
||||
$this->_errors[] = $this->l('No file or your file isn\'t uploadable, check your server configuration about the upload maximum size.');
|
||||
$this->errors[] = $this->l('No file or your file isn\'t uploadable, check your server configuration about the upload maximum size.');
|
||||
}
|
||||
$this->validateRules();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
if (isset($_POST['generate']))
|
||||
{
|
||||
if (!is_array(Tools::getValue('options')))
|
||||
$this->_errors[] = Tools::displayError('Please choose at least 1 attribute.');
|
||||
$this->errors[] = Tools::displayError('Please choose at least 1 attribute.');
|
||||
else
|
||||
{
|
||||
$tab = array_values($_POST['options']);
|
||||
@@ -117,7 +117,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)Tools::getValue('id_product').'&addproduct&action=Combinations');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unable to initialize parameters, combination is missing or object cannot be loaded.');
|
||||
$this->errors[] = Tools::displayError('Unable to initialize parameters, combination is missing or object cannot be loaded.');
|
||||
}
|
||||
}
|
||||
else if (isset($_POST['back']))
|
||||
@@ -231,7 +231,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'tax_rates' => $this->product->getTaxesRate(),
|
||||
'generate' => isset($_POST['generate']) && !count($this->_errors),
|
||||
'generate' => isset($_POST['generate']) && !count($this->errors),
|
||||
'combinations_size' => count($this->combinations),
|
||||
'product_name' => $this->product->name[$this->context->language->id],
|
||||
'product_reference' => $this->product->reference,
|
||||
|
||||
@@ -89,7 +89,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
$this->lang = true;
|
||||
|
||||
if (!Validate::isLoadedObject($obj = new AttributeGroup((int)$id)))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_attribute' => array(
|
||||
@@ -508,22 +508,22 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
$this->identifier = 'id_attribute';
|
||||
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
else if (!$object = new Attribute((int)Tools::getValue($this->identifier)))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
|
||||
if (Tools::getValue('position') && Tools::getValue('id_attribute'))
|
||||
{
|
||||
$_POST['id_attribute_group'] = $object->id_attribute_group;
|
||||
if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
$this->errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.Tools::getAdminTokenLite('AdminAttributesGroups'));
|
||||
}
|
||||
else if (Tools::isSubmit('deleteattribute') && Tools::getValue('id_attribute'))
|
||||
{
|
||||
if (!$object->delete())
|
||||
$this->_errors[] = Tools::displayError('Failed to delete attribute.');
|
||||
$this->errors[] = Tools::displayError('Failed to delete attribute.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getAdminTokenLite('AdminAttributesGroups'));
|
||||
}
|
||||
@@ -559,13 +559,13 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
$object = new $this->className();
|
||||
if ($object->deleteSelection($_POST[$this->table.'Box']))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=2'.'&token='.$this->token);
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
$this->errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
// clean position after delete
|
||||
AttributeGroup::cleanPositions();
|
||||
}
|
||||
|
||||
@@ -82,12 +82,12 @@ class AdminBackupControllerCore extends AdminController
|
||||
public function renderView()
|
||||
{
|
||||
if (!($object = $this->loadObject()))
|
||||
$this->_errors[] = Tools::displayError('The object could not be loaded.');
|
||||
$this->errors[] = Tools::displayError('The object could not be loaded.');
|
||||
|
||||
if ($object->id)
|
||||
$this->tpl_view_vars = array('url_backup' => $object->getBackupURL());
|
||||
else if ($object->error)
|
||||
$this->_errors[] = $object->error;
|
||||
$this->errors[] = $object->error;
|
||||
|
||||
return parent::renderView();
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class AdminBackupControllerCore extends AdminController
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
@@ -156,7 +156,7 @@ class AdminBackupControllerCore extends AdminController
|
||||
if (($object = $this->loadObject()))
|
||||
{
|
||||
if (!$object->add())
|
||||
$this->_errors[] = $object->error;
|
||||
$this->errors[] = $object->error;
|
||||
else
|
||||
$this->context->smarty->assign(array(
|
||||
'conf' => $this->l('It appears that the Backup was successful, however, you must download and carefully verify the Backup file.'),
|
||||
@@ -218,7 +218,7 @@ class AdminBackupControllerCore extends AdminController
|
||||
$dh = @opendir(_PS_ADMIN_DIR_.'/backups/');
|
||||
if ($dh === false)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Unable to open backup directory .').addslashes(_PS_ADMIN_DIR_.'/backups/').'"';
|
||||
$this->errors[] = Tools::displayError('Unable to open backup directory .').addslashes(_PS_ADMIN_DIR_.'/backups/').'"';
|
||||
return;
|
||||
}
|
||||
while (($file = readdir($dh)) !== false)
|
||||
|
||||
@@ -451,7 +451,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
{
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$id = (int)Tools::getValue('id_'.$this->table);
|
||||
|
||||
@@ -481,7 +481,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
}
|
||||
$this->changeGroups($object_new->id);
|
||||
if (!$result)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b>';
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b>';
|
||||
else if ($this->postImage($object_new->id))
|
||||
{
|
||||
$this->changeZones($object_new->id);
|
||||
@@ -489,11 +489,11 @@ class AdminCarriersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.
|
||||
$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
/* Object creation */
|
||||
@@ -505,7 +505,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
$this->copyFromPost($object, $this->table);
|
||||
$object->position = Carrier::getHigherPosition() + 1;
|
||||
if (!$object->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
else if (($_POST['id_'.$this->table] = $object->id /* voluntary */) && $this->postImage($object->id) && $this->_redirect)
|
||||
{
|
||||
$this->changeZones($object->id);
|
||||
@@ -515,7 +515,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,18 +524,18 @@ class AdminCarriersControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (Tools::getValue('id_carrier') == Configuration::get('PS_CARRIER_DEFAULT'))
|
||||
$this->_errors[] = Tools::displayError('You can\'t disable the default carrier, please change your default carrier first.');
|
||||
$this->errors[] = Tools::displayError('You can\'t disable the default carrier, please change your default carrier first.');
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
|
||||
|| (isset($_GET['delete'.$this->table]) && Tools::getValue('id_carrier') == Configuration::get('PS_CARRIER_DEFAULT')))
|
||||
$this->_errors[] = $this->l('Please set another carrier as default before deleting');
|
||||
$this->errors[] = $this->l('Please set another carrier as default before deleting');
|
||||
else
|
||||
{
|
||||
// if deletion : removes the carrier from the warehouse/carrier association
|
||||
|
||||
@@ -60,13 +60,13 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
|
||||
// Idiot-proof control
|
||||
if (strtotime(Tools::getValue('date_from')) > strtotime(Tools::getValue('date_to')))
|
||||
$this->_errors[] = Tools::displayError('The voucher cannot end before it begins');
|
||||
$this->errors[] = Tools::displayError('The voucher cannot end before it begins');
|
||||
if ((int)Tools::getValue('minimum_amount') < 0)
|
||||
$this->_errors[] = Tools::displayError('Minimum amount cannot be lower than 0');
|
||||
$this->errors[] = Tools::displayError('Minimum amount cannot be lower than 0');
|
||||
if ((float)Tools::getValue('reduction_percent') < 0 || (float)Tools::getValue('reduction_percent') > 100)
|
||||
$this->_errors[] = Tools::displayError('Reduction percent must range from 0% to 100%');
|
||||
$this->errors[] = Tools::displayError('Reduction percent must range from 0% to 100%');
|
||||
if ((int)Tools::getValue('reduction_amount') < 0)
|
||||
$this->_errors[] = Tools::displayError('Reduction amount cannot be lower than 0');
|
||||
$this->errors[] = Tools::displayError('Reduction amount cannot be lower than 0');
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
|
||||
@@ -431,10 +431,10 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
if ($id_category != $id_parent)
|
||||
{
|
||||
if (!Category::checkBeforeMove($id_category, $id_parent))
|
||||
$this->_errors[] = Tools::displayError($this->l('Category cannot be moved here'));
|
||||
$this->errors[] = Tools::displayError($this->l('Category cannot be moved here'));
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError($this->l('Category cannot be parent of herself.'));
|
||||
$this->errors[] = Tools::displayError($this->l('Category cannot be parent of herself.'));
|
||||
}
|
||||
parent::processAdd($token);
|
||||
}
|
||||
@@ -455,10 +455,10 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$category->cleanPositions((int)Tools::getValue('id_category'));
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCategories').'&id_category='.(int)Tools::getValue('id_category'));
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
$this->errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -466,11 +466,11 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
{
|
||||
if ($object->isRootCategoryForAShop())
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You cannot remove this category because a shop uses this category as a root category.');
|
||||
$this->errors[] = Tools::displayError('You cannot remove this category because a shop uses this category as a root category.');
|
||||
}// check if request at least one object with noZeroObject
|
||||
elseif (isset($object->noZeroObject) &&
|
||||
count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.
|
||||
$this->errors[] = Tools::displayError('You need at least one object.').' <b>'.
|
||||
$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
else
|
||||
{
|
||||
@@ -483,27 +483,27 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
}
|
||||
else if ($object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getValue('token').'&id_category='.(int)$object->id_parent);
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.
|
||||
$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
|
||||
public function processPosition($token)
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
else if (!Validate::isLoadedObject($object = new Category((int)Tools::getValue($this->identifier, Tools::getValue('id_category_to_move', 1)))))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.
|
||||
$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
$this->errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
{
|
||||
$object->regenerateEntireNtree();
|
||||
|
||||
@@ -83,7 +83,7 @@ class AdminCmsCategoriesControllerCore extends AdminController
|
||||
{
|
||||
if (!CMSCategory::checkBeforeMove($id_cms_category, (int)(Tools::getValue('id_parent'))))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('CMS Category cannot be moved here');
|
||||
$this->errors[] = Tools::displayError('CMS Category cannot be moved here');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -98,13 +98,13 @@ class AdminCmsCategoriesControllerCore extends AdminController
|
||||
if ($object->toggleStatus())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((int)$object->id_parent ? '&id_cms_category='.(int)$object->id_parent : '').'&token='.Tools::getValue('token'));
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
/* Delete object */
|
||||
elseif (isset($_GET['delete'.$this->table]))
|
||||
@@ -115,7 +115,7 @@ class AdminCmsCategoriesControllerCore extends AdminController
|
||||
{
|
||||
// check if request at least one object with noZeroObject
|
||||
if (isset($object->noZeroObject) AND sizeof($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
$this->errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
else
|
||||
{
|
||||
$this->deleteImage($object->id);
|
||||
@@ -127,23 +127,23 @@ class AdminCmsCategoriesControllerCore extends AdminController
|
||||
}
|
||||
elseif ($object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getValue('token'));
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (isset($_GET['position']))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
elseif (!Validate::isLoadedObject($object = new CMSCategory((int)(Tools::getValue($this->identifier, Tools::getValue('id_cms_category_to_move', 1))))))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
$this->errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_cms_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCmsContent'));
|
||||
}
|
||||
@@ -162,14 +162,14 @@ class AdminCmsCategoriesControllerCore extends AdminController
|
||||
$cms_category->cleanPositions((int)(Tools::getValue('id_cms_category')));
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCmsContent').'&id_category='.(int)(Tools::getValue('id_cms_category')));
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
$this->errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
parent::postProcess(true);
|
||||
}
|
||||
|
||||
@@ -108,11 +108,11 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (((Tools::isSubmit('submitAddcms_category') || Tools::isSubmit('submitAddcms_categoryAndStay')) && sizeof($this->adminCMSCategories->_errors))
|
||||
if (((Tools::isSubmit('submitAddcms_category') || Tools::isSubmit('submitAddcms_categoryAndStay')) && sizeof($this->adminCMSCategories->errors))
|
||||
|| isset($_GET['updatecms_category'])
|
||||
|| isset($_GET['addcms_category']))
|
||||
$this->display = 'edit_category';
|
||||
elseif (((Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndStay')) && sizeof($this->adminCMS->_errors))
|
||||
elseif (((Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndStay')) && sizeof($this->adminCMS->errors))
|
||||
|| isset($_GET['updatecms'])
|
||||
|| isset($_GET['addcms']))
|
||||
$this->display = 'edit_page';
|
||||
|
||||
@@ -235,7 +235,7 @@ class AdminCmsControllerCore extends AdminController
|
||||
$cms = new CMS((int)(Tools::getValue('id_cms')));
|
||||
$cms->cleanPositions($cms->id_cms_category);
|
||||
if (!$cms->delete())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=1&token='.Tools::getAdminTokenLite('AdminCmsContent'));
|
||||
}/* Delete multiple objects */
|
||||
@@ -253,26 +253,26 @@ class AdminCmsControllerCore extends AdminController
|
||||
$cms->cleanPositions((int)(Tools::getValue('id_cms_category')));
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCmsContent').'&id_category='.(int)(Tools::getValue('id_cms_category')));
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
$this->errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitAddcms') OR Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
parent::validateRules();
|
||||
if (!sizeof($this->_errors))
|
||||
if (!sizeof($this->errors))
|
||||
{
|
||||
if (!$id_cms = (int)(Tools::getValue('id_cms')))
|
||||
{
|
||||
$cms = new CMS();
|
||||
$this->copyFromPost($cms, 'cms');
|
||||
if (!$cms->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
else
|
||||
$this->updateAssoShop($cms->id);
|
||||
if (Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
@@ -297,7 +297,7 @@ class AdminCmsControllerCore extends AdminController
|
||||
$cms = new CMS($id_cms);
|
||||
$this->copyFromPost($cms, 'cms');
|
||||
if (!$cms->update())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
else
|
||||
$this->updateAssoShop($cms->id);
|
||||
if (Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
@@ -321,11 +321,11 @@ class AdminCmsControllerCore extends AdminController
|
||||
elseif (Tools::getValue('position'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
elseif (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
$this->errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=4'.(($id_category = (int)(Tools::getValue('id_cms_category'))) ? ('&id_cms_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCmsContent'));
|
||||
}
|
||||
@@ -339,13 +339,13 @@ class AdminCmsControllerCore extends AdminController
|
||||
if ($object->toggleStatus())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((int)Tools::getValue('id_cms_category') ? '&id_cms_category='.(int)Tools::getValue('id_cms_category') : '').'&token='.Tools::getValue('token'));
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess(true);
|
||||
|
||||
@@ -109,13 +109,13 @@ class AdminContactControllerCore extends AdminController
|
||||
AND `id_state` = '.(int)Tools::getValue('PS_SHOP_STATE_ID');
|
||||
$isStateOk = Db::getInstance()->getValue($sql);
|
||||
if ($isStateOk != 1)
|
||||
$this->_errors[] = Tools::displayError('This state is not in this country.');
|
||||
$this->errors[] = Tools::displayError('This state is not in this country.');
|
||||
}
|
||||
}
|
||||
|
||||
public function updateOptionPsShopCountryId($value)
|
||||
{
|
||||
if (!$this->_errors && $value)
|
||||
if (!$this->errors && $value)
|
||||
{
|
||||
$country = new Country($value, $this->context->language->id);
|
||||
if ($country->id)
|
||||
@@ -128,7 +128,7 @@ class AdminContactControllerCore extends AdminController
|
||||
|
||||
public function updateOptionPsShopStateId($value)
|
||||
{
|
||||
if (!$this->_errors && $value)
|
||||
if (!$this->errors && $value)
|
||||
{
|
||||
$state = new State($value);
|
||||
if ($state->id)
|
||||
|
||||
@@ -390,11 +390,11 @@ class AdminCountriesControllerCore extends AdminController
|
||||
{
|
||||
$error_list = $tmp_addr_format->getErrorList();
|
||||
foreach ($error_list as $num_error => $error)
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
}
|
||||
|
||||
if (!$save_status)
|
||||
$this->_errors[] = Tools::displayError('Invalid address layout'.Db::getInstance()->getMsgError());
|
||||
$this->errors[] = Tools::displayError('Invalid address layout'.Db::getInstance()->getMsgError());
|
||||
}
|
||||
unset($tmp_addr_format);
|
||||
}
|
||||
|
||||
@@ -257,14 +257,14 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
|
||||
$this->_errors[] = $this->l('You can\'t delete the default currency');
|
||||
$this->errors[] = $this->l('You can\'t delete the default currency');
|
||||
else if ($object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').'
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').'
|
||||
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
|
||||
@@ -277,15 +277,15 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->active && $object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
|
||||
$this->_errors[] = $this->l('You can\'t disable the default currency');
|
||||
$this->errors[] = $this->l('You can\'t disable the default currency');
|
||||
else if ($object->toggleStatus())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((($id_category =
|
||||
(int)Tools::getValue('id_category')) && Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').'
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').'
|
||||
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
*/
|
||||
public function processExchangeRates($token)
|
||||
{
|
||||
if (!$this->_errors[] = Currency::refreshCurrencies())
|
||||
if (!$this->errors[] = Currency::refreshCurrencies())
|
||||
Tools::redirectAdmin(self::$currentIndex . '&conf=6' . '&token=' . $this->token);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->action = 'exchangeRates';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
parent::initProcess();
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = '<div class="alert error">'.Tools::displayError('Email invalid.').'</div>';
|
||||
$this->errors[] = '<div class="alert error">'.Tools::displayError('Email invalid.').'</div>';
|
||||
}
|
||||
if (Tools::isSubmit('submitReply'))
|
||||
{
|
||||
@@ -338,7 +338,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
$cm->message = Tools::htmlentitiesutf8(Tools::nl2br(Tools::getValue('reply_message')));
|
||||
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
|
||||
if (isset($_FILES) && !empty($_FILES['joinFile']['name']) && $_FILES['joinFile']['error'] != 0)
|
||||
$this->_errors[] = Tools::displayError('An error occurred with the file upload.');
|
||||
$this->errors[] = Tools::displayError('An error occurred with the file upload.');
|
||||
else if ($cm->add())
|
||||
{
|
||||
$file_attachment = null;
|
||||
@@ -371,7 +371,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.');
|
||||
$this->errors[] = Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->action = 'guest_to_customer';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
elseif (Tools::isSubmit('changeNewsletterVal') && $this->id_object)
|
||||
$this->action = 'change_newsletter_val';
|
||||
elseif (Tools::isSubmit('changeOptinVal') && $this->id_object)
|
||||
@@ -711,7 +711,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->deleted = true;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Unknown delete mode:'.' '.$this->deleted);
|
||||
$this->errors[] = Tools::displayError('Unknown delete mode:'.' '.$this->deleted);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -729,7 +729,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
if (Validate::isEmail($customer_email))
|
||||
$customer->getByEmail($customer_email);
|
||||
if ($customer->id)
|
||||
$this->_errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
|
||||
$this->errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
|
||||
}
|
||||
// Case update
|
||||
else
|
||||
@@ -745,17 +745,17 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$customer = new Customer();
|
||||
$customer->getByEmail($customer_email);
|
||||
if ($customer->id)
|
||||
$this->_errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
|
||||
$this->errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while loading object.').'
|
||||
$this->errors[] = Tools::displayError('An error occurred while loading object.').'
|
||||
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
|
||||
// Check that default group is selected
|
||||
if (!is_array(Tools::getValue('groupBox')) || !in_array(Tools::getValue('id_default_group'), Tools::getValue('groupBox')))
|
||||
$this->_errors[] = $this->_errors[] = Tools::displayError('Default customer group must be selected in group box.');
|
||||
$this->errors[] = Tools::displayError('Default customer group must be selected in group box.');
|
||||
|
||||
parent::processSave($token);
|
||||
}
|
||||
@@ -781,13 +781,13 @@ class AdminCustomersControllerCore extends AdminController
|
||||
{
|
||||
$customer = new Customer((int)Tools::getValue('id_customer'));
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
$this->_errors[] = Tools::displayError('This customer does not exist.');
|
||||
$this->errors[] = Tools::displayError('This customer does not exist.');
|
||||
if (Customer::customerExists($customer->email))
|
||||
$this->_errors[] = Tools::displayError('This customer already exist as non-guest.');
|
||||
$this->errors[] = Tools::displayError('This customer already exist as non-guest.');
|
||||
else if ($customer->transformToCustomer(Tools::getValue('id_lang', $this->context->language->id)))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$customer->id.'&conf=3&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -799,10 +799,10 @@ class AdminCustomersControllerCore extends AdminController
|
||||
{
|
||||
$customer = new Customer($this->id_object);
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$update = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customer` SET newsletter = '.($customer->newsletter ? 0 : 1).' WHERE `id_customer` = '.(int)$customer->id);
|
||||
if (!$update)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
|
||||
@@ -815,10 +815,10 @@ class AdminCustomersControllerCore extends AdminController
|
||||
{
|
||||
$customer = new Customer($this->id_object);
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$update = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customer` SET optin = '.($customer->optin ? 0 : 1).' WHERE `id_customer` = '.(int)$customer->id);
|
||||
if (!$update)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ class AdminDbControllerCore extends AdminController
|
||||
// PrestaShop demo mode
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -198,9 +198,9 @@ class AdminDbControllerCore extends AdminController
|
||||
foreach ($this->options['database']['fields'] as $field => $values)
|
||||
if (isset($values['required']) && $values['required'])
|
||||
if (($value = Tools::getValue($field)) == false && (string)$value != '0')
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
/* Datas are not saved in database but in config/settings.inc.php */
|
||||
$settings = array();
|
||||
@@ -220,7 +220,7 @@ class AdminDbControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unable to connect to a database with these identifiers.');
|
||||
$this->errors[] = Tools::displayError('Unable to connect to a database with these identifiers.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ class AdminDbControllerCore extends AdminController
|
||||
if ($this->action == 'save')
|
||||
{
|
||||
if (!isset($_POST['tablesBox']) || !count($_POST['tablesBox']))
|
||||
$this->_errors[] = Tools::displayError('You did not select any tables');
|
||||
$this->errors[] = Tools::displayError('You did not select any tables');
|
||||
else
|
||||
{
|
||||
$available_engines = $this->getEngines();
|
||||
@@ -247,12 +247,12 @@ class AdminDbControllerCore extends AdminController
|
||||
foreach ($_POST['tablesBox'] as $table)
|
||||
{
|
||||
if ($engine_type == $tables_engine[$table])
|
||||
$this->_errors[] = $table.' '.$this->l('is already in').' '.$engine_type;
|
||||
$this->errors[] = $table.' '.$this->l('is already in').' '.$engine_type;
|
||||
else
|
||||
if (!Db::getInstance()->execute('ALTER TABLE `'.bqSQL($table).'` ENGINE=`'.bqSQL($engine_type).'`'))
|
||||
$this->_errors[] = $this->l('Can\'t change engine for').' '.$table;
|
||||
$this->errors[] = $this->l('Can\'t change engine for').' '.$table;
|
||||
}
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4'.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,15 +104,15 @@ class AdminDeliverySlipControllerCore extends AdminController
|
||||
if (Tools::isSubmit('submitAdddelivery'))
|
||||
{
|
||||
if (!Validate::isDate(Tools::getValue('date_from')))
|
||||
$this->_errors[] = Tools::displayError('Invalid from date');
|
||||
$this->errors[] = Tools::displayError('Invalid from date');
|
||||
if (!Validate::isDate(Tools::getValue('date_to')))
|
||||
$this->_errors[] = Tools::displayError('Invalid end date');
|
||||
if (!count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('Invalid end date');
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (count(OrderInvoice::getByDeliveryDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'))))
|
||||
Tools::redirectAdmin('pdf.php?deliveryslips&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('No delivery slip found for this period');
|
||||
$this->errors[] = Tools::displayError('No delivery slip found for this period');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -80,7 +80,7 @@ class AdminEmailsControllerCore extends AdminController
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
@@ -90,6 +90,6 @@ class AdminEmailsControllerCore extends AdminController
|
||||
$_POST['PS_SHOP_EMAIL'] = Configuration::get('PS_SHOP_EMAIL');
|
||||
|
||||
if ($_POST['PS_MAIL_METHOD'] == 2 AND (empty($_POST['PS_MAIL_SERVER']) OR empty($_POST['PS_MAIL_SMTP_PORT'])))
|
||||
$this->_errors[] = Tools::displayError('You must define a SMTP server and a SMTP port. If you do not know, use the PHP mail() function instead.');
|
||||
$this->errors[] = Tools::displayError('You must define a SMTP server and a SMTP port. If you do not know, use the PHP mail() function instead.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
$this->addRowAction('delete');
|
||||
|
||||
if (!Validate::isLoadedObject($obj = new Feature((int)$id)))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_feature_value' => array(
|
||||
@@ -350,7 +350,7 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
if (Tools::isSubmit('deletefeature_value') || Tools::isSubmit('submitAddfeature_value'))
|
||||
{
|
||||
Hook::exec('displayFeatureValuePostProcess',
|
||||
array('errors' => &$this->_errors)); // send _errors as reference to allow displayFeatureValuePostProcess to stop saving process
|
||||
array('errors' => &$this->errors)); // send _errors as reference to allow displayFeatureValuePostProcess to stop saving process
|
||||
|
||||
if (Tools::isSubmit('deletefeature_value'))
|
||||
{
|
||||
@@ -362,11 +362,11 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
if ($object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=2'.'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitAddfeature_value'))
|
||||
{
|
||||
@@ -375,20 +375,20 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
$feature_value->value = array();
|
||||
|
||||
if (!Tools::getValue('value_'.$this->context->language->id))
|
||||
$this->_errors[] = Tools::displayError('The value is required for the default language.');
|
||||
$this->errors[] = Tools::displayError('The value is required for the default language.');
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $language)
|
||||
$feature_value->value[$language['id_lang']] = Tools::getValue('value_'.$language['id_lang']);
|
||||
$feature_value->id_feature = Tools::getValue('id_feature');
|
||||
|
||||
if (count($this->_errors) > 0)
|
||||
if (count($this->errors) > 0)
|
||||
return false;
|
||||
else if (isset($id) && !empty($id))
|
||||
{
|
||||
// Update
|
||||
if (!$feature_value->update())
|
||||
$this->_errors[] = Tools::displayError('An error has occured: Can\'t save the current feature value');
|
||||
$this->errors[] = Tools::displayError('An error has occured: Can\'t save the current feature value');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
@@ -396,7 +396,7 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
{
|
||||
// Create
|
||||
if (!$feature_value->add())
|
||||
$this->_errors[] = Tools::displayError('An error has occured: Can\'t save the current feature value');
|
||||
$this->errors[] = Tools::displayError('An error has occured: Can\'t save the current feature value');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
@@ -407,7 +407,7 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
Hook::exec('displayFeaturePostProcess',
|
||||
array('errors' => &$this->_errors)); // send _errors as reference to allow displayFeaturePostProcess to stop saving process
|
||||
array('errors' => &$this->errors)); // send _errors as reference to allow displayFeaturePostProcess to stop saving process
|
||||
|
||||
if (Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
@@ -418,13 +418,13 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
$object = new $this->className();
|
||||
if ($object->deleteSelection($_POST[$this->table.'Box']))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=2'.'&token='.$this->token);
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
$this->errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
|
||||
@@ -180,7 +180,7 @@ class AdminGendersControllerCore extends AdminController
|
||||
if (isset($this->fieldImageSettings['name']) && isset($this->fieldImageSettings['dir']))
|
||||
{
|
||||
if (!Validate::isInt(Tools::getValue('img_width')) || !Validate::isInt(Tools::getValue('img_height')))
|
||||
$this->_errors[] = Tools::displayError('Width and height must be a numeric');
|
||||
$this->errors[] = Tools::displayError('Width and height must be a numeric');
|
||||
else
|
||||
{
|
||||
if ((int)Tools::getValue('img_width') > 0 && (int)Tools::getValue('img_height') > 0)
|
||||
@@ -196,7 +196,7 @@ class AdminGendersControllerCore extends AdminController
|
||||
return $this->uploadImage($id, $this->fieldImageSettings['name'], $this->fieldImageSettings['dir'].'/', false, $width, $height);
|
||||
}
|
||||
}
|
||||
return !count($this->_errors) ? true : false;
|
||||
return !count($this->errors) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ class AdminGeneratorControllerCore extends AdminController
|
||||
Configuration::updateValue('PS_HTACCESS_DISABLE_MULTIVIEWS', (int)Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS'));
|
||||
if (Tools::generateHtaccess($this->ht_file, null, null, '', Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS')))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
$this->_errors[] = $this->l('Cannot write into file:').' <b>'.$this->ht_file.'</b><br />'.$this->l('Please check write permissions.');
|
||||
$this->errors[] = $this->l('Cannot write into file:').' <b>'.$this->ht_file.'</b><br />'.$this->l('Please check write permissions.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitRobots'))
|
||||
@@ -81,7 +81,7 @@ class AdminGeneratorControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (!$write_fd = @fopen($this->rb_file, 'w'))
|
||||
$this->_errors[] = sprintf(Tools::displayError('Cannot write into file: %s. Please check write permissions.'), $this->rb_file);
|
||||
$this->errors[] = sprintf(Tools::displayError('Cannot write into file: %s. Please check write permissions.'), $this->rb_file);
|
||||
else
|
||||
{
|
||||
// PS Comments
|
||||
@@ -128,7 +128,7 @@ class AdminGeneratorControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
} else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,10 +96,10 @@ class AdminGeolocationControllerCore extends AdminController
|
||||
$redirectAdmin = true;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Geolocation database is unavailable.');
|
||||
$this->errors[] = Tools::displayError('Geolocation database is unavailable.');
|
||||
|
||||
if (!is_array(Tools::getValue('countries')) || !count(Tools::getValue('countries')))
|
||||
$this->_errors[] = Tools::displayError('Country selection is invalid');
|
||||
$this->errors[] = Tools::displayError('Country selection is invalid');
|
||||
else
|
||||
{
|
||||
Configuration::updateValue(
|
||||
@@ -112,7 +112,7 @@ class AdminGeolocationControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (!Validate::isCleanHtml(Tools::getValue('PS_GEOLOCATION_WHITELIST')))
|
||||
$this->_errors[] = Tools::displayError('Invalid whitelist');
|
||||
$this->errors[] = Tools::displayError('Invalid whitelist');
|
||||
else
|
||||
{
|
||||
Configuration::updateValue(
|
||||
|
||||
@@ -260,11 +260,11 @@ class AdminGroupShopControllerCore extends AdminController
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
if (GroupShop::getTotalGroupShops() == 1)
|
||||
$this->_errors[] = Tools::displayError('You cannot delete or disable the last groupshop.');
|
||||
$this->errors[] = Tools::displayError('You cannot delete or disable the last groupshop.');
|
||||
else if ($object->haveShops())
|
||||
$this->_errors[] = Tools::displayError('You cannot delete or disable a groupshop which have this shops using it.');
|
||||
$this->errors[] = Tools::displayError('You cannot delete or disable a groupshop which have this shops using it.');
|
||||
|
||||
if (count($this->_errors))
|
||||
if (count($this->errors))
|
||||
return false;
|
||||
}
|
||||
return parent::postProcess();
|
||||
|
||||
@@ -352,7 +352,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
public function processSave($token)
|
||||
{
|
||||
if (!$this->validateDiscount(Tools::getValue('reduction')))
|
||||
$this->_errors[] = Tools::displayError('Discount value is incorrect (must be a percentage)');
|
||||
$this->errors[] = Tools::displayError('Discount value is incorrect (must be a percentage)');
|
||||
else
|
||||
{
|
||||
$this->updateCategoryReduction();
|
||||
@@ -419,7 +419,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
foreach ($category_reduction as $cat => $reduction)
|
||||
{
|
||||
if (!Validate::isUnsignedId($cat) || !$this->validateDiscount($reduction))
|
||||
$this->_errors[] = Tools::displayError('Discount value is incorrect');
|
||||
$this->errors[] = Tools::displayError('Discount value is incorrect');
|
||||
else
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
@@ -438,7 +438,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
$group_reduction->reduction = (float)($reduction / 100);
|
||||
$group_reduction->id_category = (int)$cat;
|
||||
if (!$group_reduction->save())
|
||||
$this->_errors[] = Tools::displayError('Cannot save group reductions');
|
||||
$this->errors[] = Tools::displayError('Cannot save group reductions');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -453,10 +453,10 @@ class AdminGroupsControllerCore extends AdminController
|
||||
{
|
||||
$group = new Group($this->id_object);
|
||||
if (!Validate::isLoadedObject($group))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating group.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating group.');
|
||||
$update = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'group` SET show_prices = '.($group->show_prices ? 0 : 1).' WHERE `id_group` = '.(int)$group->id);
|
||||
if (!$update)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating group.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating group.');
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=9'.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}elseif (Tools::getValue('submitMoveImages'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
@@ -258,26 +258,26 @@ class AdminImagesControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=25'.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}elseif (Tools::getValue('submitImagePreferences'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if ((int)Tools::getValue('PS_JPEG_QUALITY') < 0
|
||||
|| (int)Tools::getValue('PS_JPEG_QUALITY') > 100)
|
||||
$this->_errors[] = Tools::displayError('Incorrect value for JPEG image quality.');
|
||||
$this->errors[] = Tools::displayError('Incorrect value for JPEG image quality.');
|
||||
elseif ((int)Tools::getValue('PS_PNG_QUALITY') < 0
|
||||
|| (int)Tools::getValue('PS_PNG_QUALITY') > 9)
|
||||
$this->_errors[] = Tools::displayError('Incorrect value for PNG image quality.');
|
||||
$this->errors[] = Tools::displayError('Incorrect value for PNG image quality.');
|
||||
elseif (!Configuration::updateValue('PS_IMAGE_QUALITY', Tools::getValue('PS_IMAGE_QUALITY'))
|
||||
|| !Configuration::updateValue('PS_JPEG_QUALITY', Tools::getValue('PS_JPEG_QUALITY'))
|
||||
|| !Configuration::updateValue('PS_PNG_QUALITY', Tools::getValue('PS_PNG_QUALITY')))
|
||||
$this->_errors[] = Tools::displayError('Unknown error.');
|
||||
$this->errors[] = Tools::displayError('Unknown error.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
else
|
||||
@@ -287,7 +287,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
protected function _childValidation()
|
||||
{
|
||||
if (!Tools::getValue('id_image_type') AND Validate::isImageTypeName($typeName = Tools::getValue('name')) AND ImageType::typeAlreadyExists($typeName))
|
||||
$this->_errors[] = Tools::displayError('This name already exists.');
|
||||
$this->errors[] = Tools::displayError('This name already exists.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,20 +479,20 @@ class AdminImagesControllerCore extends AdminController
|
||||
if ($deleteOldImages)
|
||||
$this->_deleteOldImages($proc['dir'], $formats, ($proc['type'] == 'products' ? true : false));
|
||||
if (($return = $this->_regenerateNewImages($proc['dir'], $formats, ($proc['type'] == 'products' ? true : false))) === true)
|
||||
$this->_errors[] = Tools::displayError('Cannot write ').$proc['type'].Tools::displayError(' images. Please check the folder\'s writing permissions.');
|
||||
$this->errors[] = Tools::displayError('Cannot write ').$proc['type'].Tools::displayError(' images. Please check the folder\'s writing permissions.');
|
||||
elseif ($return == 'timeout')
|
||||
$this->_errors[] = Tools::displayError('Only part of the images have been regenerated, server timed out before finishing.');
|
||||
$this->errors[] = Tools::displayError('Only part of the images have been regenerated, server timed out before finishing.');
|
||||
else
|
||||
{
|
||||
if ($proc['type'] == 'products')
|
||||
if ($this->_regenerateWatermark($proc['dir']) == 'timeout')
|
||||
$this->_errors[] = Tools::displayError('Server timed out, the watermark may not have been applied on all your images.');
|
||||
if (!count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('Server timed out, the watermark may not have been applied on all your images.');
|
||||
if (!count($this->errors))
|
||||
if ($this->_regenerateNoPictureImages($proc['dir'], $formats, $languages))
|
||||
$this->_errors[] = Tools::displayError('Cannot write no-picture image to').' ('.$proc['type'].') '.Tools::displayError('images folder. Please check the folder\'s writing permissions.');
|
||||
$this->errors[] = Tools::displayError('Cannot write no-picture image to').' ('.$proc['type'].') '.Tools::displayError('images folder. Please check the folder\'s writing permissions.');
|
||||
}
|
||||
}
|
||||
return (sizeof($this->_errors) > 0 ? false : true);
|
||||
return (sizeof($this->errors) > 0 ? false : true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,18 +512,18 @@ class AdminImagesControllerCore extends AdminController
|
||||
private function _moveImagesToNewFileSystem()
|
||||
{
|
||||
if (!Image::testFileSystem())
|
||||
$this->_errors[] = Tools::displayError('Error: your server configuration is not compatible with the new image system. No images were moved');
|
||||
$this->errors[] = Tools::displayError('Error: your server configuration is not compatible with the new image system. No images were moved');
|
||||
else
|
||||
{
|
||||
ini_set('max_execution_time', $this->max_execution_time); // ini_set may be disabled, we need the real value
|
||||
$this->max_execution_time = (int)ini_get('max_execution_time');
|
||||
$result = Image::moveToNewFileSystem($this->max_execution_time);
|
||||
if ($result === 'timeout')
|
||||
$this->_errors[] = Tools::displayError('Not all images have been moved, server timed out before finishing. Click on \"Move images\" again to resume moving images');
|
||||
$this->errors[] = Tools::displayError('Not all images have been moved, server timed out before finishing. Click on \"Move images\" again to resume moving images');
|
||||
else if ($result === false)
|
||||
$this->_errors[] = Tools::displayError('Error: some or all images could not be moved.');
|
||||
$this->errors[] = Tools::displayError('Error: some or all images could not be moved.');
|
||||
}
|
||||
return (sizeof($this->_errors) > 0 ? false : true);
|
||||
return (sizeof($this->errors) > 0 ? false : true);
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
|
||||
@@ -840,9 +840,9 @@ class AdminImportControllerCore extends AdminController
|
||||
$category->id_parent = $category_to_create->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $category_to_create->name[$default_language_id].(isset($category_to_create->id) ? ' ('.$category_to_create->id.')' : '').
|
||||
$this->errors[] = $category_to_create->name[$default_language_id].(isset($category_to_create->id) ? ' ('.$category_to_create->id.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -891,7 +891,7 @@ class AdminImportControllerCore extends AdminController
|
||||
if ($category->id && $category->categoryExists($category->id) && $category->id != 1)
|
||||
$res = $category->update();
|
||||
if ($category->id == 1)
|
||||
$this->_errors[] = Tools::displayError('Root category cannot be modify');
|
||||
$this->errors[] = Tools::displayError('Root category cannot be modify');
|
||||
// If no id_category or update failed
|
||||
if (!$res)
|
||||
$res = $category->add();
|
||||
@@ -903,8 +903,8 @@ class AdminImportControllerCore extends AdminController
|
||||
// If both failed, mysql error
|
||||
if (!$res)
|
||||
{
|
||||
$this->_errors[] = $info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = $info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -970,8 +970,8 @@ class AdminImportControllerCore extends AdminController
|
||||
$product->id_manufacturer = (int)$manufacturer->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $manufacturer->name.(isset($manufacturer->id) ? ' ('.$manufacturer->id.')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = $manufacturer->name.(isset($manufacturer->id) ? ' ('.$manufacturer->id.')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -992,8 +992,8 @@ class AdminImportControllerCore extends AdminController
|
||||
$product->id_supplier = (int)$supplier->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $supplier->name.(isset($supplier->id) ? ' ('.$supplier->id.')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = $supplier->name.(isset($supplier->id) ? ' ('.$supplier->id.')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1033,9 +1033,9 @@ class AdminImportControllerCore extends AdminController
|
||||
$product->id_category[] = (int)$category_to_create->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $category_to_create->name[$default_language_id].(isset($category_to_create->id) ? ' ('.$category_to_create->id.')' : '').
|
||||
$this->errors[] = $category_to_create->name[$default_language_id].(isset($category_to_create->id) ? ' ('.$category_to_create->id.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1056,9 +1056,9 @@ class AdminImportControllerCore extends AdminController
|
||||
$product->id_category[] = (int)$category_to_create->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $category_to_create->name[$default_language_id].(isset($category_to_create->id) ? ' ('.$category_to_create->id.')' : '').
|
||||
$this->errors[] = $category_to_create->name[$default_language_id].(isset($category_to_create->id) ? ' ('.$category_to_create->id.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1122,8 +1122,8 @@ class AdminImportControllerCore extends AdminController
|
||||
// If both failed, mysql error
|
||||
if (!$res)
|
||||
{
|
||||
$this->_errors[] = $info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = $info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
|
||||
}
|
||||
@@ -1229,7 +1229,7 @@ class AdminImportControllerCore extends AdminController
|
||||
{
|
||||
$this->warnings[] = (isset($image->id_product) ? ' ('.$image->id_product.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1309,7 +1309,7 @@ class AdminImportControllerCore extends AdminController
|
||||
{
|
||||
$this->warnings[] = (isset($image->id_product) ? ' ('.$image->id_product.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').mysql_error();
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').mysql_error();
|
||||
}
|
||||
}
|
||||
else if (isset($info['image_position']) && $info['image_position'])
|
||||
@@ -1371,7 +1371,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$groups[$group] = $obj->id;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '');
|
||||
}
|
||||
}
|
||||
foreach (explode($fsep, $info['attribute']) as $attribute)
|
||||
@@ -1396,7 +1396,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$attributes[$group.'_'.$attribute] = $obj->id;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1455,8 +1455,8 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
if (!$res)
|
||||
{
|
||||
$this->_errors[] = $info['email'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : ($lang_field_error !== true ? $lang_field_error : '')).
|
||||
$this->errors[] = $info['email'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : ($lang_field_error !== true ? $lang_field_error : '')).
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1502,8 +1502,8 @@ class AdminImportControllerCore extends AdminController
|
||||
$address->id_country = (int)$country->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $country->name[$default_language_id].' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = $country->name[$default_language_id].' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1532,8 +1532,8 @@ class AdminImportControllerCore extends AdminController
|
||||
$address->id_state = (int)$state->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $state->name.' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = $state->name.' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1547,11 +1547,11 @@ class AdminImportControllerCore extends AdminController
|
||||
if ($customer)
|
||||
$address->id_customer = (int)$customer;
|
||||
else
|
||||
$this->_errors[] = Db::getInstance()->getMsgError().' '.$address->customer_email.' '.Tools::displayError('does not exist in database').' '.
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$address->customer_email.' '.Tools::displayError('does not exist in database').' '.
|
||||
(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = '"'.$address->customer_email.'" :'.Tools::displayError('Is not a valid Email');
|
||||
$this->errors[] = '"'.$address->customer_email.'" :'.Tools::displayError('Is not a valid Email');
|
||||
}
|
||||
|
||||
if (isset($address->manufacturer) && is_numeric($address->manufacturer) && Manufacturer::manufacturerExists((int)$address->manufacturer))
|
||||
@@ -1565,9 +1565,9 @@ class AdminImportControllerCore extends AdminController
|
||||
$address->id_manufacturer = (int)$manufacturer->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = Db::getInstance()->getMsgError().' '.$manufacturer->name.(isset($manufacturer->id) ? ' ('.$manufacturer->id.')' : '').
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$manufacturer->name.(isset($manufacturer->id) ? ' ('.$manufacturer->id.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1583,9 +1583,9 @@ class AdminImportControllerCore extends AdminController
|
||||
$address->id_supplier = (int)$supplier->id;
|
||||
else
|
||||
{
|
||||
$this->_errors[] = Db::getInstance()->getMsgError().' '.$supplier->name.(isset($supplier->id) ? ' ('.$supplier->id.')' : '').
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$supplier->name.(isset($supplier->id) ? ' ('.$supplier->id.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1601,8 +1601,8 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
if (!$res)
|
||||
{
|
||||
$this->_errors[] = $info['alias'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = $info['alias'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1658,9 +1658,9 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
if (!$res)
|
||||
{
|
||||
$this->_errors[] = Db::getInstance()->getMsgError().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -1696,7 +1696,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$res = $supplier->add();
|
||||
|
||||
if (!$res)
|
||||
$this->_errors[] = Db::getInstance()->getMsgError().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
else
|
||||
{
|
||||
@@ -1718,8 +1718,8 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_errors[] = $this->l('Supplier not valid').' ('.$supplier->name.')';
|
||||
$this->_errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '');
|
||||
$this->errors[] = $this->l('Supplier not valid').' ('.$supplier->name.')';
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '');
|
||||
}
|
||||
}
|
||||
$this->closeCsvFile($handle);
|
||||
@@ -1767,31 +1767,31 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
// checks parameters
|
||||
if (!Supplier::supplierExists($id_supplier))
|
||||
$this->_errors[] = sprintf($this->l('Supplier ID (%d) is not valid (at line %d).'), $id_supplier, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Supplier ID (%d) is not valid (at line %d).'), $id_supplier, $current_line + 1);
|
||||
if (!Language::getLanguage($id_lang))
|
||||
$this->_errors[] = sprintf($this->l('Lang ID (%d) is not valid (at line %d).'), $id_lang, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Lang ID (%d) is not valid (at line %d).'), $id_lang, $current_line + 1);
|
||||
if (!Warehouse::exists($id_warehouse))
|
||||
$this->_errors[] = sprintf($this->l('Warehouse ID (%d) is not valid (at line %d).'), $id_warehouse, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Warehouse ID (%d) is not valid (at line %d).'), $id_warehouse, $current_line + 1);
|
||||
if (!Currency::getCurrency($id_currency))
|
||||
$this->_errors[] = sprintf($this->l('Currency ID (%d) is not valid (at line %d).'), $id_currency, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Currency ID (%d) is not valid (at line %d).'), $id_currency, $current_line + 1);
|
||||
if (empty($supply_order->reference) && SupplyOrder::exists($reference))
|
||||
$this->_errors[] = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
|
||||
if (!empty($supply_order->reference) && ($supply_order->reference != $reference && SupplyOrder::exists($reference)))
|
||||
$this->_errors[] = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
|
||||
if (!Validate::isDateFormat($date_delivery_expected))
|
||||
$this->_errors[] = sprintf($this->l('Date (%s) is not valid (at line %d). Format: %s.'), $date_delivery_expected,
|
||||
$this->errors[] = sprintf($this->l('Date (%s) is not valid (at line %d). Format: %s.'), $date_delivery_expected,
|
||||
$current_line + 1, $this->l('YYYY-MM-DD'));
|
||||
else if (new DateTime($date_delivery_expected) <= new DateTime('yesterday'))
|
||||
$this->_errors[] = sprintf($this->l('Date (%s) cannot be in the past (at line %d). Format: %s.'), $date_delivery_expected,
|
||||
$this->errors[] = sprintf($this->l('Date (%s) cannot be in the past (at line %d). Format: %s.'), $date_delivery_expected,
|
||||
$current_line + 1, $this->l('YYYY-MM-DD'));
|
||||
if ($discount_rate < 0 || $discount_rate > 100)
|
||||
$this->_errors[] = sprintf($this->l('Discount rate (%d) is not valid (at line %d). %s.'), $discount_rate,
|
||||
$this->errors[] = sprintf($this->l('Discount rate (%d) is not valid (at line %d). %s.'), $discount_rate,
|
||||
$current_line + 1, $this->l('Format: between 0 and 100'));
|
||||
if ($supply_order->id > 0 && !$supply_order->isEditable())
|
||||
$this->_errors[] = sprintf($this->l('Supply Order (%d) is not editable (at line %d).'), $supply_order->id, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Supply Order (%d) is not editable (at line %d).'), $supply_order->id, $current_line + 1);
|
||||
|
||||
// if no errors, sets supply order
|
||||
if (empty($this->_errors))
|
||||
if (empty($this->errors))
|
||||
{
|
||||
// adds parameters
|
||||
$info['id_ref_currency'] = (int)Currency::getDefaultCurrency()->id;
|
||||
@@ -1816,7 +1816,7 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
// errors
|
||||
if (!$res)
|
||||
$this->_errors[] = sprintf($this->l('Supply Order could not be saved (at line %d).'), $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Supply Order could not be saved (at line %d).'), $current_line + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1848,9 +1848,9 @@ class AdminImportControllerCore extends AdminController
|
||||
if (array_key_exists('supply_order_reference', $info) && pSQL($info['supply_order_reference']) && SupplyOrder::exists(pSQL($info['supply_order_reference'])))
|
||||
$supply_order = SupplyOrder::getSupplyOrderByReference(pSQL($info['supply_order_reference']));
|
||||
else
|
||||
$this->_errors[] = sprintf($this->l('Supply Order (%s) could not be loaded (at line %d).'), (int)$info['supply_order_reference'], $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Supply Order (%s) could not be loaded (at line %d).'), (int)$info['supply_order_reference'], $current_line + 1);
|
||||
|
||||
if (empty($this->_errors))
|
||||
if (empty($this->errors))
|
||||
{
|
||||
// sets parameters
|
||||
$id_product = (int)$info['id_product'];
|
||||
@@ -1866,7 +1866,7 @@ class AdminImportControllerCore extends AdminController
|
||||
if (isset($product['id_product']))
|
||||
{
|
||||
if ($product['id_product'] == $id_product_attribute)
|
||||
$this->_errors[] = sprintf($this->l('Product (%d/%D) cannot be added twice (at line %d).'), $id_product,
|
||||
$this->errors[] = sprintf($this->l('Product (%d/%D) cannot be added twice (at line %d).'), $id_product,
|
||||
$id_product_attribute, $current_line + 1);
|
||||
else
|
||||
$product['id_product'] = $id_product_attribute;
|
||||
@@ -1876,21 +1876,21 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
// checks parameters
|
||||
if (false === ($supplier_reference = ProductSupplier::getProductSupplierReference($id_product, $id_product_attribute, $supply_order->id_supplier)))
|
||||
$this->_errors[] = sprintf($this->l('Product (%d/%d) is not available for this order (at line %d).'), $id_product,
|
||||
$this->errors[] = sprintf($this->l('Product (%d/%d) is not available for this order (at line %d).'), $id_product,
|
||||
$id_product_attribute, $current_line + 1);
|
||||
if ($unit_price_te < 0)
|
||||
$this->_errors[] = sprintf($this->l('Unit Price (te) (%d) is not valid (at line %d).'), $unit_price_te, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Unit Price (te) (%d) is not valid (at line %d).'), $unit_price_te, $current_line + 1);
|
||||
if ($quantity_expected < 0)
|
||||
$this->_errors[] = sprintf($this->l('Quantity Expected (%d) is not valid (at line %d).'), $quantity_expected, $current_line + 1);
|
||||
$this->errors[] = sprintf($this->l('Quantity Expected (%d) is not valid (at line %d).'), $quantity_expected, $current_line + 1);
|
||||
if ($discount_rate < 0 || $discount_rate > 100)
|
||||
$this->_errors[] = sprintf($this->l('Discount rate (%d) is not valid (at line %d). %s.'), $discount_rate,
|
||||
$this->errors[] = sprintf($this->l('Discount rate (%d) is not valid (at line %d). %s.'), $discount_rate,
|
||||
$current_line + 1, $this->l('Format: between 0 and 100'));
|
||||
if ($tax_rate < 0 || $tax_rate > 100)
|
||||
$this->_errors[] = sprintf($this->l('Tax rate (%d) is not valid (at line %d). %s.'), $tax_rate,
|
||||
$this->errors[] = sprintf($this->l('Tax rate (%d) is not valid (at line %d). %s.'), $tax_rate,
|
||||
$current_line + 1, $this->l('Format: between 0 and 100'));
|
||||
|
||||
// if no errors, sets supply order details
|
||||
if (empty($this->_errors))
|
||||
if (empty($this->errors))
|
||||
{
|
||||
// resets order if needed
|
||||
if ($reset)
|
||||
@@ -1975,7 +1975,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$handle = fopen(_PS_ADMIN_DIR_.'/import/'.strval(preg_replace('/\.{2,}/', '.', Tools::getValue('csv'))), 'r');
|
||||
|
||||
if (!$handle)
|
||||
$this->_errors[] = Tools::displayError('Cannot read the CSV file');
|
||||
$this->errors[] = Tools::displayError('Cannot read the CSV file');
|
||||
|
||||
self::rewindBomAware($handle);
|
||||
|
||||
@@ -2054,7 +2054,7 @@ class AdminImportControllerCore extends AdminController
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
@@ -2066,7 +2066,7 @@ class AdminImportControllerCore extends AdminController
|
||||
switch ($_FILES['file']['error'])
|
||||
{
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
$this->_errors[] = Tools::displayError('The uploaded file exceeds the upload_max_filesize directive in php.ini.
|
||||
$this->errors[] = Tools::displayError('The uploaded file exceeds the upload_max_filesize directive in php.ini.
|
||||
If your server configuration allows it, you may add a directive in your .htaccess, for example:')
|
||||
.'<br/><a href="?tab=AdminGenerator&token='
|
||||
.Tools::getAdminTokenLite('AdminGenerator').'" >
|
||||
@@ -2074,7 +2074,7 @@ class AdminImportControllerCore extends AdminController
|
||||
Tools::displayError('(clic to open Generator tab)').'</a>';
|
||||
break;
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
$this->_errors[] = Tools::displayError('The uploaded file exceeds the post_max_size directive in php.ini.
|
||||
$this->errors[] = Tools::displayError('The uploaded file exceeds the post_max_size directive in php.ini.
|
||||
If your server configuration allows it, you may add a directive in your .htaccess, for example:')
|
||||
.'<br/><a href="?tab=AdminGenerator&token='
|
||||
.Tools::getAdminTokenLite('AdminGenerator').'" >
|
||||
@@ -2083,18 +2083,18 @@ class AdminImportControllerCore extends AdminController
|
||||
break;
|
||||
break;
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
$this->_errors[] = Tools::displayError('The uploaded file was only partially uploaded.');
|
||||
$this->errors[] = Tools::displayError('The uploaded file was only partially uploaded.');
|
||||
break;
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
$this->_errors[] = Tools::displayError('No file was uploaded');
|
||||
$this->errors[] = Tools::displayError('No file was uploaded');
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!file_exists($_FILES['file']['tmp_name']) ||
|
||||
!@move_uploaded_file($_FILES['file']['tmp_name'], _PS_ADMIN_DIR_.'/import/'.$_FILES['file']['name'].'.'.date('Ymdhis')))
|
||||
$this->_errors[] = $this->l('an error occurred while uploading and copying file');
|
||||
$this->errors[] = $this->l('an error occurred while uploading and copying file');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=18');
|
||||
}
|
||||
@@ -2137,7 +2137,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$this->supplyOrdersDetailsImport();
|
||||
break;
|
||||
default:
|
||||
$this->_errors[] = $this->l('no entity selected');
|
||||
$this->errors[] = $this->l('no entity selected');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -209,30 +209,30 @@ class AdminInvoicesControllerCore extends AdminController
|
||||
if (Tools::getValue('submitAddinvoice_date'))
|
||||
{
|
||||
if (!Validate::isDate(Tools::getValue('date_from')))
|
||||
$this->_errors[] = $this->l('Invalid from date');
|
||||
$this->errors[] = $this->l('Invalid from date');
|
||||
|
||||
if (!Validate::isDate(Tools::getValue('date_to')))
|
||||
$this->_errors[] = $this->l('Invalid end date');
|
||||
$this->errors[] = $this->l('Invalid end date');
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (count(OrderInvoice::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'))))
|
||||
Tools::redirectAdmin('pdf.php?invoices&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
|
||||
$this->_errors[] = $this->l('No invoice found for this period');
|
||||
$this->errors[] = $this->l('No invoice found for this period');
|
||||
}
|
||||
}
|
||||
else if (Tools::isSubmit('submitAddinvoice_status'))
|
||||
{
|
||||
if (!is_array($status_array = Tools::getValue('id_order_state')) || !count($status_array))
|
||||
$this->_errors[] = $this->l('You must select at least one order status');
|
||||
$this->errors[] = $this->l('You must select at least one order status');
|
||||
else
|
||||
{
|
||||
foreach ($status_array as $id_order_state)
|
||||
if (count(OrderInvoice::getByStatus((int)$id_order_state)))
|
||||
Tools::redirectAdmin('pdf.php?invoices2&id_order_state='.implode('-', $status_array).'&token='.$this->token);
|
||||
|
||||
$this->_errors[] = $this->l('No invoice found for this status');
|
||||
$this->errors[] = $this->l('No invoice found for this status');
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -242,7 +242,7 @@ class AdminInvoicesControllerCore extends AdminController
|
||||
public function beforeUpdateOptions()
|
||||
{
|
||||
if ((int)Tools::getValue('PS_INVOICE_START_NUMBER') != 0 && (int)Tools::getValue('PS_INVOICE_START_NUMBER') <= Order::getLastInvoiceNumber())
|
||||
$this->_errors[] = $this->l('Invalid invoice number (must be > ').Order::getLastInvoiceNumber().')';
|
||||
$this->errors[] = $this->l('Invalid invoice number (must be > ').Order::getLastInvoiceNumber().')';
|
||||
}
|
||||
|
||||
protected function getInvoicesModels()
|
||||
|
||||
@@ -303,29 +303,29 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
{
|
||||
// English is needed by the system (ex. translations)
|
||||
if ($object->id == Language::getIdByIso('en'))
|
||||
$this->_errors[] = $this->l('You cannot delete the English language as it is a system requirement, you can only deactivate it.');
|
||||
$this->errors[] = $this->l('You cannot delete the English language as it is a system requirement, you can only deactivate it.');
|
||||
if ($object->id == Configuration::get('PS_LANG_DEFAULT'))
|
||||
$this->_errors[] = $this->l('you cannot delete the default language');
|
||||
$this->errors[] = $this->l('you cannot delete the default language');
|
||||
else if ($object->id == $this->context->language->id)
|
||||
$this->_errors[] = $this->l('You cannot delete the language currently in use. Please change languages before deleting.');
|
||||
$this->errors[] = $this->l('You cannot delete the language currently in use. Please change languages before deleting.');
|
||||
else if ($this->deleteNoPictureImages((int)Tools::getValue('id_lang')) && $object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.
|
||||
Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else if (Tools::getValue('submitDel'.$this->table) && isset($_POST[$this->table.'Box']))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (in_array(Configuration::get('PS_LANG_DEFAULT'), $_POST[$this->table.'Box']))
|
||||
$this->_errors[] = $this->l('you cannot delete the default language');
|
||||
$this->errors[] = $this->l('you cannot delete the default language');
|
||||
else if (in_array($this->context->language->id, $_POST[$this->table.'Box']))
|
||||
$this->_errors[] = $this->l('you cannot delete the language currently in use, please change languages before deleting');
|
||||
$this->errors[] = $this->l('you cannot delete the language currently in use, please change languages before deleting');
|
||||
else
|
||||
{
|
||||
foreach ($_POST[$this->table.'Box'] as $language)
|
||||
@@ -334,7 +334,7 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitAddlang'))
|
||||
{
|
||||
@@ -344,7 +344,7 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
if (isset($_POST['iso_code']) && !empty($_POST['iso_code']) && Validate::isLanguageIsoCode(Tools::getValue('iso_code')) && Language::getIdByIso($_POST['iso_code']))
|
||||
$this->_errors[] = Tools::displayError('This ISO code is already linked to another language.');
|
||||
$this->errors[] = Tools::displayError('This ISO code is already linked to another language.');
|
||||
if ((!empty($_FILES['no-picture']['tmp_name']) || !empty($_FILES['flag']['tmp_name'])) && Validate::isLanguageIsoCode(Tools::getValue('iso_code')))
|
||||
{
|
||||
if ($_FILES['no-picture']['error'] == UPLOAD_ERR_OK)
|
||||
@@ -356,11 +356,11 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
$this->validateRules();
|
||||
$this->_errors[] = Tools::displayError('Flag and No-Picture image fields are required.');
|
||||
$this->errors[] = Tools::displayError('Flag and No-Picture image fields are required.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
/* Language edition */
|
||||
else
|
||||
@@ -378,16 +378,16 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
if ((int)$object->id == (int)Configuration::get('PS_LANG_DEFAULT') && (int)$_POST['active'] != (int)$object->active)
|
||||
$this->_errors[] = Tools::displayError('You cannot change the status of the default language.');
|
||||
$this->errors[] = Tools::displayError('You cannot change the status of the default language.');
|
||||
else
|
||||
parent::postProcess();
|
||||
|
||||
$this->validateRules();
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
}
|
||||
else if (isset($_GET['status'.$this->table]) && isset($_GET['id_lang']))
|
||||
@@ -395,14 +395,14 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
if ((int)$object->id == (int)Configuration::get('PS_LANG_DEFAULT'))
|
||||
$this->_errors[] = Tools::displayError('You cannot change the status of the default language.');
|
||||
$this->errors[] = Tools::displayError('You cannot change the status of the default language.');
|
||||
else
|
||||
return parent::postProcess();
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else
|
||||
return parent::postProcess();
|
||||
@@ -417,17 +417,17 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
{
|
||||
if (isset($_FILES['no-picture']) && $_FILES['no-picture']['error'] === 0)
|
||||
if ($error = checkImage($_FILES['no-picture'], Tools::getMaxUploadSize()))
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
else
|
||||
{
|
||||
if (!$tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES['no-picture']['tmp_name'], $tmp_name))
|
||||
return false;
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'.jpg'))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while copying no-picture image to your product folder.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying no-picture image to your product folder.');
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'.jpg'))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while copying no-picture image to your category folder.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying no-picture image to your category folder.');
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'.jpg'))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while copying no-picture image to your manufacturer folder');
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying no-picture image to your manufacturer folder');
|
||||
else
|
||||
{
|
||||
$images_types = ImageType::getImagesTypes('products');
|
||||
@@ -435,11 +435,11 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height']))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your product directory.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your product directory.');
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height']))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your category directory.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your category directory.');
|
||||
if (!imageResize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height']))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your manufacturer directory.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while resizing no-picture image to your manufacturer directory.');
|
||||
}
|
||||
}
|
||||
unlink($tmp_name);
|
||||
@@ -462,14 +462,14 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
foreach ($images_types as $k => $image_type)
|
||||
if (file_exists($dir.$language.'-default-'.stripslashes($image_type['name']).'.jpg'))
|
||||
if (!unlink($dir.$language.'-default-'.stripslashes($image_type['name']).'.jpg'))
|
||||
$this->_errors[] = Tools::displayError('An error occurred during image deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during image deletion.');
|
||||
|
||||
if (file_exists($dir.$language.'.jpg'))
|
||||
if (!unlink($dir.$language.'.jpg'))
|
||||
$this->_errors[] = Tools::displayError('An error occurred during image deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during image deletion.');
|
||||
}
|
||||
|
||||
return !count($this->_errors) ? true : false;
|
||||
return !count($this->errors) ? true : false;
|
||||
}
|
||||
|
||||
protected function copyFromPost(&$object, $table)
|
||||
@@ -484,7 +484,7 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
{
|
||||
$lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT'));
|
||||
if (!$lang->active)
|
||||
$this->_errors[] = Tools::displayError('You cannot set this language as default language because it\'s disabled');
|
||||
$this->errors[] = Tools::displayError('You cannot set this language as default language because it\'s disabled');
|
||||
}
|
||||
public function ajaxProcessCheckLangPack()
|
||||
{
|
||||
@@ -492,12 +492,12 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
if(empty($_GET['iso_lang']))
|
||||
{
|
||||
$this->status = 'error';
|
||||
$this->_errors[] = '[TECHNICAL ERROR] iso_lang not set or empty';
|
||||
$this->errors[] = '[TECHNICAL ERROR] iso_lang not set or empty';
|
||||
}
|
||||
if(empty($_GET['ps_version']))
|
||||
{
|
||||
$this->status = 'error';
|
||||
$this->_errors[] = '[TECHNICAL ERROR] ps_version not set or empty';
|
||||
$this->errors[] = '[TECHNICAL ERROR] ps_version not set or empty';
|
||||
}
|
||||
if(@fsockopen('api.prestashop.com', 80))
|
||||
{
|
||||
@@ -512,13 +512,13 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
$this->status = 'error';
|
||||
$this->_errors[] = $this->l('wrong ISO code or lang pack unavailable');
|
||||
$this->errors[] = $this->l('wrong ISO code or lang pack unavailable');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->status = 'error';
|
||||
$this->_errors[] = '[TECHNICAL ERROR] Server unreachable';
|
||||
$this->errors[] = '[TECHNICAL ERROR] Server unreachable';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,21 +105,21 @@ class AdminLocalizationControllerCore extends AdminController
|
||||
$pack = @Tools::file_get_contents('http://api.prestashop.com/download/localization/'.$version.'/'.Tools::getValue('iso_localization_pack').'.xml');
|
||||
|
||||
if (!$pack && !($pack = @Tools::file_get_contents(dirname(__FILE__).'/../../localization/'.Tools::getValue('iso_localization_pack').'.xml')))
|
||||
$this->_errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")');
|
||||
$this->errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")');
|
||||
|
||||
if (!$selection = Tools::getValue('selection'))
|
||||
$this->_errors[] = Tools::displayError('Please select at least one content item to import.');
|
||||
$this->errors[] = Tools::displayError('Please select at least one content item to import.');
|
||||
else
|
||||
{
|
||||
foreach ($selection as $selected)
|
||||
if (!Validate::isLocalizationPackSelection($selected))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Invalid selection');
|
||||
$this->errors[] = Tools::displayError('Invalid selection');
|
||||
return;
|
||||
}
|
||||
$localization_pack = new LocalizationPack();
|
||||
if (!$localization_pack->loadLocalisationPack($pack, $selection))
|
||||
$this->_errors = array_merge($this->_errors, $localization_pack->getErrors());
|
||||
$this->errors = array_merge($this->errors, $localization_pack->getErrors());
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=23&token='.$this->token);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class AdminMetaControllerCore extends AdminController
|
||||
|
||||
if (!$defaultLangIsValidated AND !$englishLangIsValidated)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Url rewrite field must be filled at least in default or english language.');
|
||||
$this->errors[] = Tools::displayError('Url rewrite field must be filled at least in default or english language.');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ class AdminMetaControllerCore extends AdminController
|
||||
if (!Dispatcher::getInstance()->validateRoute($routeID, $rule, $errors))
|
||||
{
|
||||
foreach ($errors as $error)
|
||||
$this->_errors[] = sprintf('Keyword "{%1$s}" required for route "%2$s" (rule: "%3$s")', $error, $routeID, htmlspecialchars($rule));
|
||||
$this->errors[] = sprintf('Keyword "{%1$s}" required for route "%2$s" (rule: "%3$s")', $error, $routeID, htmlspecialchars($rule));
|
||||
}
|
||||
else
|
||||
Configuration::updateValue('PS_ROUTE_'.$routeID, $rule);
|
||||
|
||||
@@ -338,7 +338,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
if (Tools::ZipExtract($file, _PS_MODULE_DIR_))
|
||||
$success = true;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
|
||||
$this->errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -346,7 +346,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
if ($archive->extract(_PS_MODULE_DIR_))
|
||||
$success = true;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
|
||||
$this->errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
|
||||
}
|
||||
|
||||
@unlink($file);
|
||||
@@ -453,23 +453,23 @@ class AdminModulesControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($module))
|
||||
{
|
||||
if (!$module->getPermission('configure'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
$this->errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
else
|
||||
{
|
||||
if ($module->uninstall())
|
||||
if ($module->install())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=21'.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name));
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot install module');
|
||||
$this->errors[] = Tools::displayError('Cannot install module');
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot uninstall module');
|
||||
$this->errors[] = Tools::displayError('Cannot uninstall module');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot load module object');
|
||||
$this->errors[] = Tools::displayError('Cannot load module object');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
|
||||
public function postProcessDownload()
|
||||
@@ -477,7 +477,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
// PrestaShop demo mode
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -485,16 +485,16 @@ class AdminModulesControllerCore extends AdminController
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
if (!isset($_FILES['file']['tmp_name']) OR empty($_FILES['file']['tmp_name']))
|
||||
$this->_errors[] = $this->l('no file selected');
|
||||
$this->errors[] = $this->l('no file selected');
|
||||
elseif (substr($_FILES['file']['name'], -4) != '.tar' AND substr($_FILES['file']['name'], -4) != '.zip' AND substr($_FILES['file']['name'], -4) != '.tgz' AND substr($_FILES['file']['name'], -7) != '.tar.gz')
|
||||
$this->_errors[] = Tools::displayError('Unknown archive type');
|
||||
$this->errors[] = Tools::displayError('Unknown archive type');
|
||||
elseif (!@copy($_FILES['file']['tmp_name'], _PS_MODULE_DIR_.$_FILES['file']['name']))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while copying archive to module directory.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying archive to module directory.');
|
||||
else
|
||||
$this->extractArchive(_PS_MODULE_DIR_.$_FILES['file']['name']);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
|
||||
public function postProcessEnable()
|
||||
@@ -505,7 +505,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($module))
|
||||
{
|
||||
if (!$module->getPermission('configure'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
$this->errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
else
|
||||
{
|
||||
if (Tools::getValue('enable'))
|
||||
@@ -516,10 +516,10 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot load module object');
|
||||
$this->errors[] = Tools::displayError('Cannot load module object');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
|
||||
public function postProcessDelete()
|
||||
@@ -530,7 +530,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
{
|
||||
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
||||
if (Validate::isLoadedObject($module) AND !$module->getPermission('configure'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
$this->errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
else
|
||||
{
|
||||
$moduleDir = _PS_MODULE_DIR_.str_replace(array('.', '/', '\\'), array('', '', ''), Tools::getValue('module_name'));
|
||||
@@ -540,7 +540,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
|
||||
public function postProcessCallback()
|
||||
@@ -585,17 +585,17 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
// Check potential error
|
||||
if (!($module = Module::getInstanceByName(urldecode($name))))
|
||||
$this->_errors[] = $this->l('module not found');
|
||||
$this->errors[] = $this->l('module not found');
|
||||
elseif ($key == 'install' AND $this->tabAccess['add'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to install a module.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to install a module.');
|
||||
elseif ($key == 'uninstall' AND ($this->tabAccess['delete'] !== '1' OR !$module->getPermission('configure')))
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete this module.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete this module.');
|
||||
elseif ($key == 'configure' AND ($this->tabAccess['edit'] !== '1' OR !$module->getPermission('configure')))
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to configure this module.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to configure this module.');
|
||||
elseif ($key == 'install' AND Module::isInstalled($module->name))
|
||||
$this->_errors[] = Tools::displayError('This module is already installed:').' '.$module->name;
|
||||
$this->errors[] = Tools::displayError('This module is already installed:').' '.$module->name;
|
||||
elseif ($key == 'uninstall' AND !Module::isInstalled($module->name))
|
||||
$this->_errors[] = Tools::displayError('This module is already uninstalled:').' '.$module->name;
|
||||
$this->errors[] = Tools::displayError('This module is already uninstalled:').' '.$module->name;
|
||||
else
|
||||
{
|
||||
// If we install a module, force temporary global context for multishop
|
||||
@@ -682,7 +682,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
{
|
||||
// If error during module installation, no redirection
|
||||
$html_error = $this->generateHtmlMessage($module_errors);
|
||||
$this->_errors[] = sprintf(Tools::displayError('The following module(s) were not installed successfully: %s'), $html_error);
|
||||
$this->errors[] = sprintf(Tools::displayError('The following module(s) were not installed successfully: %s'), $html_error);
|
||||
}
|
||||
}
|
||||
if ($return)
|
||||
@@ -958,7 +958,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
if (count($module_errors))
|
||||
{
|
||||
$html = $this->generateHtmlMessage($module_errors);
|
||||
$this->_errors[] = sprintf(Tools::displayError('The following module(s) were not upgraded successfully: %s'), $html);
|
||||
$this->errors[] = sprintf(Tools::displayError('The following module(s) were not upgraded successfully: %s'), $html);
|
||||
}
|
||||
if (count($module_success))
|
||||
{
|
||||
|
||||
@@ -49,10 +49,10 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('module cannot be loaded');
|
||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
// Add new module in hook
|
||||
@@ -67,18 +67,18 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
$hook = new Hook($id_hook);
|
||||
|
||||
if (!$id_module OR !Validate::isLoadedObject($module))
|
||||
$this->_errors[] = Tools::displayError('module cannot be loaded');
|
||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
|
||||
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||
elseif (Hook::getModulesFromHook($id_hook, $id_module))
|
||||
$this->_errors[] = Tools::displayError('This module is already transplanted to this hook.');
|
||||
$this->errors[] = Tools::displayError('This module is already transplanted to this hook.');
|
||||
elseif (!$module->isHookableOn($hook->name))
|
||||
$this->_errors[] = Tools::displayError('This module can\'t be transplanted to this hook.');
|
||||
$this->errors[] = Tools::displayError('This module can\'t be transplanted to this hook.');
|
||||
// Adding vars...
|
||||
else
|
||||
{
|
||||
if (!$module->registerHook($hook->name, Context::getContext()->shop->getListOfID()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
else
|
||||
{
|
||||
$exceptions = Tools::getValue('exceptions');
|
||||
@@ -87,18 +87,18 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
|
||||
foreach ($exceptions AS $except)
|
||||
if (!Validate::isFileName($except))
|
||||
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
|
||||
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
||||
|
||||
if (!$this->_errors && !$module->registerExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
if (!$this->errors && !$module->registerExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
|
||||
$this->errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
}
|
||||
|
||||
if (!$this->_errors)
|
||||
if (!$this->errors)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
|
||||
// Edit module from hook
|
||||
@@ -113,9 +113,9 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
$hook = new Hook($id_hook);
|
||||
|
||||
if (!$id_module OR !Validate::isLoadedObject($module))
|
||||
$this->_errors[] = Tools::displayError('module cannot be loaded');
|
||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
|
||||
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||
else
|
||||
{
|
||||
$exceptions = Tools::getValue('exceptions');
|
||||
@@ -128,16 +128,16 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
// Check files name
|
||||
foreach ($exception AS $except)
|
||||
if (!Validate::isFileName($except))
|
||||
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
|
||||
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
||||
|
||||
$exceptions[$id] = $exception;
|
||||
}
|
||||
|
||||
// Add files exceptions
|
||||
if (!$module->editExceptions($id_hook, $exceptions))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
|
||||
if (!$this->_errors)
|
||||
if (!$this->errors)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
@@ -147,18 +147,18 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
// Check files name
|
||||
foreach ($exceptions AS $except)
|
||||
if (!Validate::isFileName($except))
|
||||
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
|
||||
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
||||
|
||||
// Add files exceptions
|
||||
if (!$module->editExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
|
||||
// Delete module from hook
|
||||
@@ -171,24 +171,24 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
$id_hook = (int)(Tools::getValue('id_hook'));
|
||||
$hook = new Hook($id_hook);
|
||||
if (!Validate::isLoadedObject($module))
|
||||
$this->_errors[] = Tools::displayError('module cannot be loaded');
|
||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
|
||||
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||
else
|
||||
{
|
||||
if (!$module->unregisterHook($id_hook, Context::getContext()->shop->getListOfID()) OR !$module->unregisterExceptions($id_hook, Context::getContext()->shop->getListOfID()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting module from hook.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting module from hook.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('unhookform'))
|
||||
{
|
||||
if (!($unhooks = Tools::getValue('unhooks')) OR !is_array($unhooks))
|
||||
$this->_errors[] = Tools::displayError('Select a module to unhook.');
|
||||
$this->errors[] = Tools::displayError('Select a module to unhook.');
|
||||
else
|
||||
{
|
||||
foreach ($unhooks as $unhook)
|
||||
@@ -199,16 +199,16 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
$module = Module::getInstanceById((int)($id_module));
|
||||
$hook = new Hook((int)($id_hook));
|
||||
if (!Validate::isLoadedObject($module))
|
||||
$this->_errors[] = Tools::displayError('module cannot be loaded');
|
||||
$this->errors[] = Tools::displayError('module cannot be loaded');
|
||||
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
|
||||
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
|
||||
else
|
||||
{
|
||||
if (!$module->unregisterHook((int)($id_hook)) OR !$module->unregisterExceptions((int)($id_hook)))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting module from hook.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting module from hook.');
|
||||
}
|
||||
}
|
||||
if (!sizeof($this->_errors))
|
||||
if (!sizeof($this->errors))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
if (array_key_exists('addToHook', $_GET) OR array_key_exists('editGraft', $_GET) OR (Tools::isSubmit('submitAddToHook') AND $this->_errors))
|
||||
if (array_key_exists('addToHook', $_GET) OR array_key_exists('editGraft', $_GET) OR (Tools::isSubmit('submitAddToHook') AND $this->errors))
|
||||
{
|
||||
$this->display = 'edit';
|
||||
$this->content .= $this->renderForm();
|
||||
|
||||
@@ -4,7 +4,7 @@ class AdminNotFoundControllerCore extends AdminController
|
||||
{
|
||||
public function initContent()
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Controller not found');
|
||||
$this->errors[] = Tools::displayError('Controller not found');
|
||||
$tpl_vars['controller'] = Tools::getvalue('controller');
|
||||
|
||||
$this->context->smarty->assign($tpl_vars);
|
||||
|
||||
@@ -182,9 +182,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
$order_carrier = new OrderCarrier(Tools::getValue('id_order_carrier'));
|
||||
if (!Validate::isLoadedObject($order_carrier))
|
||||
$this->_errors[] = Tools::displayError('Order carrier ID is invalid');
|
||||
$this->errors[] = Tools::displayError('Order carrier ID is invalid');
|
||||
elseif (!Validate::isUrl(Tools::getValue('tracking_number')))
|
||||
$this->_errors[] = Tools::displayError('Tracking number is incorrect');
|
||||
$this->errors[] = Tools::displayError('Tracking number is incorrect');
|
||||
else
|
||||
{
|
||||
// update shipping number
|
||||
@@ -215,11 +215,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Order carrier can\'t be updated');
|
||||
$this->errors[] = Tools::displayError('Order carrier can\'t be updated');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
/* Change order state, add a new entry in order history and send an e-mail to the customer if needed */
|
||||
@@ -230,7 +230,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_state = new OrderState(Tools::getValue('id_order_state'));
|
||||
|
||||
if (!Validate::isLoadedObject($order_state))
|
||||
$this->_errors[] = Tools::displayError('Invalid new order status');
|
||||
$this->errors[] = Tools::displayError('Invalid new order status');
|
||||
else
|
||||
{
|
||||
// Create new OrderHistory
|
||||
@@ -257,11 +257,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// Save all changes
|
||||
if ($history->addWithemail(true, $templateVars))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder'.'&token='.$this->token);
|
||||
$this->_errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
/* Add a new message for the current order and send an e-mail to the customer if needed */
|
||||
@@ -271,9 +271,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
$customer = new Customer(Tools::getValue('id_customer'));
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
$this->_errors[] = Tools::displayError('Customer is invalid');
|
||||
$this->errors[] = Tools::displayError('Customer is invalid');
|
||||
elseif (!Tools::getValue('message'))
|
||||
$this->_errors[] = Tools::displayError('Message cannot be blank');
|
||||
$this->errors[] = Tools::displayError('Message cannot be blank');
|
||||
else
|
||||
{
|
||||
/* Get message rules and and check fields validity */
|
||||
@@ -282,16 +282,16 @@ class AdminOrdersControllerCore extends AdminController
|
||||
foreach ($rules['required'] AS $field)
|
||||
if (($value = Tools::getValue($field)) == false AND (string)$value != '0')
|
||||
if (!Tools::getValue('id_'.$this->table) OR $field != 'passwd')
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is required.');
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is required.');
|
||||
foreach ($rules['size'] AS $field => $maxLength)
|
||||
if (Tools::getValue($field) AND Tools::strlen(Tools::getValue($field)) > $maxLength)
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is too long.').' ('.$maxLength.' '.Tools::displayError('chars max').')';
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is too long.').' ('.$maxLength.' '.Tools::displayError('chars max').')';
|
||||
foreach ($rules['validate'] AS $field => $function)
|
||||
if (Tools::getValue($field))
|
||||
if (!Validate::$function(htmlentities(Tools::getValue($field), ENT_COMPAT, 'UTF-8')))
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is invalid.');
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is invalid.');
|
||||
|
||||
if (!sizeof($this->_errors))
|
||||
if (!sizeof($this->errors))
|
||||
{
|
||||
//check if a thread already exist
|
||||
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($customer->email, $order->id);
|
||||
@@ -316,7 +316,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$customer_message->message = htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8');
|
||||
$customer_message->private = Tools::getValue('visibility');
|
||||
if (!$customer_message->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while sending message.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while sending message.');
|
||||
elseif ($customer_message->private)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=11'.'&token='.$this->token);
|
||||
else
|
||||
@@ -336,12 +336,12 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=11'.'&token='.$this->token);
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while sending e-mail to customer.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while sending e-mail to customer.');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
|
||||
/* Partial refund from order */
|
||||
@@ -365,17 +365,17 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($amount > 0)
|
||||
{
|
||||
if (!OrderSlip::createPartialOrderSlip($order, $amount, $shipping_cost_amount, $order_detail_list))
|
||||
$this->_errors[] = Tools::displayError('Cannot generate partial credit slip');
|
||||
$this->errors[] = Tools::displayError('Cannot generate partial credit slip');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You have to write an amount if you want to do a partial credit slip');
|
||||
$this->errors[] = Tools::displayError('You have to write an amount if you want to do a partial credit slip');
|
||||
|
||||
// Redirect if no errors
|
||||
if (!sizeof($this->_errors))
|
||||
if (!sizeof($this->errors))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
|
||||
/* Cancel product from order */
|
||||
@@ -409,7 +409,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
$qtyCancelProduct = abs($qtyList[$key]);
|
||||
if (!$qtyCancelProduct)
|
||||
$this->_errors[] = Tools::displayError('No quantity selected for product.');
|
||||
$this->errors[] = Tools::displayError('No quantity selected for product.');
|
||||
|
||||
// check actionable quantity
|
||||
$order_detail = new OrderDetail($id_order_detail);
|
||||
@@ -418,7 +418,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$customization_quantity = (int)$customization_quantities[$order_detail->product_id][$order_detail->product_attribute_id];
|
||||
|
||||
if (($order_detail->product_quantity - $customization_quantity - $order_detail->product_quantity_refunded - $order_detail->product_quantity_return) < $qtyCancelProduct)
|
||||
$this->_errors[] = Tools::displayError('Invalid quantity selected for product.');
|
||||
$this->errors[] = Tools::displayError('Invalid quantity selected for product.');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -432,14 +432,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$customization_quantity = $customization_quantities[$id_customization];
|
||||
|
||||
if (!$qtyCancelProduct)
|
||||
$this->_errors[] = Tools::displayError('No quantity selected for product.');
|
||||
$this->errors[] = Tools::displayError('No quantity selected for product.');
|
||||
|
||||
if ($qtyCancelProduct > ($customization_quantity['quantity'] - ($customization_quantity['quantity_refunded'] + $customization_quantity['quantity_returned'])))
|
||||
$this->_errors[] = Tools::displayError('Invalid quantity selected for product.');
|
||||
$this->errors[] = Tools::displayError('Invalid quantity selected for product.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($this->_errors) AND $productList)
|
||||
if (!sizeof($this->errors) AND $productList)
|
||||
foreach ($productList AS $key => $id_order_detail)
|
||||
{
|
||||
$qty_cancel_product = abs($qtyList[$key]);
|
||||
@@ -492,25 +492,25 @@ class AdminOrdersControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot re-stock product');
|
||||
$this->errors[] = Tools::displayError('Cannot re-stock product');
|
||||
}
|
||||
|
||||
// Delete product
|
||||
$orderDetail = new OrderDetail((int)($id_order_detail));
|
||||
if (!$order->deleteProduct($order, $orderDetail, $qtyCancelProduct))
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion of the product.').' <span class="bold">'.$orderDetail->product_name.'</span>';
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion of the product.').' <span class="bold">'.$orderDetail->product_name.'</span>';
|
||||
Hook::exec('actionProductCancel', array('order' => $order, 'id_order_detail' => $id_order_detail));
|
||||
}
|
||||
if (!sizeof($this->_errors) AND $customizationList)
|
||||
if (!sizeof($this->errors) AND $customizationList)
|
||||
foreach ($customizationList AS $id_customization => $id_order_detail)
|
||||
{
|
||||
$orderDetail = new OrderDetail((int)($id_order_detail));
|
||||
$qtyCancelProduct = abs($customizationQtyList[$id_customization]);
|
||||
if (!$order->deleteCustomization($id_customization, $qtyCancelProduct, $orderDetail))
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion of product customization.').' '.$id_customization;
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion of product customization.').' '.$id_customization;
|
||||
}
|
||||
// E-mail params
|
||||
if ((isset($_POST['generateCreditSlip']) OR isset($_POST['generateDiscount'])) AND !sizeof($this->_errors))
|
||||
if ((isset($_POST['generateCreditSlip']) OR isset($_POST['generateDiscount'])) AND !sizeof($this->errors))
|
||||
{
|
||||
$customer = new Customer((int)($order->id_customer));
|
||||
$params['{lastname}'] = $customer->lastname;
|
||||
@@ -519,10 +519,10 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// Generate credit slip
|
||||
if (isset($_POST['generateCreditSlip']) AND !sizeof($this->_errors))
|
||||
if (isset($_POST['generateCreditSlip']) AND !sizeof($this->errors))
|
||||
{
|
||||
if (!OrderSlip::createOrderSlip($order, $full_product_list, $full_quantity_list, isset($_POST['shippingBack'])))
|
||||
$this->_errors[] = Tools::displayError('Cannot generate credit slip');
|
||||
$this->errors[] = Tools::displayError('Cannot generate credit slip');
|
||||
else
|
||||
{
|
||||
Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list));
|
||||
@@ -533,11 +533,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// Generate voucher
|
||||
if (isset($_POST['generateDiscount']) AND !sizeof($this->_errors))
|
||||
if (isset($_POST['generateDiscount']) AND !sizeof($this->errors))
|
||||
{
|
||||
// @todo generate a voucher using cartrules
|
||||
if (true || !$voucher = Discount::createOrderDiscount($order, $full_product_list, $full_quantity_list, $this->l('Credit Slip concerning the order #'), isset($_POST['shippingBack'])))
|
||||
$this->_errors[] = Tools::displayError('Cannot generate voucher');
|
||||
$this->errors[] = Tools::displayError('Cannot generate voucher');
|
||||
else
|
||||
{
|
||||
$currency = $this->context->currency;
|
||||
@@ -550,14 +550,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('No product or quantity selected.');
|
||||
$this->errors[] = Tools::displayError('No product or quantity selected.');
|
||||
|
||||
// Redirect if no errors
|
||||
if (!sizeof($this->_errors))
|
||||
if (!sizeof($this->errors))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('messageReaded'))
|
||||
Message::markAsReaded($_GET['messageReaded'], $this->context->employee->id);
|
||||
@@ -572,29 +572,29 @@ class AdminOrdersControllerCore extends AdminController
|
||||
else
|
||||
$order_invoice = null;
|
||||
if (!Validate::isLoadedObject($order))
|
||||
$this->_errors[] = Tools::displayError('Order can\'t be found');
|
||||
$this->errors[] = Tools::displayError('Order can\'t be found');
|
||||
elseif (!Validate::isPrice($amount))
|
||||
$this->_errors[] = Tools::displayError('Amount is invalid');
|
||||
$this->errors[] = Tools::displayError('Amount is invalid');
|
||||
elseif (!Validate::isString(Tools::getValue('payment_method')))
|
||||
$this->_errors[] = Tools::displayError('Payment method is invalid');
|
||||
$this->errors[] = Tools::displayError('Payment method is invalid');
|
||||
elseif (!Validate::isString(Tools::getValue('payment_transaction_id')))
|
||||
$this->_errors[] = Tools::displayError('Transaction ID is invalid');
|
||||
$this->errors[] = Tools::displayError('Transaction ID is invalid');
|
||||
elseif (!Validate::isLoadedObject($currency))
|
||||
$this->_errors[] = Tools::displayError('Currency is invalid');
|
||||
$this->errors[] = Tools::displayError('Currency is invalid');
|
||||
elseif ($order->hasInvoice() && !Validate::isLoadedObject($order_invoice))
|
||||
$this->_errors[] = Tools::displayError('Invoice is invalid');
|
||||
$this->errors[] = Tools::displayError('Invoice is invalid');
|
||||
elseif (!Validate::isDate(Tools::getValue('payment_date')))
|
||||
$this->_errors[] = Tools::displayError('Date is invalid');
|
||||
$this->errors[] = Tools::displayError('Date is invalid');
|
||||
else
|
||||
{
|
||||
if (!$order->addOrderPayment($amount, Tools::getValue('payment_method'), Tools::getValue('payment_transaction_id'), $currency, Tools::getValue('payment_date'), $order_invoice))
|
||||
$this->_errors[] = Tools::displayError('An error occured on adding of order payment');
|
||||
$this->errors[] = Tools::displayError('An error occured on adding of order payment');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitEditNote'))
|
||||
{
|
||||
@@ -609,13 +609,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($order_invoice->save())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order_invoice->id_order.'&vieworder&conf=4&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unable to save invoice note.');
|
||||
$this->errors[] = Tools::displayError('Unable to save invoice note.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unable to load invoice for edit note.');
|
||||
$this->errors[] = Tools::displayError('Unable to load invoice for edit note.');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitAddOrder') == 1 && ($id_cart = Tools::getValue('id_cart')) && ($module_name = pSQL(Tools::getValue('payment_module_name'))) && ($id_order_state = Tools::getValue('id_order_state')))
|
||||
{
|
||||
@@ -628,7 +628,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$payment_module->currentOrder.'&vieworder'.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
elseif ((Tools::isSubmit('submitAddressShipping') || Tools::isSubmit('submitAddressInvoice')) && isset($order))
|
||||
{
|
||||
@@ -646,10 +646,10 @@ class AdminOrdersControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayErrror('This address can\'t be loaded');
|
||||
$this->errors[] = Tools::displayErrror('This address can\'t be loaded');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitChangeCurrency') && isset($order))
|
||||
{
|
||||
@@ -718,15 +718,15 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order->update();
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You can\'t change the currency');
|
||||
$this->errors[] = Tools::displayError('You can\'t change the currency');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitGenerateInvoice') && isset($order))
|
||||
{
|
||||
if ($order->hasInvoice())
|
||||
$this->_errors[] = Tools::displayError('This order has already invoice');
|
||||
$this->errors[] = Tools::displayError('This order has already invoice');
|
||||
else
|
||||
{
|
||||
$order->setInvoice();
|
||||
@@ -772,17 +772,17 @@ class AdminOrdersControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Can\'t edit this Order Cart Rule');
|
||||
$this->errors[] = Tools::displayError('Can\'t edit this Order Cart Rule');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
elseif (Tools::getValue('submitNewVoucher') && isset($order))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (!Tools::getValue('discount_name'))
|
||||
$this->_errors[] = Tools::displayError('You must specify a name in order to create a new discount');
|
||||
$this->errors[] = Tools::displayError('You must specify a name in order to create a new discount');
|
||||
else
|
||||
{
|
||||
if ($order->hasInvoice())
|
||||
@@ -830,14 +830,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Discount value is invalid');
|
||||
$this->errors[] = Tools::displayError('Discount value is invalid');
|
||||
break;
|
||||
// Amount type
|
||||
case 2:
|
||||
if (isset($order_invoice))
|
||||
{
|
||||
if (Tools::getValue('discount_value') > $order_invoice->total_paid_tax_incl)
|
||||
$this->_errors[] = Tools::displayError('Discount value is superior than the order invoice total');
|
||||
$this->errors[] = Tools::displayError('Discount value is superior than the order invoice total');
|
||||
else
|
||||
{
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2);
|
||||
@@ -853,7 +853,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
foreach($order_invoices_collection as $order_invoice)
|
||||
{
|
||||
if (Tools::getValue('discount_value') > $order_invoice->total_paid_tax_incl)
|
||||
$this->_errors[] = Tools::displayError('Discount value is superior than the order invoice total (Invoice: ').$order_invoice->getInvoiceNumberFormatted(Context::getContext()->language->id).')';
|
||||
$this->errors[] = Tools::displayError('Discount value is superior than the order invoice total (Invoice: ').$order_invoice->getInvoiceNumberFormatted(Context::getContext()->language->id).')';
|
||||
else
|
||||
{
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2);
|
||||
@@ -867,7 +867,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
if (Tools::getValue('discount_value') > $order->total_paid_tax_incl)
|
||||
$this->_errors[] = Tools::displayError('Discount value is superior than the order total');
|
||||
$this->errors[] = Tools::displayError('Discount value is superior than the order total');
|
||||
else
|
||||
{
|
||||
$cart_rules[0]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2);
|
||||
@@ -904,7 +904,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$this->_errors[] = Tools::displayError('Discount type is invalid');
|
||||
$this->errors[] = Tools::displayError('Discount type is invalid');
|
||||
}
|
||||
|
||||
$res = true;
|
||||
@@ -933,11 +933,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($res)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occured on OrderCartRule creation');
|
||||
$this->errors[] = Tools::displayError('An error occured on OrderCartRule creation');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
parent::postProcess();
|
||||
|
||||
@@ -102,7 +102,7 @@ class AdminPaymentControllerCore extends AdminController
|
||||
$this->action ='group';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -518,23 +518,23 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
if (!Tools::getValue('memcachedIp'))
|
||||
$this->_errors[] = Tools::displayError('Memcached IP is missing');
|
||||
$this->errors[] = Tools::displayError('Memcached IP is missing');
|
||||
if (!Tools::getValue('memcachedPort'))
|
||||
$this->_errors[] = Tools::displayError('Memcached port is missing');
|
||||
$this->errors[] = Tools::displayError('Memcached port is missing');
|
||||
if (!Tools::getValue('memcachedWeight'))
|
||||
$this->_errors[] = Tools::displayError('Memcached weight is missing');
|
||||
if (!count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('Memcached weight is missing');
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (CacheMemcache::addServer(pSQL(Tools::getValue('memcachedIp')),
|
||||
(int)Tools::getValue('memcachedPort'),
|
||||
(int)Tools::getValue('memcachedWeight')))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot add Memcached server');
|
||||
$this->errors[] = Tools::displayError('Cannot add Memcached server');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
|
||||
if (Tools::getValue('deleteMemcachedServer'))
|
||||
@@ -544,10 +544,10 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
if (CacheMemcache::deleteServer((int)Tools::getValue('deleteMemcachedServer')))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error in deleting Memcached server');
|
||||
$this->errors[] = Tools::displayError('Error in deleting Memcached server');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
|
||||
$redirecAdmin = false;
|
||||
@@ -561,7 +561,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$redirecAdmin = true;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if ((bool)Tools::getValue('features_detachables_up'))
|
||||
@@ -574,7 +574,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$redirecAdmin = true;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if ((bool)Tools::getValue('ccc_up'))
|
||||
@@ -586,12 +586,12 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
!Configuration::updateValue('PS_HTML_THEME_COMPRESSION', (int)Tools::getValue('PS_HTML_THEME_COMPRESSION')) ||
|
||||
!Configuration::updateValue('PS_JS_HTML_THEME_COMPRESSION', (int)Tools::getValue('PS_JS_HTML_THEME_COMPRESSION')) ||
|
||||
!Configuration::updateValue('PS_HIGH_HTML_THEME_COMPRESSION', (int)Tools::getValue('PS_HIGH_HTML_THEME_COMPRESSION')))
|
||||
$this->_errors[] = Tools::displayError('Unknown error.');
|
||||
$this->errors[] = Tools::displayError('Unknown error.');
|
||||
else
|
||||
$redirecAdmin = true;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if ((bool)Tools::getValue('media_server_up'))
|
||||
@@ -599,12 +599,12 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (Tools::getValue('_MEDIA_SERVER_1_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_1_')))
|
||||
$this->_errors[] = Tools::displayError('Media server #1 is invalid');
|
||||
$this->errors[] = Tools::displayError('Media server #1 is invalid');
|
||||
if (Tools::getValue('_MEDIA_SERVER_2_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_2_')))
|
||||
$this->_errors[] = Tools::displayError('Media server #2 is invalid');
|
||||
$this->errors[] = Tools::displayError('Media server #2 is invalid');
|
||||
if (Tools::getValue('_MEDIA_SERVER_3_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_3_')))
|
||||
$this->_errors[] = Tools::displayError('Media server #3 is invalid');
|
||||
if (!count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('Media server #3 is invalid');
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$base_urls = array();
|
||||
$base_urls['_MEDIA_SERVER_1_'] = Tools::getValue('_MEDIA_SERVER_1_');
|
||||
@@ -618,7 +618,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if ((bool)Tools::getValue('ciphering_up') && Configuration::get('PS_CIPHER_ALGORITHM') != (int)Tools::getValue('PS_CIPHER_ALGORITHM'))
|
||||
@@ -630,7 +630,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
if ($algo)
|
||||
{
|
||||
if (!function_exists('mcrypt_encrypt'))
|
||||
$this->_errors[] = Tools::displayError('Mcrypt is not activated on this server.');
|
||||
$this->errors[] = Tools::displayError('Mcrypt is not activated on this server.');
|
||||
else
|
||||
{
|
||||
if (!strstr($settings, '_RIJNDAEL_KEY_'))
|
||||
@@ -655,7 +655,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $settings))
|
||||
{
|
||||
@@ -663,11 +663,11 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$redirecAdmin = true;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot overwrite settings file.');
|
||||
$this->errors[] = Tools::displayError('Cannot overwrite settings file.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if ((bool)Tools::getValue('cache_up'))
|
||||
@@ -680,7 +680,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
else
|
||||
$cache_active = 1;
|
||||
if (!$caching_system = Tools::getValue('caching_system'))
|
||||
$this->_errors[] = Tools::displayError('Caching system is missing');
|
||||
$this->errors[] = Tools::displayError('Caching system is missing');
|
||||
else
|
||||
$settings = preg_replace(
|
||||
'/define\(\'_PS_CACHING_SYSTEM_\', \'([a-z0-9=\/+-_]+)\'\);/Ui',
|
||||
@@ -688,23 +688,23 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$settings
|
||||
);
|
||||
if ($cache_active && $caching_system == 'CacheMemcache' && !extension_loaded('memcache'))
|
||||
$this->_errors[] = Tools::displayError('To use Memcached, you must install the Memcache PECL extension on your server.').'
|
||||
$this->errors[] = Tools::displayError('To use Memcached, you must install the Memcache PECL extension on your server.').'
|
||||
<a href="http://www.php.net/manual/en/memcache.installation.php">http://www.php.net/manual/en/memcache.installation.php</a>';
|
||||
else if ($cache_active && $caching_system == 'CacheApc' && !extension_loaded('apc'))
|
||||
$this->_errors[] = Tools::displayError('To use APC cache, you must install the APC PECL extension on your server.').'
|
||||
$this->errors[] = Tools::displayError('To use APC cache, you must install the APC PECL extension on your server.').'
|
||||
<a href="http://fr.php.net/manual/fr/apc.installation.php">http://fr.php.net/manual/fr/apc.installation.php</a>';
|
||||
else if ($cache_active && $caching_system == 'CacheXcache' && !extension_loaded('xcache'))
|
||||
$this->_errors[] = Tools::displayError('To use Xcache, you must install the Xcache extension on your server.').'
|
||||
$this->errors[] = Tools::displayError('To use Xcache, you must install the Xcache extension on your server.').'
|
||||
<a href="http://xcache.lighttpd.net">http://xcache.lighttpd.net</a>';
|
||||
else if ($cache_active && $caching_system == 'CacheFs' && !is_writable(_PS_CACHEFS_DIRECTORY_))
|
||||
$this->_errors[] = Tools::displayError('To use CacheFS the directory').' '.
|
||||
$this->errors[] = Tools::displayError('To use CacheFS the directory').' '.
|
||||
realpath(_PS_CACHEFS_DIRECTORY_).' '.Tools::displayError('must be writable');
|
||||
|
||||
if ($caching_system == 'CacheFs' && $cache_active)
|
||||
{
|
||||
if (!($depth = Tools::getValue('ps_cache_fs_directory_depth')))
|
||||
$this->_errors[] = Tools::displayError('Please set a directory depth');
|
||||
if (!count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('Please set a directory depth');
|
||||
if (!count($this->errors))
|
||||
{
|
||||
CacheFs::deleteCacheDirectory();
|
||||
CacheFs::createCacheDirectories((int)$depth);
|
||||
@@ -714,17 +714,17 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
else if($caching_system == 'MCached' && $cache_active && !_PS_CACHE_ENABLED_ && _PS_CACHING_SYSTEM_ == 'MCached')
|
||||
Cache::getInstance()->flush();
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$settings = preg_replace('/define\(\'_PS_CACHE_ENABLED_\', \'([0-9])\'\);/Ui', 'define(\'_PS_CACHE_ENABLED_\', \''.(int)$cache_active.'\');', $settings);
|
||||
if (file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $settings))
|
||||
$redirecAdmin = true;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot overwrite settings file.');
|
||||
$this->errors[] = Tools::displayError('Cannot overwrite settings file.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if ($redirecAdmin)
|
||||
|
||||
@@ -377,7 +377,7 @@ class AdminPreferencesControllerCore extends AdminController
|
||||
|
||||
if (Tools::getValue('PS_LIMIT_UPLOAD_FILE_VALUE') > $max_size or Tools::getValue('PS_LIMIT_UPLOAD_IMAGE_VALUE') > $max_size)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('The limit choosen is superior to the server\'s maximum upload file You need to improve the limit of your server.');
|
||||
$this->errors[] = Tools::displayError('The limit choosen is superior to the server\'s maximum upload file You need to improve the limit of your server.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ class AdminPreferencesControllerCore extends AdminController
|
||||
$sql = 'SELECT `id_cms` FROM `'._DB_PREFIX_.'cms`
|
||||
WHERE id_cms = '.(int)Tools::getValue('PS_CONDITIONS_CMS_ID');
|
||||
if (Tools::getValue('PS_CONDITIONS') && (Tools::getValue('PS_CONDITIONS_CMS_ID') == 0 || !Db::getInstance()->getValue($sql)))
|
||||
$this->_errors[] = Tools::displayError('Assign a valid CMS page if you want it to be read.');
|
||||
$this->errors[] = Tools::displayError('Assign a valid CMS page if you want it to be read.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -313,27 +313,27 @@ class AdminProductsControllerCore extends AdminController
|
||||
$is_attachment_name_valid = true;
|
||||
|
||||
if (!Validate::isGenericName(Tools::getValue('attachment_name_'.(int)($language['id_lang']))))
|
||||
$this->_errors[] = Tools::displayError('Invalid Name');
|
||||
$this->errors[] = Tools::displayError('Invalid Name');
|
||||
else if (Tools::strlen(Tools::getValue('attachment_name_'.(int)($language['id_lang']))) > 32)
|
||||
$this->_errors[] = Tools::displayError('Name is too long.').' '.'(32 '.Tools::displayError('chars max').')';
|
||||
$this->errors[] = Tools::displayError('Name is too long.').' '.'(32 '.Tools::displayError('chars max').')';
|
||||
if (!Validate::isCleanHtml(Tools::getValue('attachment_description_'.(int)($language['id_lang']))))
|
||||
$this->_errors[] = Tools::displayError('Invalid description');
|
||||
$this->errors[] = Tools::displayError('Invalid description');
|
||||
}
|
||||
if (!$is_attachment_name_valid)
|
||||
$this->_errors[] = Tools::displayError('Attachment Name Required');
|
||||
$this->errors[] = Tools::displayError('Attachment Name Required');
|
||||
|
||||
if (empty($this->_errors))
|
||||
if (empty($this->errors))
|
||||
{
|
||||
if (isset($_FILES['attachment_file']) && is_uploaded_file($_FILES['attachment_file']['tmp_name']))
|
||||
{
|
||||
if ($_FILES['attachment_file']['size'] > (Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 * 1024))
|
||||
$this->_errors[] = $this->l('File too large, maximum size allowed:').' '.(Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024).' '.$this->l('kb').'. '.$this->l('File size you\'re trying to upload is:').number_format(($_FILES['attachment_file']['size']/1024), 2, '.', '').$this->l('kb');
|
||||
$this->errors[] = $this->l('File too large, maximum size allowed:').' '.(Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024).' '.$this->l('kb').'. '.$this->l('File size you\'re trying to upload is:').number_format(($_FILES['attachment_file']['size']/1024), 2, '.', '').$this->l('kb');
|
||||
else
|
||||
{
|
||||
do $uniqid = sha1(microtime());
|
||||
while (file_exists(_PS_DOWNLOAD_DIR_.$uniqid));
|
||||
if (!copy($_FILES['attachment_file']['tmp_name'], _PS_DOWNLOAD_DIR_.$uniqid))
|
||||
$this->_errors[] = $this->l('File copy failed');
|
||||
$this->errors[] = $this->l('File copy failed');
|
||||
@unlink($_FILES['attachment_file']['tmp_name']);
|
||||
}
|
||||
}
|
||||
@@ -342,12 +342,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
$max_upload = (int)ini_get('upload_max_filesize');
|
||||
$max_post = (int)ini_get('post_max_size');
|
||||
$upload_mb = min($max_upload, $max_post);
|
||||
$this->_errors[] = $this->l('the File').' <b>'.$_FILES['attachment_file']['name'].'</b> '.$this->l('exceeds the size allowed by the server, this limit is set to').' <b>'.$upload_mb.$this->l('Mb').'</b>';
|
||||
$this->errors[] = $this->l('the File').' <b>'.$_FILES['attachment_file']['name'].'</b> '.$this->l('exceeds the size allowed by the server, this limit is set to').' <b>'.$upload_mb.$this->l('Mb').'</b>';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('File is missing');
|
||||
$this->errors[] = Tools::displayError('File is missing');
|
||||
|
||||
if (empty($this->_errors) && isset($uniqid))
|
||||
if (empty($this->errors) && isset($uniqid))
|
||||
{
|
||||
$attachment = new Attachment();
|
||||
foreach ($languages as $language)
|
||||
@@ -361,18 +361,18 @@ class AdminProductsControllerCore extends AdminController
|
||||
$attachment->mime = $_FILES['attachment_file']['type'];
|
||||
$attachment->file_name = pSQL($_FILES['attachment_file']['name']);
|
||||
if (empty($attachment->mime) || Tools::strlen($attachment->mime) > 128)
|
||||
$this->_errors[] = Tools::displayError('Invalid file extension');
|
||||
$this->errors[] = Tools::displayError('Invalid file extension');
|
||||
if (!Validate::isGenericName($attachment->file_name))
|
||||
$this->_errors[] = Tools::displayError('Invalid file name');
|
||||
$this->errors[] = Tools::displayError('Invalid file name');
|
||||
if (Tools::strlen($attachment->file_name) > 128)
|
||||
$this->_errors[] = Tools::displayError('File name too long');
|
||||
if (!count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('File name too long');
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$attachment->add();
|
||||
$this->confirmations[] = $this->l('Attachment successfully added');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Invalid file');
|
||||
$this->errors[] = Tools::displayError('Invalid file');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,7 +421,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
Product::updateDefaultAttribute($product->id);
|
||||
|
||||
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while copying images.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying images.');
|
||||
else
|
||||
{
|
||||
Hook::exec('actionProductAdd', array('product' => $product));
|
||||
@@ -430,7 +430,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating object.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
// check if request at least one object with noZeroObject
|
||||
if (isset($object->noZeroObject) && count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
$this->errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
else
|
||||
{
|
||||
$id_category = Tools::getValue('id_category');
|
||||
@@ -455,11 +455,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
else if ($object->delete())
|
||||
$this->redirect_after = self::$currentIndex.'&conf=1&token='.($token ? $token : $this->token).$category_url;
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
|
||||
public function processImage($token)
|
||||
@@ -484,7 +484,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
Image::deleteCover($image->id_product);
|
||||
$image->cover = 1;
|
||||
if (!$image->update())
|
||||
$this->_errors[] = Tools::displayError('Cannot change the product cover');
|
||||
$this->errors[] = Tools::displayError('Cannot change the product cover');
|
||||
else
|
||||
{
|
||||
$productId = (int)(Tools::getValue('id_product'));
|
||||
@@ -502,7 +502,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Could not find image.');
|
||||
$this->errors[] = Tools::displayError('Could not find image.');
|
||||
}
|
||||
|
||||
public function processBulkDelete($token)
|
||||
@@ -514,7 +514,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (isset($object->noZeroObject) &&
|
||||
// Check if all object will be deleted
|
||||
(count(call_user_func(array($this->className, $object->noZeroObject))) <= 1 || count($_POST[$this->table.'Box']) == count(call_user_func(array($this->className, $object->noZeroObject)))))
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
$this->errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
else
|
||||
{
|
||||
$result = true;
|
||||
@@ -537,11 +537,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
$this->redirect_after = self::$currentIndex.'&conf=2&token='.$token.$category_url;
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
$this->errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
|
||||
public function processProductAttribute($token)
|
||||
@@ -554,11 +554,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||
{
|
||||
if (!isset($_POST['attribute_price']) || $_POST['attribute_price'] == null)
|
||||
$this->_errors[] = Tools::displayError('Attribute price required.');
|
||||
$this->errors[] = Tools::displayError('Attribute price required.');
|
||||
if (!isset($_POST['attribute_combinaison_list']) || !count($_POST['attribute_combinaison_list']))
|
||||
$this->_errors[] = Tools::displayError('You must add at least one attribute.');
|
||||
$this->errors[] = Tools::displayError('You must add at least one attribute.');
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (!isset($_POST['attribute_wholesale_price'])) $_POST['attribute_wholesale_price'] = 0;
|
||||
if (!isset($_POST['attribute_price_impact'])) $_POST['attribute_price_impact'] = 0;
|
||||
@@ -572,7 +572,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if ($product->productAttributeExists($_POST['attribute_combinaison_list'], $id_product_attribute))
|
||||
$this->_errors[] = Tools::displayError('This attribute already exists.');
|
||||
$this->errors[] = Tools::displayError('This attribute already exists.');
|
||||
else
|
||||
{
|
||||
if (Validate::isDateFormat(Tools::getValue('available_date_attribute')))
|
||||
@@ -595,17 +595,17 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($id_reason = (int)Tools::getValue('id_mvt_reason') && (int)Tools::getValue('attribute_mvt_quantity') > 0 && $id_reason > 0)
|
||||
{
|
||||
if (!$product->addStockMvt(Tools::getValue('attribute_mvt_quantity'), $id_reason, $id_product_attribute, null, $this->context->employee->id))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating qty.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating qty.');
|
||||
}
|
||||
Hook::exec('actionProductAttributeUpdate', array('id_product_attribute' => (int)$id_product_attribute));
|
||||
$this->updateDownloadProduct($product, 1, $id_product_attribute);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Invalid date format.');
|
||||
$this->errors[] = Tools::displayError('Invalid date format.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
// Add new
|
||||
else
|
||||
@@ -613,7 +613,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
if ($product->productAttributeExists($_POST['attribute_combinaison_list']))
|
||||
$this->_errors[] = Tools::displayError('This combination already exists.');
|
||||
$this->errors[] = Tools::displayError('This combination already exists.');
|
||||
else
|
||||
$id_product_attribute = $product->addCombinationEntity(
|
||||
Tools::getValue('attribute_wholesale_price'),
|
||||
@@ -632,15 +632,15 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->updateDownloadProduct($product, 0, $id_product_attribute);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to').'<hr>'.Tools::displayError('Edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to').'<hr>'.Tools::displayError('Edit here.');
|
||||
}
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$combination = new Combination((int)$id_product_attribute);
|
||||
$combination->setAttributes(Tools::getValue('attribute_combinaison_list'));
|
||||
$product->checkDefaultAttributes();
|
||||
}
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (!$product->cache_default_attribute)
|
||||
Product::updateDefaultAttribute($product->id);
|
||||
@@ -690,11 +690,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
$this->redirect_after = self::$currentIndex.'&id_product='.(int)$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&action=Features&conf=4&token='.($token ? $token : $this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Product must be created before adding features.');
|
||||
$this->errors[] = Tools::displayError('Product must be created before adding features.');
|
||||
}
|
||||
|
||||
public function processPricesModification($token)
|
||||
@@ -728,9 +728,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
$specific_price->from = !$froms[$key] ? '0000-00-00 00:00:00' : $froms[$key];
|
||||
$specific_price->to = !$tos[$key] ? '0000-00-00 00:00:00' : $tos[$key];
|
||||
if (!$specific_price->update())
|
||||
$this->_errors = Tools::displayError('An error occurred while updating the specific price.');
|
||||
$this->errors = Tools::displayError('An error occurred while updating the specific price.');
|
||||
}
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
$this->redirect_after = self::$currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&update'.$this->table.'&action=Prices&token='.($token ? $token : $this->token);
|
||||
|
||||
}
|
||||
@@ -766,7 +766,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$specificPrice->from = !$from ? '0000-00-00 00:00:00' : $from;
|
||||
$specificPrice->to = !$to ? '0000-00-00 00:00:00' : $to;
|
||||
if (!$specificPrice->add())
|
||||
$this->_errors = Tools::displayError('An error occurred while updating the specific price.');
|
||||
$this->errors = Tools::displayError('An error occurred while updating the specific price.');
|
||||
else
|
||||
$this->redirect_after = self::$currentIndex.(Tools::getValue('id_category') ? '&id_category='.Tools::getValue('id_category') : '').'&id_product='.$id_product.'&add'.$this->table.'&action=Prices&conf=3&token='.($token ? $token : $this->token);
|
||||
}
|
||||
@@ -778,12 +778,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
return;
|
||||
$id_specific_price = Tools::getValue('id_specific_price');
|
||||
if (!$id_specific_price || !Validate::isUnsignedId($id_specific_price))
|
||||
$this->_errors[] = Tools::displayError('Invalid specific price ID');
|
||||
$this->errors[] = Tools::displayError('Invalid specific price ID');
|
||||
else
|
||||
{
|
||||
$specificPrice = new SpecificPrice((int)($id_specific_price));
|
||||
if (!$specificPrice->delete())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting the specific price');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting the specific price');
|
||||
else
|
||||
$this->confirmations[] = $this->l('Specific price successfully deleted');
|
||||
}
|
||||
@@ -794,16 +794,16 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (!($obj = $this->loadObject()))
|
||||
return;
|
||||
if (!$priorities = Tools::getValue('specificPricePriority'))
|
||||
$this->_errors[] = Tools::displayError('Please specify priorities');
|
||||
$this->errors[] = Tools::displayError('Please specify priorities');
|
||||
else if (Tools::isSubmit('specificPricePriorityToAll'))
|
||||
{
|
||||
if (!SpecificPrice::setPriorities($priorities))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating priorities.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating priorities.');
|
||||
else
|
||||
$this->confirmations[] = $this->l('Price rule successfully updated');
|
||||
}
|
||||
else if (!SpecificPrice::setSpecificPriority((int)($obj->id), $priorities))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while setting priorities.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while setting priorities.');
|
||||
else
|
||||
$this->confirmations[] = $this->l('Price priorities successfully updated');
|
||||
}
|
||||
@@ -813,19 +813,19 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($product = new Product(Tools::getValue('id_product'))))
|
||||
{
|
||||
if (!$product->createLabels((int)($_POST['uploadable_files']) - (int)($product->uploadable_files), (int)($_POST['text_fields']) - (int)($product->text_fields)))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating customization fields.');
|
||||
if (!count($this->_errors) && !$product->updateLabels())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customization.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating customization fields.');
|
||||
if (!count($this->errors) && !$product->updateLabels())
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating customization.');
|
||||
$product->uploadable_files = (int)($_POST['uploadable_files']);
|
||||
$product->text_fields = (int)($_POST['text_fields']);
|
||||
$product->customizable = ((int)($_POST['uploadable_files']) > 0 || (int)($_POST['text_fields']) > 0) ? 1 : 0;
|
||||
if (!count($this->_errors) && !$product->update())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customization configuration.');
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors) && !$product->update())
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating customization configuration.');
|
||||
if (!count($this->errors))
|
||||
$this->redirect_after = self::$currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&action=Customization&token='.($token ? $token : $this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Product must be created before adding customization possibilities.');
|
||||
$this->errors[] = Tools::displayError('Product must be created before adding customization possibilities.');
|
||||
}
|
||||
|
||||
public function processProductCustomization($token)
|
||||
@@ -834,14 +834,14 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
foreach ($_POST as $field => $value)
|
||||
if (strncmp($field, 'label_', 6) == 0 && !Validate::isLabel($value))
|
||||
$this->_errors[] = Tools::displayError('Label fields are invalid');
|
||||
if (!count($this->_errors) && !$product->updateLabels())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customization.');
|
||||
if (!count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('Label fields are invalid');
|
||||
if (!count($this->errors) && !$product->updateLabels())
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating customization.');
|
||||
if (!count($this->errors))
|
||||
$this->redirect_after = self::$currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&action=Customization&add'.$this->table.'&token='.($token ? $token : $this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Product must be created before adding customization possibilities.');
|
||||
$this->errors[] = Tools::displayError('Product must be created before adding customization possibilities.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -852,11 +852,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').
|
||||
' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
$this->errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
$this->redirect_after = self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&action=Customization&conf=5'.(($id_category = (!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1')) ? ('&id_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminProducts');
|
||||
}
|
||||
@@ -869,14 +869,14 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
$this->action = 'deleteVirtualProduct';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else if (Tools::getValue('deleteVirtualProductAttribute'))/* Delete a product in the download folder */
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
$this->action = 'deleteVirtualProductAttribute';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
// Update attachments
|
||||
else if (Tools::isSubmit('submitAddAttachments'))
|
||||
@@ -887,7 +887,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->tab_display = 'attachments';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitAttachments'))
|
||||
{
|
||||
@@ -897,7 +897,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->tab_display = 'attachments';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
// Product duplication
|
||||
else if (isset($_GET['duplicate'.$this->table]))
|
||||
@@ -905,7 +905,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
$this->action = 'duplicate';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
// Product images management
|
||||
else if (Tools::getValue('id_image') && Tools::getValue('ajax'))
|
||||
@@ -913,7 +913,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->action = 'image';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
// Product attributes management
|
||||
else if (Tools::isSubmit('submitProductAttribute'))
|
||||
@@ -921,7 +921,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->action = 'productAttribute';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
// Product features management
|
||||
else if (Tools::isSubmit('submitFeatures') || Tools::isSubmit('submitFeaturesAndStay'))
|
||||
@@ -929,7 +929,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->action = 'features';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
// Product specific prices management
|
||||
else if (Tools::isSubmit('submitPricesModification'))
|
||||
@@ -937,21 +937,21 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
$this->action = 'pricesModification';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitPriceAddition'))
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
$this->action = 'priceAddition';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
else if (Tools::isSubmit('deleteSpecificPrice'))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
$this->action = 'deleteSpecificPrice';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitSpecificPricePriorities'))
|
||||
{
|
||||
@@ -961,7 +961,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->tab_display = 'prices';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
// Customization management
|
||||
else if (Tools::isSubmit('submitCustomizationConfiguration'))
|
||||
@@ -969,14 +969,14 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->action = 'customizationConfiguration';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitProductCustomization'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->action = 'productCustomization';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if (!$this->action)
|
||||
@@ -999,7 +999,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|| Tools::isSubmit('submitSpecificPricePriorities')
|
||||
|| Tools::isSubmit('submitPriceAddition')
|
||||
|| Tools::isSubmit('submitPricesModification'))
|
||||
&& count($this->_errors))
|
||||
&& count($this->errors))
|
||||
|| Tools::isSubmit('updateproduct')
|
||||
|| Tools::isSubmit('addproduct'))
|
||||
$this->display = 'edit';
|
||||
@@ -1190,7 +1190,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($res)
|
||||
$this->confirmations[] = $this->_conf[27];
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error on picture shop association');
|
||||
$this->errors[] = Tools::displayError('Error on picture shop association');
|
||||
$this->status = 'ok';
|
||||
}
|
||||
|
||||
@@ -1226,7 +1226,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($res)
|
||||
$this->confirmations[] = $this->_conf[25];
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error on moving picture');
|
||||
$this->errors[] = Tools::displayError('Error on moving picture');
|
||||
$this->status = 'ok';
|
||||
}
|
||||
|
||||
@@ -1243,7 +1243,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($img->update())
|
||||
$this->confirmations[] = $this->_conf[26];
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error on moving picture');
|
||||
$this->errors[] = Tools::displayError('Error on moving picture');
|
||||
}
|
||||
|
||||
public function ajaxProcessDeleteProductImage()
|
||||
@@ -1272,7 +1272,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($res)
|
||||
$this->confirmations[] = $this->_conf[7];
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error on deleting product image');
|
||||
$this->errors[] = Tools::displayError('Error on deleting product image');
|
||||
|
||||
$this->status = 'ok';
|
||||
}
|
||||
@@ -1280,15 +1280,15 @@ class AdminProductsControllerCore extends AdminController
|
||||
protected function _validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_shop) || !Validate::isUnsignedId($id_currency) || !Validate::isUnsignedId($id_country) || !Validate::isUnsignedId($id_group) || !Validate::isUnsignedId($id_customer))
|
||||
$this->_errors[] = Tools::displayError('Wrong ID\'s');
|
||||
$this->errors[] = Tools::displayError('Wrong ID\'s');
|
||||
else if ((empty($price) && empty($reduction)) || (!empty($price) && !Validate::isPrice($price)) || (!empty($reduction) && !Validate::isPrice($reduction)))
|
||||
$this->_errors[] = Tools::displayError('Invalid price/reduction amount');
|
||||
$this->errors[] = Tools::displayError('Invalid price/reduction amount');
|
||||
else if (!Validate::isUnsignedInt($from_quantity))
|
||||
$this->_errors[] = Tools::displayError('Invalid quantity');
|
||||
$this->errors[] = Tools::displayError('Invalid quantity');
|
||||
else if ($reduction && !Validate::isReductionType($reduction_type))
|
||||
$this->_errors[] = Tools::displayError('Please select a reduction type (amount or percentage)');
|
||||
$this->errors[] = Tools::displayError('Please select a reduction type (amount or percentage)');
|
||||
else if ($from && $to && (!Validate::isDateFormat($from) || !Validate::isDateFormat($to)))
|
||||
$this->_errors[] = Tools::displayError('Wrong from/to date');
|
||||
$this->errors[] = Tools::displayError('Wrong from/to date');
|
||||
else
|
||||
return true;
|
||||
return false;
|
||||
@@ -1305,10 +1305,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$current_language = new Language($language['id_lang']);
|
||||
if (Tools::strlen($val) > $rules['sizeLang']['value'])
|
||||
$this->_errors[] = Tools::displayError('name for feature').' <b>'.$feature['name'].'</b> '.Tools::displayError('is too long in').' '.$current_language->name;
|
||||
$this->errors[] = Tools::displayError('name for feature').' <b>'.$feature['name'].'</b> '.Tools::displayError('is too long in').' '.$current_language->name;
|
||||
else if (!call_user_func(array('Validate', $rules['validateLang']['value']), $val))
|
||||
$this->_errors[] = Tools::displayError('Valid name required for feature.').' <b>'.$feature['name'].'</b> '.Tools::displayError('in').' '.$current_language->name;
|
||||
if (count($this->_errors))
|
||||
$this->errors[] = Tools::displayError('Valid name required for feature.').' <b>'.$feature['name'].'</b> '.Tools::displayError('in').' '.$current_language->name;
|
||||
if (count($this->errors))
|
||||
return (0);
|
||||
// Getting default language
|
||||
if ($language['id_lang'] == Configuration::get('PS_LANG_DEFAULT'))
|
||||
@@ -1329,7 +1329,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$image = new Image($id_image);
|
||||
if (!Validate::isLoadedObject($image))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while loading object image.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while loading object image.');
|
||||
else
|
||||
{
|
||||
if (($cover = Tools::getValue('cover')) == 1)
|
||||
@@ -1337,15 +1337,15 @@ class AdminProductsControllerCore extends AdminController
|
||||
$image->cover = $cover;
|
||||
$this->validateRules('Image');
|
||||
$this->copyFromPost($image, 'image');
|
||||
if (count($this->_errors) || !$image->update())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating image.');
|
||||
if (count($this->errors) || !$image->update())
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating image.');
|
||||
else if (isset($_FILES['image_product']['tmp_name']) && $_FILES['image_product']['tmp_name'] != null)
|
||||
$this->copyImage($product->id, $image->id, $method);
|
||||
}
|
||||
}
|
||||
if (isset($image) && Validate::isLoadedObject($image) && !file_exists(_PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$image->image_format))
|
||||
$image->delete();
|
||||
if (count($this->_errors))
|
||||
if (count($this->errors))
|
||||
return false;
|
||||
@unlink(_PS_TMP_IMG_DIR_.'product_'.$product->id.'.jpg');
|
||||
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$product->id.'.jpg');
|
||||
@@ -1362,17 +1362,17 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (!isset($_FILES['image_product']['tmp_name']))
|
||||
return false;
|
||||
if ($error = checkImage($_FILES['image_product']))
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
else
|
||||
{
|
||||
$image = new Image($id_image);
|
||||
|
||||
if (!$new_path = $image->getPathForCreation())
|
||||
$this->_errors[] = Tools::displayError('An error occurred during new folder creation');
|
||||
$this->errors[] = Tools::displayError('An error occurred during new folder creation');
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES['image_product']['tmp_name'], $tmpName))
|
||||
$this->_errors[] = Tools::displayError('An error occurred during the image upload');
|
||||
$this->errors[] = Tools::displayError('An error occurred during the image upload');
|
||||
else if (!imageResize($tmpName, $new_path.'.'.$image->image_format))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while copying image.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying image.');
|
||||
else if ($method == 'auto')
|
||||
{
|
||||
$imagesTypes = ImageType::getImagesTypes('products');
|
||||
@@ -1380,7 +1380,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
|
||||
if (!imageResize($tmpName, $new_path.'-'.stripslashes($image_type['name']).$theme.'.'.$image->image_format, $image_type['width'], $image_type['height'], $image->image_format))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($image_type['name']);
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($image_type['name']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1393,7 +1393,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$this->checkProduct();
|
||||
|
||||
if (!empty($this->_errors))
|
||||
if (!empty($this->errors))
|
||||
return false;
|
||||
|
||||
$object = new $this->className();
|
||||
@@ -1406,16 +1406,16 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->updateAssoShop((int)$object->id);
|
||||
$this->updateAccessories($object);
|
||||
if (!$this->updatePackItems($object))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||
$this->updateDownloadProduct($object);
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
if (!$object->updateCategories($_POST['categoryBox']))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while linking object.').' <b>'.$this->table.'</b> '.Tools::displayError('To categories');
|
||||
$this->errors[] = Tools::displayError('An error occurred while linking object.').' <b>'.$this->table.'</b> '.Tools::displayError('To categories');
|
||||
else if (!$this->updateTags($languages, $object))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while adding tags.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while adding tags.');
|
||||
else
|
||||
{
|
||||
Hook::exec('actionProductAdd', array('product' => $object));
|
||||
@@ -1456,14 +1456,14 @@ class AdminProductsControllerCore extends AdminController
|
||||
$object->delete();
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
}
|
||||
|
||||
public function processUpdate($token)
|
||||
{
|
||||
$this->checkProduct();
|
||||
|
||||
if (!empty($this->_errors))
|
||||
if (!empty($this->errors))
|
||||
return false;
|
||||
|
||||
$id = (int)Tools::getValue('id_'.$this->table);
|
||||
@@ -1482,7 +1482,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($id_reason = (int)Tools::getValue('id_mvt_reason') && Tools::getValue('mvt_quantity') > 0 && $id_reason > 0)
|
||||
{
|
||||
if (!$object->addStockMvt(Tools::getValue('mvt_quantity'), $id_reason, null, null, $this->context->employee->id))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating qty.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating qty.');
|
||||
}
|
||||
$this->updateAccessories($object);
|
||||
$this->updateDownloadProduct($object, 1);
|
||||
@@ -1493,11 +1493,11 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->processFeatures($token);
|
||||
$languages = Language::getLanguages(false);
|
||||
if (!$this->updatePackItems($object))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||
else if (!$object->updateCategories($_POST['categoryBox'], true))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while linking object.').' <b>'.$this->table.'</b> '.Tools::displayError('To categories');
|
||||
$this->errors[] = Tools::displayError('An error occurred while linking object.').' <b>'.$this->table.'</b> '.Tools::displayError('To categories');
|
||||
else if (!$this->updateTags($languages, $object))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while adding tags.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while adding tags.');
|
||||
else
|
||||
{
|
||||
//self::$currentIndex .= '&image_updated='.$id_image;
|
||||
@@ -1535,10 +1535,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> ('.Db::getInstance()->getMsgError().')';
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> ('.Db::getInstance()->getMsgError().')';
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> ('.Tools::displayError('Cannot load object').')';
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> ('.Tools::displayError('Cannot load object').')';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1559,18 +1559,18 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (Tools::getValue('id_'.$this->table) && $field == 'passwd')
|
||||
continue;
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is required');
|
||||
$this->errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is required');
|
||||
}
|
||||
|
||||
/* Check multilingual required fields */
|
||||
foreach ($rules['requiredLang'] as $fieldLang)
|
||||
if (!Tools::getValue($fieldLang.'_'.$default_language->id))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).'</b> '.$this->l('is required at least in').' '.$default_language->name;
|
||||
$this->errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).'</b> '.$this->l('is required at least in').' '.$default_language->name;
|
||||
|
||||
/* Check fields sizes */
|
||||
foreach ($rules['size'] as $field => $maxLength)
|
||||
if ($value = Tools::getValue($field) && Tools::strlen($value) > $maxLength)
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
$this->errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
|
||||
if (isset($_POST['description_short']))
|
||||
{
|
||||
@@ -1584,12 +1584,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
foreach ($languages as $language)
|
||||
if ($value = Tools::getValue('description_short_'.$language['id_lang']))
|
||||
if (Tools::strlen(strip_tags($value)) > $limit)
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), 'description_short').' ('.$language['name'].')</b> '.$this->l('is too long').' : '.$limit.' '.$this->l('chars max').' ('.$this->l('count now').' '.Tools::strlen(strip_tags($value)).')';
|
||||
$this->errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), 'description_short').' ('.$language['name'].')</b> '.$this->l('is too long').' : '.$limit.' '.$this->l('chars max').' ('.$this->l('count now').' '.Tools::strlen(strip_tags($value)).')';
|
||||
/* Check multilingual fields sizes */
|
||||
foreach ($rules['sizeLang'] as $fieldLang => $maxLength)
|
||||
foreach ($languages as $language)
|
||||
if ($value = Tools::getValue($fieldLang.'_'.$language['id_lang']) && Tools::strlen($value) > $maxLength)
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
$this->errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
if (isset($_POST['description_short']))
|
||||
$_POST['description_short'] = $saveShort;
|
||||
|
||||
@@ -1597,28 +1597,28 @@ class AdminProductsControllerCore extends AdminController
|
||||
foreach ($rules['validate'] as $field => $function)
|
||||
if ($value = Tools::getValue($field))
|
||||
if (!Validate::$function($value))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid');
|
||||
$this->errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid');
|
||||
|
||||
/* Check multilingual fields validity */
|
||||
foreach ($rules['validateLang'] as $fieldLang => $function)
|
||||
foreach ($languages as $language)
|
||||
if ($value = Tools::getValue($fieldLang.'_'.$language['id_lang']))
|
||||
if (!Validate::$function($value))
|
||||
$this->_errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is invalid');
|
||||
$this->errors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is invalid');
|
||||
|
||||
/* Categories */
|
||||
$productCats = '';
|
||||
if (!Tools::isSubmit('categoryBox') || !count(Tools::getValue('categoryBox')))
|
||||
$this->_errors[] = $this->l('product must be in at least one Category');
|
||||
$this->errors[] = $this->l('product must be in at least one Category');
|
||||
|
||||
if (!is_array(Tools::getValue('categoryBox')) || !in_array(Tools::getValue('id_category_default'), Tools::getValue('categoryBox')))
|
||||
$this->_errors[] = $this->l('product must be in the default category');
|
||||
$this->errors[] = $this->l('product must be in the default category');
|
||||
|
||||
/* Tags */
|
||||
foreach ($languages as $language)
|
||||
if ($value = Tools::getValue('tags_'.$language['id_lang']))
|
||||
if (!Validate::isTagsList($value))
|
||||
$this->_errors[] = $this->l('Tags list').' ('.$language['name'].') '.$this->l('is invalid');
|
||||
$this->errors[] = $this->l('Tags list').' ('.$language['name'].') '.$this->l('is invalid');
|
||||
}
|
||||
|
||||
private function _removeTaxFromEcotax()
|
||||
@@ -1654,12 +1654,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (!Tools::getValue('virtual_product_name_attribute') && !empty($id_product_attribute))
|
||||
{
|
||||
$this->_errors[] = $this->l('the field').' <b>'.$this->l('display filename attribute').'</b> '.$this->l('is required');
|
||||
$this->errors[] = $this->l('the field').' <b>'.$this->l('display filename attribute').'</b> '.$this->l('is required');
|
||||
return false;
|
||||
}
|
||||
else if (!empty($id_product_attribute))
|
||||
{
|
||||
$this->_errors[] = $this->l('the field').' <b>'.$this->l('display filename').'</b> '.$this->l('is required');
|
||||
$this->errors[] = $this->l('the field').' <b>'.$this->l('display filename').'</b> '.$this->l('is required');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1673,13 +1673,13 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (!empty($edit) && !empty($id_product_attribute))
|
||||
{
|
||||
$this->_errors[] = $this->l('the field').' <b>'.$this->l('number of days attribute').'</b> '.$this->l('is required');
|
||||
$this->errors[] = $this->l('the field').' <b>'.$this->l('number of days attribute').'</b> '.$this->l('is required');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!empty($id_product_attribute))
|
||||
{
|
||||
$this->_errors[] = $this->l('the field').' <b>'.$this->l('number of days').'</b> '.$this->l('is required');
|
||||
$this->errors[] = $this->l('the field').' <b>'.$this->l('number of days').'</b> '.$this->l('is required');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1692,12 +1692,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (!Tools::getValue('virtual_product_expiration_date_attribute'))
|
||||
{
|
||||
$this->_errors[] = $this->l('the field').' <b>'.$this->l('expiration date attribute').'</b> '.$this->l('is required');
|
||||
$this->errors[] = $this->l('the field').' <b>'.$this->l('expiration date attribute').'</b> '.$this->l('is required');
|
||||
return false;
|
||||
}
|
||||
else if (!empty($id_product_attribute))
|
||||
{
|
||||
$this->_errors[] = $this->l('the field').' <b>'.$this->l('expiration date').'</b> '.$this->l('is not valid');
|
||||
$this->errors[] = $this->l('the field').' <b>'.$this->l('expiration date').'</b> '.$this->l('is not valid');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2141,7 +2141,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
// let's calculate this once for all
|
||||
if (!Validate::isLoadedObject($this->object) && Tools::getValue('id_product'))
|
||||
$this->_errors[] = 'Unable to load object';
|
||||
$this->errors[] = 'Unable to load object';
|
||||
else
|
||||
{
|
||||
$this->_displayDraftWarning($this->object->active);
|
||||
@@ -2215,7 +2215,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (count($tab) && Accounting::saveProductAccountingInformations($tab))
|
||||
$this->confirmations[] = $this->l('Account numbers have been updated');
|
||||
else
|
||||
$this->_errors[] = $this->l('Account Numbers could not be updated or added in the database');
|
||||
$this->errors[] = $this->l('Account Numbers could not be updated or added in the database');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2317,7 +2317,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
);
|
||||
|
||||
if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) ))
|
||||
$this->_errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
|
||||
|
||||
// Save product-supplier data
|
||||
$existing_id = (int)ProductSupplier::getIdByProductAndSupplier($product->id, $attribute['id_product_attribute'], $supplier->id_supplier);
|
||||
|
||||
@@ -86,13 +86,13 @@ class AdminProfilesControllerCore extends AdminController
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
|
||||
if (isset($_GET['delete'.$this->table]) AND $_GET[$this->identifier] == (int)(_PS_ADMIN_PROFILE_))
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete the Administrator profile');
|
||||
$this->errors[] = $this->l('For security reasons, you cannot delete the Administrator profile');
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class AdminRangePriceControllerCore extends AdminController
|
||||
public function postProcess()
|
||||
{
|
||||
if (isset($_POST['submitAdd'.$this->table]) AND Tools::getValue('delimiter1') >= Tools::getValue('delimiter2'))
|
||||
$this->_errors[] = Tools::displayError('Invalid range');
|
||||
$this->errors[] = Tools::displayError('Invalid range');
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class AdminRangeWeightControllerCore extends AdminController
|
||||
public function postProcess()
|
||||
{
|
||||
if ($this->action == 'save' && Tools::getValue('delimiter1') >= Tools::getValue('delimiter2'))
|
||||
$this->_errors[] = Tools::displayError('Invalid range');
|
||||
$this->errors[] = Tools::displayError('Invalid range');
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ class AdminRequestSqlControllerCore extends AdminController
|
||||
die();
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError('The file is too large and can not be downloaded. Please use the clause "LIMIT" in this query.');
|
||||
$this->errors[] = Tools::DisplayError('The file is too large and can not be downloaded. Please use the clause "LIMIT" in this query.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,80 +292,80 @@ class AdminRequestSqlControllerCore extends AdminController
|
||||
{
|
||||
case 'checkedFrom':
|
||||
if (isset($e[$key]['table']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The Table ').' "'.$e[$key]['table'].'" '.$this->l(' doesn\'t exist.'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('The Table ').' "'.$e[$key]['table'].'" '.$this->l(' doesn\'t exist.'));
|
||||
else if (isset($e[$key]['attribut']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$this->errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
|
||||
case 'checkedSelect':
|
||||
if (isset($e[$key]['table']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The Table ').' "'.$e[$key]['table'].'" '.$this->l(' doesn\'t exist.'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('The Table ').' "'.$e[$key]['table'].'" '.$this->l(' doesn\'t exist.'));
|
||||
else if (isset($e[$key]['attribut']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$this->errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
|
||||
else if (isset($e[$key]['*']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The operand "*" can be used in a nested query.'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('The operand "*" can be used in a nested query.'));
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
|
||||
case 'checkedWhere':
|
||||
if (isset($e[$key]['operator']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The operator ').' "'.$e[$key]['operator'].'" '.$this->l(' used is incorrect.'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('The operator ').' "'.$e[$key]['operator'].'" '.$this->l(' used is incorrect.'));
|
||||
else if (isset($e[$key]['attribut']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$this->errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
|
||||
case 'checkedHaving':
|
||||
if (isset($e[$key]['operator']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The operator ').' "'.$e[$key]['operator'].'" '.$this->l(' used is incorrect.'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('The operator ').' "'.$e[$key]['operator'].'" '.$this->l(' used is incorrect.'));
|
||||
else if (isset($e[$key]['attribut']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$this->errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
|
||||
case 'checkedOrder':
|
||||
if (isset($e[$key]['attribut']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$this->errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
|
||||
case 'checkedGroupBy':
|
||||
if (isset($e[$key]['attribut']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$this->errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
|
||||
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
|
||||
case 'checkedLimit':
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The LIMIT clause must contain numeric arguments.'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('The LIMIT clause must contain numeric arguments.'));
|
||||
break;
|
||||
|
||||
case 'returnNameTable':
|
||||
if (isset($e[$key]['reference']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The reference ').'"'.
|
||||
$this->errors[] = Tools::DisplayError($this->l('The reference ').'"'.
|
||||
$e[$key]['reference'][0].'"'.$this->l(' doesn\'t exist in : ').$e[$key]['reference'][1]);
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('When multiple tables are used, each attribute must be referenced to a table.'));
|
||||
$this->errors[] = Tools::DisplayError($this->l('When multiple tables are used, each attribute must be referenced to a table.'));
|
||||
break;
|
||||
|
||||
case 'testedRequired':
|
||||
$this->_errors[] = Tools::DisplayError($e[$key].' '.$this->l(' doesn\'t exist.'));
|
||||
$this->errors[] = Tools::DisplayError($e[$key].' '.$this->l(' doesn\'t exist.'));
|
||||
break;
|
||||
|
||||
case 'testedUnauthorized':
|
||||
$this->_errors[] = Tools::DisplayError($e[$key].' '.$this->l(' is a unauthorized keyword.'));
|
||||
$this->errors[] = Tools::DisplayError($e[$key].' '.$this->l(' is a unauthorized keyword.'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,19 +183,19 @@ class AdminReturnControllerCore extends AdminController
|
||||
if (OrderReturn::deleteOrderReturnDetail($id_order_return, $id_order_detail, (int)(Tools::getValue('id_customization', 0))))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting an order return detail.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting an order return detail.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You need at least one product.');
|
||||
$this->errors[] = Tools::displayError('You need at least one product.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('The order return is invalid.');
|
||||
$this->errors[] = Tools::displayError('The order return is invalid.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('The order return detail is invalid.');
|
||||
$this->errors[] = Tools::displayError('The order return detail is invalid.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitAddorder_return'))
|
||||
{
|
||||
@@ -222,10 +222,10 @@ class AdminReturnControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('No order return ID.');
|
||||
$this->errors[] = Tools::displayError('No order return ID.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -301,9 +301,9 @@ class AdminScenesControllerCore extends AdminController
|
||||
if (Tools::isSubmit('save_image_map'))
|
||||
{
|
||||
if (!Tools::isSubmit('categories') || !count(Tools::getValue('categories')))
|
||||
$this->_errors[] = Tools::displayError('You should select at least one category');
|
||||
$this->errors[] = Tools::displayError('You should select at least one category');
|
||||
if (!Tools::isSubmit('zones') || !count(Tools::getValue('zones')))
|
||||
$this->_errors[] = Tools::displayError('You should make at least one zone');
|
||||
$this->errors[] = Tools::displayError('You should make at least one zone');
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
/* Handle empty search field */
|
||||
if (empty($this->query))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Please fill in search form first.');
|
||||
$this->errors[] = Tools::displayError('Please fill in search form first.');
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -78,7 +78,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
{
|
||||
if ((int)$this->query AND Validate::isUnsignedInt((int)$this->query) AND $order = new Order((int)$this->query) AND Validate::isLoadedObject($order))
|
||||
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
|
||||
$this->_errors[] = Tools::displayError('No order found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
$this->errors[] = Tools::displayError('No order found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
}
|
||||
|
||||
/* Invoices */
|
||||
@@ -86,7 +86,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
{
|
||||
if ((int)$this->query AND Validate::isUnsignedInt((int)$this->query) AND $invoice = Order::getInvoice((int)$this->query))
|
||||
Tools::redirectAdmin('pdf.php?id_order='.(int)($invoice['id_order']).'&pdf');
|
||||
$this->_errors[] = Tools::displayError('No invoice found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
$this->errors[] = Tools::displayError('No invoice found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
}
|
||||
|
||||
/* Cart */
|
||||
@@ -94,7 +94,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
{
|
||||
if ((int)$this->query AND Validate::isUnsignedInt((int)$this->query) AND $cart = new Cart((int)$this->query) AND Validate::isLoadedObject($cart))
|
||||
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$this->context->employee->id));
|
||||
$this->_errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
$this->errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
}
|
||||
/* IP */
|
||||
// 6 - but it is included in the customer block
|
||||
@@ -107,7 +107,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
{
|
||||
if (!ip2long(trim($this->query)))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('It seems that this is not an IP address :').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
$this->errors[] = Tools::displayError('It seems that this is not an IP address :').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
return;
|
||||
}
|
||||
$this->_list['customers'] = Customer::searchByIp($this->query);
|
||||
@@ -237,7 +237,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
$this->tpl_view_vars['query'] = $this->query;
|
||||
$this->tpl_view_vars['show_toolbar'] = true;
|
||||
|
||||
if (sizeof($this->_errors))
|
||||
if (sizeof($this->errors))
|
||||
return parent::renderView();
|
||||
else
|
||||
{
|
||||
|
||||
@@ -180,17 +180,17 @@ class AdminShippingControllerCore extends AdminController
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=6&id_carrier='.$carrier->id.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating fees (cannot load carrier object).');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating fees (cannot load carrier object).');
|
||||
}
|
||||
elseif (isset($id_carrier2))
|
||||
{
|
||||
$_POST['id_carrier'] = $id_carrier2;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating fees (cannot load carrier object).');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating fees (cannot load carrier object).');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else
|
||||
return parent::postProcess();
|
||||
|
||||
@@ -198,12 +198,12 @@ class AdminShopControllerCore extends AdminController
|
||||
$this->loadObject() && $this->loadObject()->active)
|
||||
{
|
||||
if (Tools::getValue('id_shop') == Configuration::get('PS_SHOP_DEFAULT'))
|
||||
$this->_errors[] = Tools::displayError('You cannot disable the default shop.');
|
||||
$this->errors[] = Tools::displayError('You cannot disable the default shop.');
|
||||
else if (Shop::getTotalShops() == 1)
|
||||
$this->_errors[] = Tools::displayError('You cannot disable the last shop.');
|
||||
$this->errors[] = Tools::displayError('You cannot disable the last shop.');
|
||||
}
|
||||
|
||||
if ($this->_errors)
|
||||
if ($this->errors)
|
||||
return false;
|
||||
return parent::postProcess();
|
||||
}
|
||||
@@ -211,11 +211,11 @@ class AdminShopControllerCore extends AdminController
|
||||
public function processDelete($token)
|
||||
{
|
||||
if (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
$this->_errors[] = Tools::displayError('Unable to load this shop.');
|
||||
$this->errors[] = Tools::displayError('Unable to load this shop.');
|
||||
else if(!Shop::has_dependency($object->id))
|
||||
return $object->deleteCategories() && parent::processDelete($token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You can\'t delete this shop (customer and/or order dependency)');
|
||||
$this->errors[] = Tools::displayError('You can\'t delete this shop (customer and/or order dependency)');
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -452,18 +452,18 @@ class AdminShopControllerCore extends AdminController
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$object = new $this->className();
|
||||
$this->copyFromPost($object, $this->table);
|
||||
$this->beforeAdd($object);
|
||||
if (!$object->add())
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating object.').
|
||||
' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
}
|
||||
/* voluntary do affectation here */
|
||||
else if (($_POST[$this->identifier] = $object->id) && $this->postImage($object->id) && !count($this->_errors) && $this->_redirect)
|
||||
else if (($_POST[$this->identifier] = $object->id) && $this->postImage($object->id) && !count($this->errors) && $this->_redirect)
|
||||
{
|
||||
$parent_id = (int)Tools::getValue('id_parent', 1);
|
||||
$this->afterAdd($object);
|
||||
@@ -480,8 +480,8 @@ class AdminShopControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
$this->_errors = array_unique($this->_errors);
|
||||
if (count($this->_errors) > 0)
|
||||
$this->errors = array_unique($this->errors);
|
||||
if (count($this->errors) > 0)
|
||||
return;
|
||||
|
||||
$shop = new Shop($object->id);
|
||||
|
||||
@@ -246,22 +246,22 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->main)
|
||||
$this->_errors[] = Tools::displayError('You can\'t disable a main url');
|
||||
$this->errors[] = Tools::displayError('You can\'t disable a main url');
|
||||
elseif ($object->toggleStatus())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.$token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitAdd'.$this->table) && $this->tabAccess['add'] === '1')
|
||||
{
|
||||
if (ShopUrl::virtualUriExists(Tools::getValue('virtual_uri'), Tools::getValue('id_shop')))
|
||||
$this->_errors[] = Tools::displayError('Virtual URI already used.');
|
||||
$this->errors[] = Tools::displayError('Virtual URI already used.');
|
||||
else
|
||||
return parent::postProcess();
|
||||
}
|
||||
@@ -276,16 +276,16 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
$object->setMain();
|
||||
|
||||
if ($object->main && !Tools::getValue('main'))
|
||||
$this->_errors[] = Tools::displayError('You can\'t change a main url to a non main url, you have to set an other url as main url for selected shop');
|
||||
$this->errors[] = Tools::displayError('You can\'t change a main url to a non main url, you have to set an other url as main url for selected shop');
|
||||
|
||||
if (($object->main || Tools::getValue('main')) && !Tools::getValue('active'))
|
||||
$this->_errors[] = Tools::displayError('You can\'t disable a main url');
|
||||
$this->errors[] = Tools::displayError('You can\'t disable a main url');
|
||||
|
||||
if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri')))
|
||||
$this->_errors[] = Tools::displayError('A shop url that use this domain and uri already exists');
|
||||
$this->errors[] = Tools::displayError('A shop url that use this domain and uri already exists');
|
||||
|
||||
parent::processAdd($token);
|
||||
if (!$this->_errors)
|
||||
if (!$this->errors)
|
||||
Tools::generateHtaccess();
|
||||
}
|
||||
|
||||
|
||||
@@ -112,16 +112,16 @@ class AdminSlipControllerCore extends AdminController
|
||||
if (Tools::getValue('submitAddorder_slip'))
|
||||
{
|
||||
if (!Validate::isDate(Tools::getValue('date_from')))
|
||||
$this->_errors[] = $this->l('Invalid from date');
|
||||
$this->errors[] = $this->l('Invalid from date');
|
||||
if (!Validate::isDate(Tools::getValue('date_to')))
|
||||
$this->_errors[] = $this->l('Invalid end date');
|
||||
if (!count($this->_errors))
|
||||
$this->errors[] = $this->l('Invalid end date');
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$order_slips = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
if (count($order_slips))
|
||||
Tools::redirectAdmin(
|
||||
'pdf.php?slips&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
$this->_errors[] = $this->l('No order slips found for this period');
|
||||
$this->errors[] = $this->l('No order slips found for this period');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -199,7 +199,7 @@ class AdminStatesControllerCore extends AdminController
|
||||
{
|
||||
// check if request at least one object with noZeroObject
|
||||
if (isset($object->noZeroObject) && count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
$this->errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
else
|
||||
{
|
||||
if ($this->deleted)
|
||||
@@ -210,17 +210,17 @@ class AdminStatesControllerCore extends AdminController
|
||||
}
|
||||
else if ($object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.$token);
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('This state is currently in use');
|
||||
$this->errors[] = Tools::displayError('This state is currently in use');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
|
||||
@@ -183,7 +183,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
if (Tools::isSubmit('submitDatePicker'))
|
||||
{
|
||||
if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) || !Validate::isDate($to = Tools::getValue('datepickerTo')))
|
||||
$this->_errors[] = Tools::displayError('Date specified is invalid');
|
||||
$this->errors[] = Tools::displayError('Date specified is invalid');
|
||||
}
|
||||
if (Tools::isSubmit('submitDateDay'))
|
||||
{
|
||||
@@ -218,7 +218,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
$from = (date('Y') - 1).date('-01-01');
|
||||
$to = (date('Y') - 1).date('-12-31');
|
||||
}
|
||||
if (isset($from) && isset($to) && !count($this->_errors))
|
||||
if (isset($from) && isset($to) && !count($this->errors))
|
||||
{
|
||||
$this->context->employee->stats_date_from = $from;
|
||||
$this->context->employee->stats_date_to = $to;
|
||||
@@ -235,7 +235,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
Configuration::updateValue('PS_STATS_OLD_CONNECT_AUTO_CLEAN', Tools::getValue('PS_STATS_OLD_CONNECT_AUTO_CLEAN', Configuration::get('PS_STATS_OLD_CONNECT_AUTO_CLEAN')));
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ class AdminStatusesControllerCore extends AdminController
|
||||
|
||||
// Update object
|
||||
if (!$order_return_state->save())
|
||||
$this->_errors[] = Tools::displayError('An error has occured: Can\'t save the current order return state');
|
||||
$this->errors[] = Tools::displayError('An error has occured: Can\'t save the current order return state');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
@@ -522,7 +522,7 @@ class AdminStatusesControllerCore extends AdminController
|
||||
{
|
||||
$order_state = new OrderState($_GET['id_order_state'], $this->context->language->id);
|
||||
if (!$order_state->isRemovable())
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
$this->errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
else
|
||||
return parent::postProcess();
|
||||
}
|
||||
@@ -533,11 +533,11 @@ class AdminStatusesControllerCore extends AdminController
|
||||
$order_state = new OrderState($selection, $this->context->language->id);
|
||||
if (!$order_state->isRemovable())
|
||||
{
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
$this->errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($this->_errors))
|
||||
if (empty($this->errors))
|
||||
return parent::postProcess();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -562,13 +562,13 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
|
||||
// Checks access
|
||||
if (Tools::isSubmit('addStock') && !($this->tabAccess['add'] === '1'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the required permission to add stock.');
|
||||
$this->errors[] = Tools::displayError('You do not have the required permission to add stock.');
|
||||
if (Tools::isSubmit('removeStock') && !($this->tabAccess['delete'] === '1'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the required permission to delete stock.');
|
||||
$this->errors[] = Tools::displayError('You do not have the required permission to delete stock.');
|
||||
if (Tools::isSubmit('transferStock') && !($this->tabAccess['edit'] === '1'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the required permission to transfer stock.');
|
||||
$this->errors[] = Tools::displayError('You do not have the required permission to transfer stock.');
|
||||
|
||||
if (count($this->_errors))
|
||||
if (count($this->errors))
|
||||
return;
|
||||
|
||||
// Global checks when add / remove / transfer product
|
||||
@@ -577,7 +577,7 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
// get product ID
|
||||
$id_product = (int)Tools::getValue('id_product', 0);
|
||||
if ($id_product <= 0)
|
||||
$this->_errors[] = Tools::displayError('The selected product is not valid.');
|
||||
$this->errors[] = Tools::displayError('The selected product is not valid.');
|
||||
|
||||
// get product_attribute ID
|
||||
$id_product_attribute = (int)Tools::getValue('id_product_attribute', 0);
|
||||
@@ -586,13 +586,13 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
$check = Tools::getValue('check', '');
|
||||
$check_valid = md5(_COOKIE_KEY_.$id_product.$id_product_attribute);
|
||||
if ($check != $check_valid)
|
||||
$this->_errors[] = Tools::displayError('The selected product is not valid.');
|
||||
$this->errors[] = Tools::displayError('The selected product is not valid.');
|
||||
|
||||
// get quantity and check that the post value is really an integer
|
||||
// If it's not, we have to do nothing.
|
||||
$quantity = Tools::getValue('quantity', 0);
|
||||
if (!is_numeric($quantity) || (int)$quantity <= 0)
|
||||
$this->_errors[] = Tools::displayError('The quantity value is not valid.');
|
||||
$this->errors[] = Tools::displayError('The quantity value is not valid.');
|
||||
$quantity = (int)$quantity;
|
||||
|
||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
@@ -605,17 +605,17 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
// get warehouse id
|
||||
$id_warehouse = (int)Tools::getValue('id_warehouse', 0);
|
||||
if ($id_warehouse <= 0 || !Warehouse::exists($id_warehouse))
|
||||
$this->_errors[] = Tools::displayError('The selected warehouse is not valid.');
|
||||
$this->errors[] = Tools::displayError('The selected warehouse is not valid.');
|
||||
|
||||
// get stock movement reason id
|
||||
$id_stock_mvt_reason = (int)Tools::getValue('id_stock_mvt_reason', 0);
|
||||
if ($id_stock_mvt_reason <= 0 || !StockMvtReason::exists($id_stock_mvt_reason))
|
||||
$this->_errors[] = Tools::displayError('The reason is not valid.');
|
||||
$this->errors[] = Tools::displayError('The reason is not valid.');
|
||||
|
||||
// get usable flag
|
||||
$usable = Tools::getValue('usable', null);
|
||||
if (is_null($usable))
|
||||
$this->_errors[] = Tools::displayError('You have to specify if the product quantity is usable for sale on shops.');
|
||||
$this->errors[] = Tools::displayError('You have to specify if the product quantity is usable for sale on shops.');
|
||||
$usable = (bool)$usable;
|
||||
}
|
||||
|
||||
@@ -624,16 +624,16 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
// get product unit price
|
||||
$price = str_replace(',', '.', Tools::getValue('price', 0));
|
||||
if (!is_numeric($price))
|
||||
$this->_errors[] = Tools::displayError('The product price is not valid.');
|
||||
$this->errors[] = Tools::displayError('The product price is not valid.');
|
||||
$price = round(floatval($price), 6);
|
||||
|
||||
// get product unit price currency id
|
||||
$id_currency = (int)Tools::getValue('id_currency', 0);
|
||||
if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) ))
|
||||
$this->_errors[] = Tools::displayError('The selected currency is not valid.');
|
||||
$this->errors[] = Tools::displayError('The selected currency is not valid.');
|
||||
|
||||
// if all is ok, add stock
|
||||
if (count($this->_errors) == 0)
|
||||
if (count($this->errors) == 0)
|
||||
{
|
||||
$warehouse = new Warehouse($id_warehouse);
|
||||
|
||||
@@ -663,14 +663,14 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
Tools::redirectAdmin($redirect.'&conf=1');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occured. No stock was added.');
|
||||
$this->errors[] = Tools::displayError('An error occured. No stock was added.');
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('removestock') && Tools::isSubmit('is_post'))
|
||||
{
|
||||
// if all is ok, remove stock
|
||||
if (count($this->_errors) == 0)
|
||||
if (count($this->errors) == 0)
|
||||
{
|
||||
$warehouse = new Warehouse($id_warehouse);
|
||||
|
||||
@@ -684,7 +684,7 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
Tools::redirectAdmin($redirect.'&conf=2');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('It is not possible to remove the specified quantity or an error occured. No stock was removed.');
|
||||
$this->errors[] = Tools::displayError('It is not possible to remove the specified quantity or an error occured. No stock was removed.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,27 +693,27 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
// get source warehouse id
|
||||
$id_warehouse_from = (int)Tools::getValue('id_warehouse_from', 0);
|
||||
if ($id_warehouse_from <= 0 || !Warehouse::exists($id_warehouse_from))
|
||||
$this->_errors[] = Tools::displayError('The source warehouse is not valid.');
|
||||
$this->errors[] = Tools::displayError('The source warehouse is not valid.');
|
||||
|
||||
// get destination warehouse id
|
||||
$id_warehouse_to = (int)Tools::getValue('id_warehouse_to', 0);
|
||||
if ($id_warehouse_to <= 0 || !Warehouse::exists($id_warehouse_to))
|
||||
$this->_errors[] = Tools::displayError('The destination warehouse is not valid.');
|
||||
$this->errors[] = Tools::displayError('The destination warehouse is not valid.');
|
||||
|
||||
// get usable flag for source warehouse
|
||||
$usable_from = Tools::getValue('usable_from', null);
|
||||
if (is_null($usable_from))
|
||||
$this->_errors[] = Tools::displayError('You have to specify if the product quantity is usable for sale on shops in source warehouse.');
|
||||
$this->errors[] = Tools::displayError('You have to specify if the product quantity is usable for sale on shops in source warehouse.');
|
||||
$usable_from = (bool)$usable_from;
|
||||
|
||||
// get usable flag for destination warehouse
|
||||
$usable_to = Tools::getValue('usable_to', null);
|
||||
if (is_null($usable_to))
|
||||
$this->_errors[] = Tools::displayError('You have to specify if the product quantity is usable for sale on shops in destination warehouse.');
|
||||
$this->errors[] = Tools::displayError('You have to specify if the product quantity is usable for sale on shops in destination warehouse.');
|
||||
$usable_to = (bool)$usable_to;
|
||||
|
||||
// if all is ok, transfer stock
|
||||
if (count($this->_errors) == 0)
|
||||
if (count($this->errors) == 0)
|
||||
{
|
||||
// transfer stock
|
||||
$stock_manager = StockManagerFactory::getManager();
|
||||
@@ -731,7 +731,7 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
if ($is_transfer)
|
||||
Tools::redirectAdmin($redirect.'&conf=3');
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('It is not possible to transfer the specified quantity, or an error occured. No stock was transfered.');
|
||||
$this->errors[] = Tools::displayError('It is not possible to transfer the specified quantity, or an error occured. No stock was transfered.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1061,7 +1061,7 @@ class AdminStockManagementControllerCore extends AdminController
|
||||
));
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('The specified product is not valid');
|
||||
$this->errors[] = Tools::displayError('The specified product is not valid');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -309,17 +309,17 @@ class AdminStoresControllerCore extends AdminController
|
||||
$country = new Country((int)$id_country);
|
||||
|
||||
if ($id_country && $country && !(int)$country->contains_states && $id_state)
|
||||
$this->_errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
||||
$this->errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
||||
|
||||
/* If the selected country contains states, then a state have to be selected */
|
||||
if ((int)$country->contains_states && !$id_state)
|
||||
$this->_errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
||||
$this->errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
||||
|
||||
$latitude = (float)Tools::getValue('latitude');
|
||||
$longitude = (float)Tools::getValue('longitude');
|
||||
|
||||
if (empty($latitude) || empty($longitude))
|
||||
$this->_errors[] = Tools::displayError('Latitude and longitude are required.');
|
||||
$this->errors[] = Tools::displayError('Latitude and longitude are required.');
|
||||
|
||||
/* Check zip code */
|
||||
if ($country->need_zip_code)
|
||||
@@ -334,7 +334,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
$zip_regexp = str_replace('L', '[a-zA-Z]', $zip_regexp);
|
||||
$zip_regexp = str_replace('C', $country->iso_code, $zip_regexp);
|
||||
if (!preg_match($zip_regexp, $postcode))
|
||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.').'<br />'.Tools::displayError('Must be typed as follows:').' '.
|
||||
$this->errors[] = Tools::displayError('Your zip/postal code is incorrect.').'<br />'.Tools::displayError('Must be typed as follows:').' '.
|
||||
str_replace(
|
||||
'C',
|
||||
$country->iso_code,
|
||||
@@ -350,9 +350,9 @@ class AdminStoresControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
else if ($zip_code_format)
|
||||
$this->_errors[] = Tools::displayError('Postcode required.');
|
||||
$this->errors[] = Tools::displayError('Postcode required.');
|
||||
else if ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
||||
$this->errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
||||
}
|
||||
|
||||
/* Store hours */
|
||||
@@ -362,7 +362,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
$_POST['hours'] = serialize($_POST['hours']);
|
||||
}
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
// checks access
|
||||
if (Tools::isSubmit('submitAdd'.$this->table) && !($this->tabAccess['add'] === '1'))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You do not have the required permissions to add suppliers.');
|
||||
$this->errors[] = Tools::displayError('You do not have the required permissions to add suppliers.');
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -366,8 +366,8 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
if (count($validation) > 0)
|
||||
{
|
||||
foreach ($validation as $item)
|
||||
$this->_errors[] = $item;
|
||||
$this->_errors[] = Tools::displayError('The address is not correct. Check if all required fields are filled.');
|
||||
$this->errors[] = $item;
|
||||
$this->errors[] = Tools::displayError('The address is not correct. Check if all required fields are filled.');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -386,7 +386,7 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
else if (SupplyOrder::supplierHasPendingOrders($obj->id))
|
||||
$this->_errors[] = $this->l('It is not possible to delete a supplier if there is/are pending supply order(s).');
|
||||
$this->errors[] = $this->l('It is not possible to delete a supplier if there is/are pending supply order(s).');
|
||||
else
|
||||
{
|
||||
$address = new Address($obj->id_address);
|
||||
|
||||
@@ -140,7 +140,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->display = 'edit';
|
||||
else
|
||||
$this->_errors[] = Tools::displayError($this->l('You do not have permission to edit here.'));
|
||||
$this->errors[] = Tools::displayError($this->l('You do not have permission to edit here.'));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('update_receipt') && Tools::isSubmit('id_supply_order'))
|
||||
@@ -465,7 +465,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
if ($id_supply_order <= 0)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError($this->l('The specified supply order is not valid'));
|
||||
$this->errors[] = Tools::displayError($this->l('The specified supply order is not valid'));
|
||||
return parent::initContent();
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
if (!Validate::isLoadedObject($supply_order))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError($this->l('The specified supply order is not valid'));
|
||||
$this->errors[] = Tools::displayError($this->l('The specified supply order is not valid'));
|
||||
return parent::initContent();
|
||||
}
|
||||
|
||||
@@ -917,7 +917,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$error_str .= '<li>'.$this->l('field ').$e.'</li>';
|
||||
$error_str .= '</ul>';
|
||||
|
||||
$this->_errors[] = Tools::displayError($this->l('Please verify the informations of the product: ').$entry->name.' '.$error_str);
|
||||
$this->errors[] = Tools::displayError($this->l('Please verify the informations of the product: ').$entry->name.' '.$error_str);
|
||||
}
|
||||
else
|
||||
$entry->save();
|
||||
@@ -937,19 +937,19 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
// Checks access
|
||||
if (Tools::isSubmit('submitAddsupply_order') && !($this->tabAccess['add'] === '1'))
|
||||
$this->_errors[] = Tools::displayError($this->l('You do not have the required permission to add a supply order.'));
|
||||
$this->errors[] = Tools::displayError($this->l('You do not have the required permission to add a supply order.'));
|
||||
if (Tools::isSubmit('submitBulkUpdatesupply_order_detail') && !($this->tabAccess['edit'] === '1'))
|
||||
$this->_errors[] = Tools::displayError($this->l('You do not have the required permission to edit an order.'));
|
||||
$this->errors[] = Tools::displayError($this->l('You do not have the required permission to edit an order.'));
|
||||
|
||||
// checks if supply order reference is unique
|
||||
if (Tools::isSubmit('reference'))
|
||||
{
|
||||
$ref = pSQL(Tools::getValue('reference'));
|
||||
if ((int)SupplyOrder::exists($ref) != (int)Tools::getValue('id_supply_order'))
|
||||
$this->_errors[] = Tools::displayError($this->l('The reference has to be unique.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The reference has to be unique.'));
|
||||
}
|
||||
|
||||
if ($this->_errors)
|
||||
if ($this->errors)
|
||||
return;
|
||||
|
||||
// Global checks when add / update a supply order
|
||||
@@ -961,30 +961,30 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
// get supplier ID
|
||||
$id_supplier = (int)Tools::getValue('id_supplier', 0);
|
||||
if ($id_supplier <= 0 || !Supplier::supplierExists($id_supplier))
|
||||
$this->_errors[] = Tools::displayError($this->l('The selected supplier is not valid.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The selected supplier is not valid.'));
|
||||
|
||||
// get warehouse id
|
||||
$id_warehouse = (int)Tools::getValue('id_warehouse', 0);
|
||||
if ($id_warehouse <= 0 || !Warehouse::exists($id_warehouse))
|
||||
$this->_errors[] = Tools::displayError($this->l('The selected warehouse is not valid.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The selected warehouse is not valid.'));
|
||||
|
||||
// get currency id
|
||||
$id_currency = (int)Tools::getValue('id_currency', 0);
|
||||
if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) ))
|
||||
$this->_errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
|
||||
|
||||
// get delivery date
|
||||
$delivery_expected = new DateTime(pSQL(Tools::getValue('date_delivery_expected')));
|
||||
// converts date to timestamp
|
||||
if ($delivery_expected <= (new DateTime('yesterday')))
|
||||
$this->_errors[] = Tools::displayError($this->l('The date you specified cannot be in the past.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The date you specified cannot be in the past.'));
|
||||
|
||||
// gets threshold
|
||||
$quantity_threshold = null;
|
||||
if (Tools::getValue('load_products') && Validate::isInt(Tools::getValue('load_products')))
|
||||
$quantity_threshold = (int)Tools::getValue('load_products');
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
// specify initial state
|
||||
$_POST['id_supply_order_state'] = 1; //defaut creation state
|
||||
@@ -1010,19 +1010,19 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
&& Tools::isSubmit('id_supply_order_state'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] != '1')
|
||||
$this->_errors[] = Tools::displayError($this->l('You do not have permissions to change order status.'));
|
||||
$this->errors[] = Tools::displayError($this->l('You do not have permissions to change order status.'));
|
||||
|
||||
// get state ID
|
||||
$id_state = (int)Tools::getValue('id_supply_order_state', 0);
|
||||
if ($id_state <= 0)
|
||||
$this->_errors[] = Tools::displayError($this->l('The selected supply order status is not valid.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The selected supply order status is not valid.'));
|
||||
|
||||
// get supply order ID
|
||||
$id_supply_order = (int)Tools::getValue('id_supply_order', 0);
|
||||
if ($id_supply_order <= 0)
|
||||
$this->_errors[] = Tools::displayError($this->l('The supply order id is not valid.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The supply order id is not valid.'));
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
// try to load supply order
|
||||
$supply_order = new SupplyOrder($id_supply_order);
|
||||
@@ -1043,11 +1043,11 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
// special case of validate state - check if there are products in the order and the required state is not an enclosed state
|
||||
if ($supply_order->isEditable() && !$supply_order->hasEntries() && !$new_state->enclosed)
|
||||
$this->_errors[] = Tools::displayError(
|
||||
$this->errors[] = Tools::displayError(
|
||||
$this->l('It is not possible to change the status of this order because you did not order any products')
|
||||
);
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$supply_order->id_supply_order_state = $state['id_supply_order_state'];
|
||||
if ($supply_order->save())
|
||||
@@ -1079,7 +1079,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError($this->l('The selected supplier is not valid.'));
|
||||
$this->errors[] = Tools::displayError($this->l('The selected supplier is not valid.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1091,7 +1091,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
if (Tools::isSubmit('create_supply_order') && Tools::isSubmit('id_supply_order'))
|
||||
$this->postProcessCopyFromTemplate();
|
||||
|
||||
if ((!count($this->_errors) && $this->is_editing_order) || !$this->is_editing_order)
|
||||
if ((!count($this->errors) && $this->is_editing_order) || !$this->is_editing_order)
|
||||
parent::postProcess();
|
||||
|
||||
// if the threshold is defined and we are saving the order
|
||||
@@ -1191,7 +1191,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$rows = Tools::getValue('supply_order_detailBox');
|
||||
if (!$rows)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError($this->l('You did not select any product to update'));
|
||||
$this->errors[] = Tools::displayError($this->l('You did not select any product to update'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1207,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
// checks if there is something to update
|
||||
if (!count($to_update))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError($this->l('You did not select any product to update'));
|
||||
$this->errors[] = Tools::displayError($this->l('You did not select any product to update'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1221,7 +1221,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
// checks if quantity is valid
|
||||
// It's possible to receive more quantity than expected in case of a shipping error from the supplier
|
||||
if (!Validate::isInt($quantity) || $quantity <= 0)
|
||||
$this->_errors[] = sprintf(Tools::displayError($this->l('Quantity (%d) for product #%d is not valid')), (int)$quantity, (int)$id_supply_order_detail);
|
||||
$this->errors[] = sprintf(Tools::displayError($this->l('Quantity (%d) for product #%d is not valid')), (int)$quantity, (int)$id_supply_order_detail);
|
||||
else // everything is valid : updates
|
||||
{
|
||||
// creates the history
|
||||
@@ -1244,7 +1244,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$warehouse = new Warehouse($supply_order->id_warehouse);
|
||||
if (!Validate::isLoadedObject($warehouse))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError($this->l('Warehouse could not be loaded'));
|
||||
$this->errors[] = Tools::displayError($this->l('Warehouse could not be loaded'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1278,12 +1278,12 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$supply_order->save();
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError($this->l('Something went wrong when adding products in warehouse'));
|
||||
$this->errors[] = Tools::displayError($this->l('Something went wrong when adding products in warehouse'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
// display confirm message
|
||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
@@ -1969,7 +1969,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$id_supply_order = (int)Tools::getValue('id_supply_order');
|
||||
$supply_order = new SupplyOrder($id_supply_order);
|
||||
if (!Validate::isLoadedObject($supply_order))
|
||||
$this->_errors[] = Tools::displayError($this->l('Could not copy this template.'));
|
||||
$this->errors[] = Tools::displayError($this->l('Could not copy this template.'));
|
||||
|
||||
// gets SupplyOrderDetail
|
||||
$entries = $supply_order->getEntriesCollection($supply_order->id_lang);
|
||||
|
||||
@@ -246,7 +246,7 @@ class AdminTabsControllerCore extends AdminController
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
@@ -259,12 +259,12 @@ class AdminTabsControllerCore extends AdminController
|
||||
else if (Tools::getValue('position') && !Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
else if (!Validate::isLoadedObject($object = new Tab((int)Tools::getValue($this->identifier))))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').
|
||||
' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
$this->errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.Tools::getAdminTokenLite('AdminTabs'));
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ class AdminTaxRulesGroupControllerCore extends AdminController
|
||||
{
|
||||
|
||||
if (!$tr->save())
|
||||
$this->_errors[] = Tools::displayError('An error has occured: Can\'t save the current tax rule');
|
||||
$this->errors[] = Tools::displayError('An error has occured: Can\'t save the current tax rule');
|
||||
} else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$tr->id_tax_rules_group.'&conf=4&update'.$this->table.'&token='.$this->token);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class AdminTaxesControllerCore extends AdminController
|
||||
{
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
if (!sizeof($this->_errors))
|
||||
if (!sizeof($this->errors))
|
||||
{
|
||||
$id = (int)(Tools::getValue('id_'.$this->table));
|
||||
|
||||
@@ -203,14 +203,14 @@ class AdminTaxesControllerCore extends AdminController
|
||||
$result = $object->update(false, false);
|
||||
|
||||
if (!$result)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b>';
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b>';
|
||||
elseif ($this->postImage($object->id))
|
||||
{
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
|
||||
/* Object creation */
|
||||
@@ -219,7 +219,7 @@ class AdminTaxesControllerCore extends AdminController
|
||||
$object = new $this->className();
|
||||
$this->copyFromPost($object, $this->table);
|
||||
if (!$object->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
elseif (($_POST['id_'.$this->table] = $object->id /* voluntary */) AND $this->postImage($object->id) AND $this->_redirect)
|
||||
{
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token);
|
||||
|
||||
@@ -276,7 +276,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
$obj = $this->loadObject();
|
||||
if ($obj && $obj->isUsed())
|
||||
{
|
||||
$this->_errors[] = $this->l('This theme is used by at least one shop. Please choose another theme first.');
|
||||
$this->errors[] = $this->l('This theme is used by at least one shop. Please choose another theme first.');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
|
||||
if (!is_file(_PS_ALL_THEMES_DIR_ . $theme_dir . '/config.xml'))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('config.xml is missing in your theme path.').'<br/>';
|
||||
$this->errors[] = Tools::displayError('config.xml is missing in your theme path.').'<br/>';
|
||||
$xml=null;
|
||||
}
|
||||
else
|
||||
@@ -342,7 +342,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
$xml=@simplexml_load_file(_PS_ALL_THEMES_DIR_.$theme_dir.'/config.xml');
|
||||
if (!$xml)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('config.xml is not a valid xml file in your theme path.').'<br/>';
|
||||
$this->errors[] = Tools::displayError('config.xml is not a valid xml file in your theme path.').'<br/>';
|
||||
}
|
||||
}
|
||||
// will be set to false if any version node in xml is correct
|
||||
@@ -367,7 +367,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
}
|
||||
if ($xml_version_too_old AND !$this->_checkConfigForFeatures(array_keys(AdminThemes::$check_features)))
|
||||
{
|
||||
$this->_errors[] .= Tools::displayError('config.xml theme file has not been created for this version of prestashop.');
|
||||
$this->errors[] .= Tools::displayError('config.xml theme file has not been created for this version of prestashop.');
|
||||
$return = false;
|
||||
}
|
||||
return $return;
|
||||
@@ -409,7 +409,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
$config_get = Configuration::get($config_key);
|
||||
if ($config_get != $config_val)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError(AdminThemes::$check_features[$feature]['error']).'.'
|
||||
$this->errors[] = Tools::displayError(AdminThemes::$check_features[$feature]['error']).'.'
|
||||
.(!empty(AdminThemes::$check_features[$feature]['tab'])
|
||||
?' <a href="?tab='.AdminThemes::$check_features[$feature]['tab'].'&token='
|
||||
.Tools::getAdminTokenLite(AdminThemes::$check_features[$feature]['tab']).'" ><u>'
|
||||
@@ -450,13 +450,13 @@ class AdminThemesControllerCore extends AdminController
|
||||
if (isset($_FILES['PS_LOGO']['tmp_name']) AND $_FILES['PS_LOGO']['tmp_name'])
|
||||
{
|
||||
if ($error = checkImage($_FILES['PS_LOGO'], 300000))
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['PS_LOGO']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@imageResize($tmpName, _PS_IMG_DIR_.'logo.jpg'))
|
||||
$this->_errors[] = 'an error occurred during logo copy';
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
if (!@imageResize($tmpName, _PS_IMG_DIR_.'logo-'.(int)$id_shop.'.jpg'))
|
||||
$this->_errors[] = 'an error occurred during logo copy';
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
|
||||
unlink($tmpName);
|
||||
}
|
||||
@@ -471,13 +471,13 @@ class AdminThemesControllerCore extends AdminController
|
||||
if (isset($_FILES['PS_LOGO_MAIL']['tmp_name']) AND $_FILES['PS_LOGO_MAIL']['tmp_name'])
|
||||
{
|
||||
if ($error = checkImage($_FILES['PS_LOGO_MAIL'], 300000))
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
if (!$tmpName == tempnam(_PS_TMP_IMG_DIR_, 'PS_MAIL') OR !move_uploaded_file($_FILES['PS_LOGO_MAIL']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@imageResize($tmpName, _PS_IMG_DIR_.'logo_mail.jpg'))
|
||||
$this->_errors[] = 'an error occurred during logo copy';
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
if (!@imageResize($tmpName, _PS_IMG_DIR_.'logo_mail-'.(int)$id_shop.'.jpg'))
|
||||
$this->_errors[] = 'an error occurred during logo copy';
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
unlink($tmpName);
|
||||
}
|
||||
}
|
||||
@@ -491,13 +491,13 @@ class AdminThemesControllerCore extends AdminController
|
||||
if (isset($_FILES['PS_LOGO_INVOICE']['tmp_name']) AND $_FILES['PS_LOGO_INVOICE']['tmp_name'])
|
||||
{
|
||||
if ($error = checkImage($_FILES['PS_LOGO_INVOICE'], 300000))
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS_INVOICE') OR !move_uploaded_file($_FILES['PS_LOGO_INVOICE']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@imageResize($tmpName, _PS_IMG_DIR_.'logo_invoice.jpg'))
|
||||
$this->_errors[] = 'an error occurred during logo copy';
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
if (!@imageResize($tmpName, _PS_IMG_DIR_.'logo_invoice-'.(int)$id_shop.'.jpg'))
|
||||
$this->_errors[] = 'an error occurred during logo copy';
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
|
||||
unlink($tmpName);
|
||||
}
|
||||
@@ -512,13 +512,13 @@ class AdminThemesControllerCore extends AdminController
|
||||
if (isset($_FILES['PS_STORES_ICON']['tmp_name']) AND $_FILES['PS_STORES_ICON']['tmp_name'])
|
||||
{
|
||||
if ($error = checkImage($_FILES['PS_STORES_ICON'], 300000))
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS_STORES_ICON') OR !move_uploaded_file($_FILES['PS_STORES_ICON']['tmp_name'], $tmpName))
|
||||
return false;
|
||||
if ($id_shop = Configuration::get('PS_SHOP_DEFAULT') && !@imageResize($tmpName, _PS_IMG_DIR_.'logo_stores.gif'))
|
||||
$this->_errors[] = 'an error occurred during logo copy';
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
if (!@imageResize($tmpName, _PS_IMG_DIR_.'logo_stores-'.(int)$id_shop.'.gif'))
|
||||
$this->_errors[] = 'an error occurred during logo copy';
|
||||
$this->errors[] = 'an error occurred during logo copy';
|
||||
unlink($tmpName);
|
||||
}
|
||||
|
||||
@@ -533,12 +533,12 @@ class AdminThemesControllerCore extends AdminController
|
||||
{
|
||||
/* Check ico validity */
|
||||
if ($error = checkIco($_FILES[$name]))
|
||||
$this->_errors[] = $error;
|
||||
$this->errors[] = $error;
|
||||
|
||||
/* Copy new ico */
|
||||
elseif(!copy($_FILES[$name]['tmp_name'], $dest))
|
||||
$this->_errors[] = Tools::displayError('an error occurred while uploading favicon: '.$_FILES[$name]['tmp_name'].' to '.$dest);
|
||||
$this->errors[] = Tools::displayError('an error occurred while uploading favicon: '.$_FILES[$name]['tmp_name'].' to '.$dest);
|
||||
}
|
||||
return !count($this->_errors) ? true : false;
|
||||
return !count($this->errors) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if (!mkdir($path, 0777, true))
|
||||
{
|
||||
$bool &= false;
|
||||
$this->_errors[] = $this->l('Cannot create the folder').' "'.$path.'". '.$this->l('Check directory writing permissions.');
|
||||
$this->errors[] = $this->l('Cannot create the folder').' "'.$path.'". '.$this->l('Check directory writing permissions.');
|
||||
}
|
||||
}
|
||||
return $bool;
|
||||
@@ -204,14 +204,14 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
public function submitCopyLang()
|
||||
{
|
||||
if (!($from_lang = strval(Tools::getValue('fromLang'))) || !($to_lang = strval(Tools::getValue('toLang'))))
|
||||
$this->_errors[] = $this->l('you must select 2 languages in order to copy data from one to another');
|
||||
$this->errors[] = $this->l('you must select 2 languages in order to copy data from one to another');
|
||||
else if (!($from_theme = strval(Tools::getValue('fromTheme'))) || !($to_theme = strval(Tools::getValue('toTheme'))))
|
||||
$this->_errors[] = $this->l('you must select 2 themes in order to copy data from one to another');
|
||||
$this->errors[] = $this->l('you must select 2 themes in order to copy data from one to another');
|
||||
else if (!Language::copyLanguageData(Language::getIdByIso($from_lang), Language::getIdByIso($to_lang)))
|
||||
$this->_errors[] = $this->l('an error occurred while copying data');
|
||||
$this->errors[] = $this->l('an error occurred while copying data');
|
||||
else if ($from_lang == $to_lang && $from_theme == $to_theme)
|
||||
$this->_errors[] = $this->l('nothing to copy! (same language and theme)');
|
||||
if (count($this->_errors))
|
||||
$this->errors[] = $this->l('nothing to copy! (same language and theme)');
|
||||
if (count($this->errors))
|
||||
return;
|
||||
|
||||
$bool = true;
|
||||
@@ -226,7 +226,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
}
|
||||
if ($bool)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=14&token='.$this->token);
|
||||
$this->_errors[] = $this->l('a part of the data has been copied but some language files could not be found or copied');
|
||||
$this->errors[] = $this->l('a part of the data has been copied but some language files could not be found or copied');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,9 +262,9 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$gz = new Archive_Tar(_PS_TRANSLATIONS_DIR_.'/export/'.$lang.'.gzip', true);
|
||||
if ($gz->createModify($items, null, _PS_ROOT_DIR_));
|
||||
Tools::redirect('translations/export/'.$lang.'.gzip');
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating archive.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating archive.');
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('Please choose a language and theme.');
|
||||
$this->errors[] = Tools::displayError('Please choose a language and theme.');
|
||||
}
|
||||
|
||||
public function checkAndAddMailsFiles($iso_code, $files_list)
|
||||
@@ -289,7 +289,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
public function submitImportLang()
|
||||
{
|
||||
if (!isset($_FILES['file']['tmp_name']) || !$_FILES['file']['tmp_name'])
|
||||
$this->_errors[] = Tools::displayError('No file selected');
|
||||
$this->errors[] = Tools::displayError('No file selected');
|
||||
else
|
||||
{
|
||||
$gz = new Archive_Tar($_FILES['file']['tmp_name'], true);
|
||||
@@ -305,7 +305,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
}
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf='.(isset($conf) ? $conf : '15').'&token='.$this->token);
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('Archive cannot be extracted.');
|
||||
$this->errors[] = Tools::displayError('Archive cannot be extracted.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,21 +329,21 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if (!Language::checkAndAddLanguage($arr_import_lang[0]))
|
||||
$conf = 20;
|
||||
if (!unlink($file))
|
||||
$this->_errors[] = Tools::displayError('Cannot delete archive');
|
||||
$this->errors[] = Tools::displayError('Cannot delete archive');
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf='.(isset($conf) ? $conf : '15').'&token='.$this->token);
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('Archive cannot be extracted.');
|
||||
$this->errors[] = Tools::displayError('Archive cannot be extracted.');
|
||||
if (!unlink($file))
|
||||
$this->_errors[] = Tools::displayError('Cannot delete archive');
|
||||
$this->errors[] = Tools::displayError('Cannot delete archive');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||
$this->errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Language not found');
|
||||
$this->errors[] = Tools::displayError('Language not found');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Invalid parameter');
|
||||
$this->errors[] = Tools::displayError('Invalid parameter');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -492,7 +492,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
$this->errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
@@ -502,28 +502,28 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
$this->submitCopyLang();
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitExport'))
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
$this->submitExportLang();
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitImport'))
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
$this->submitImportLang();
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitAddLanguage'))
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
$this->submitAddLang();
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitTranslationsFront'))
|
||||
{
|
||||
@@ -534,7 +534,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$this->writeTranslationFile('Front', _PS_THEME_DIR_.'lang/'.Tools::strtolower(Tools::getValue('lang')).'.php');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitTranslationsPdf'))
|
||||
{
|
||||
@@ -545,7 +545,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$this->writeTranslationFile('PDF', _PS_THEME_DIR_.'pdf/lang/'.Tools::strtolower(Tools::getValue('lang')).'.php', 'PDF');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitTranslationsBack'))
|
||||
{
|
||||
@@ -556,7 +556,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$this->writeTranslationFile('Back', _PS_TRANSLATIONS_DIR_.Tools::strtolower(Tools::getValue('lang')).'/admin.php', 'ADM');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitTranslationsErrors'))
|
||||
{
|
||||
@@ -567,7 +567,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$this->writeTranslationFile('Errors', _PS_TRANSLATIONS_DIR_.Tools::strtolower(Tools::getValue('lang')).'/errors.php', false, 'ERRORS');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitTranslationsFields'))
|
||||
{
|
||||
@@ -578,7 +578,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$this->writeTranslationFile('Fields', _PS_TRANSLATIONS_DIR_.Tools::strtolower(Tools::getValue('lang')).'/fields.php', false, 'FIELDS');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
|
||||
}
|
||||
else if (Tools::isSubmit('submitTranslationsMails') || Tools::isSubmit('submitTranslationsMailsAndStay'))
|
||||
@@ -586,7 +586,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1' && ($id_lang = Language::getIdByIso(Tools::getValue('lang'))) > 0)
|
||||
$this->submitTranslationsMails($id_lang);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitTranslationsModules'))
|
||||
{
|
||||
@@ -620,7 +620,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,7 +716,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
chmod($path.$mail_name.'.'.$type_content, 0777);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('HTML e-mail templates cannot contain JavaScript code.');
|
||||
$this->errors[] = Tools::displayError('HTML e-mail templates cannot contain JavaScript code.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -742,7 +742,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
foreach ($array_subjects as $type => $infos)
|
||||
$this->writeSubjectTranslationFile($infos['translations'], $infos['path']);
|
||||
|
||||
if (count($this->_errors) == 0)
|
||||
if (count($this->errors) == 0)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token.$params_redirect);
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
if (empty($key))
|
||||
{
|
||||
$this->_errors[] = $this->l('Empty string found, please edit:').' <br />'._PS_THEME_DIR_.''.$template;
|
||||
$this->errors[] = $this->l('Empty string found, please edit:').' <br />'._PS_THEME_DIR_.''.$template;
|
||||
$new_lang[$key] = '';
|
||||
}
|
||||
else
|
||||
@@ -1020,7 +1020,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
if (empty($english_string))
|
||||
{
|
||||
$this->_errors[] = $this->l('Error in template - Empty string found, please edit:').' <br />'.$tpl;
|
||||
$this->errors[] = $this->l('Error in template - Empty string found, please edit:').' <br />'.$tpl;
|
||||
$new_lang[$english_string] = '';
|
||||
}
|
||||
else
|
||||
@@ -1602,7 +1602,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = $this->l('Subject mail translation file not found in').' '.$directory;
|
||||
$this->errors[] = $this->l('Subject mail translation file not found in').' '.$directory;
|
||||
return $subject_mail_content;
|
||||
}
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ class AdminWarehousesControllerCore extends AdminController
|
||||
// checks access
|
||||
if (Tools::isSubmit('submitAdd'.$this->table) && !($this->tabAccess['add'] === '1'))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You do not have the required permissions to add warehouses.');
|
||||
$this->errors[] = Tools::displayError('You do not have the required permissions to add warehouses.');
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
@@ -414,8 +414,8 @@ class AdminWarehousesControllerCore extends AdminController
|
||||
if (count($validation) > 0)
|
||||
{
|
||||
foreach ($validation as $item)
|
||||
$this->_errors[] = $item;
|
||||
$this->_errors[] = Tools::displayError('The address is not correct. Check if all required fields are filled.');
|
||||
$this->errors[] = $item;
|
||||
$this->errors[] = Tools::displayError('The address is not correct. Check if all required fields are filled.');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -437,9 +437,9 @@ class AdminWarehousesControllerCore extends AdminController
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
else if ($obj->getQuantitiesOfProducts() > 0)
|
||||
$this->_errors[] = $this->l('It is not possible to delete a Warehouse when there are products in it.');
|
||||
$this->errors[] = $this->l('It is not possible to delete a Warehouse when there are products in it.');
|
||||
else if (SupplyOrder::warehouseHasPendingOrders($obj->id))
|
||||
$this->_errors[] = $this->l('It is not possible to delete a Warehouse if it has pending supply orders.');
|
||||
$this->errors[] = $this->l('It is not possible to delete a Warehouse if it has pending supply orders.');
|
||||
else
|
||||
{
|
||||
// sets the address of the warehouse as deleted
|
||||
|
||||
@@ -180,9 +180,9 @@ class AdminWebserviceControllerCore extends AdminController
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::getValue('key') && strlen(Tools::getValue('key')) < 32)
|
||||
$this->_errors[] = Tools::displayError($this->l('Key length must be 32 character long'));
|
||||
$this->errors[] = Tools::displayError($this->l('Key length must be 32 character long'));
|
||||
if (WebserviceKey::keyExists(Tools::getValue('key')) && !Tools::getValue('id_webservice_account'))
|
||||
$this->_errors[] = Tools::displayError($this->l('Key already exists'));
|
||||
$this->errors[] = Tools::displayError($this->l('Key already exists'));
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user