[-] FO : #PSCFV-2151 : Translations of errors are connected width sprintf()
This commit is contained in:
@@ -581,7 +581,7 @@ 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[] = sprintf(Tools::displayError('Cannot write %s images. Please check the folder\'s writing permissions.'), $proc['type']);
|
||||
elseif ($return == 'timeout')
|
||||
$this->errors[] = Tools::displayError('Only part of the images have been regenerated, server timed out before finishing.');
|
||||
else
|
||||
@@ -591,7 +591,10 @@ class AdminImagesControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('Server timed out, the watermark may not have been applied to all 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[] = sprintf(
|
||||
Tools::displayError('Cannot write "No picture" image to (%s) images folder. Please check the folder\'s writing permissions.'),
|
||||
$proc['type']
|
||||
);
|
||||
}
|
||||
}
|
||||
return (count($this->errors) > 0 ? false : true);
|
||||
|
||||
@@ -849,8 +849,11 @@ 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.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$category_to_create->name[$default_language_id],
|
||||
(isset($category_to_create->id) ? $category_to_create->id : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -868,14 +871,18 @@ class AdminImportControllerCore extends AdminController
|
||||
if ($category->link_rewrite == '')
|
||||
{
|
||||
$category->link_rewrite = 'friendly-url-autogeneration-failed';
|
||||
$this->warnings[] = Tools::displayError('URL rewriting failed to auto-generate a friendly URL for: ').$category->name[$default_language_id];
|
||||
$this->warnings[] = sprintf(Tools::displayError('URL rewriting failed to auto-generate a friendly URL for: %s'), $category->name[$default_language_id]);
|
||||
}
|
||||
$category->link_rewrite = AdminImportController::createMultiLangField($category->link_rewrite);
|
||||
}
|
||||
|
||||
if (!$valid_link)
|
||||
$this->warnings[] = Tools::displayError('Rewrite link for').' '.$bak.(isset($info['id']) ? ' (ID '.$info['id'].') ' : '').
|
||||
' '.Tools::displayError('was re-written as').' '.$category->link_rewrite[$default_language_id];
|
||||
$this->warnings[] = sprintf(
|
||||
Tools::displayError('Rewrite link for %1$s (ID: %2$s) was re-written as %3$s.'),
|
||||
$bak,
|
||||
(isset($info['id']) ? $info['id'] : 'null'),
|
||||
$category->link_rewrite[$default_language_id]
|
||||
);
|
||||
$res = false;
|
||||
if (($field_error = $category->validateFields(UNFRIENDLY_ERROR, true)) === true &&
|
||||
($lang_field_error = $category->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
|
||||
@@ -913,7 +920,11 @@ 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[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$info['name'],
|
||||
(isset($info['id']) ? $info['id'] : 'null')
|
||||
);
|
||||
$error_tmp = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').Db::getInstance()->getMsgError();
|
||||
if ($error_tmp != '')
|
||||
$this->errors[] = $error_tmp;
|
||||
@@ -996,7 +1007,11 @@ 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[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$manufacturer->name,
|
||||
(isset($manufacturer->id) ? $manufacturer->id : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1018,7 +1033,11 @@ 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[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$supplier->name,
|
||||
(isset($supplier->id) ? $supplier->id : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1061,8 +1080,11 @@ 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.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$category_to_create->name[$default_language_id],
|
||||
(isset($category_to_create->id) ? $category_to_create->id : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1086,8 +1108,11 @@ 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.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$category_to_create->name[$default_language_id],
|
||||
(isset($category_to_create->id) ? $category_to_create->id : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1110,8 +1135,12 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (!$valid_link)
|
||||
$this->warnings[] = Tools::displayError('Rewrite link for').' '.$link_rewrite.(isset($info['id']) ? ' (ID '.$info['id'].') ' : '').
|
||||
' '.Tools::displayError('was re-written as').' '.$link_rewrite;
|
||||
$this->warnings[] = sprintf(
|
||||
Tools::displayError('Rewrite link for %1$s (ID: %2$s) was re-written as %3$s.'),
|
||||
$link_rewrite,
|
||||
(isset($info['id']) ? $info['id'] : 'null'),
|
||||
$link_rewrite
|
||||
);
|
||||
|
||||
$product->link_rewrite = AdminImportController::createMultiLangField($link_rewrite);
|
||||
|
||||
@@ -1164,7 +1193,11 @@ 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[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$info['name'],
|
||||
(isset($info['id']) ? $info['id'] : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
|
||||
@@ -1357,7 +1390,7 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->warnings[] = (isset($image->id_product) ? ' ('.$image->id_product.')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->warnings[] = sprintf(Tools::displayError('%s cannot be saved'), (isset($image->id_product) ? ' ('.$image->id_product.')' : ''));
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').mysql_error();
|
||||
}
|
||||
}
|
||||
@@ -1597,7 +1630,11 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
if (!$res)
|
||||
{
|
||||
$this->errors[] = $info['email'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$info['email'],
|
||||
(isset($info['id']) ? $info['id'] : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1644,7 +1681,7 @@ 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[] = sprintf(Tools::displayError('%s cannot be saved'), $country->name[$default_language_id]);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1674,7 +1711,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$address->id_state = (int)$state->id;
|
||||
else
|
||||
{
|
||||
$this->errors[] = $state->name.' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = sprintf(Tools::displayError('%s cannot be saved'), $state->name);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1689,11 +1726,15 @@ 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').' '.
|
||||
(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('%1$s does not exist in database %2$s (ID: %3$s) cannot be saved'),
|
||||
Db::getInstance()->getMsgError(),
|
||||
$address->customer_email,
|
||||
(isset($info['id']) ? $info['id'] : 'null')
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->errors[] = '"'.$address->customer_email.'" :'.Tools::displayError('Is not a valid e-mail address');
|
||||
$this->errors[] = sprintf(Tools::displayError('"%s": Is not a valid e-mail address'), $address->customer_email);
|
||||
}
|
||||
|
||||
if (isset($address->manufacturer) && is_numeric($address->manufacturer) && Manufacturer::manufacturerExists((int)$address->manufacturer))
|
||||
@@ -1707,8 +1748,11 @@ class AdminImportControllerCore extends AdminController
|
||||
$address->id_manufacturer = (int)$manufacturer->id;
|
||||
else
|
||||
{
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$manufacturer->name.(isset($manufacturer->id) ? ' ('.$manufacturer->id.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$manufacturer->name,
|
||||
(isset($manufacturer->id) ? $manufacturer->id : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1725,8 +1769,11 @@ class AdminImportControllerCore extends AdminController
|
||||
$address->id_supplier = (int)$supplier->id;
|
||||
else
|
||||
{
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$supplier->name.(isset($supplier->id) ? ' ('.$supplier->id.')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$supplier->name,
|
||||
(isset($supplier->id) ? $supplier->id : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1743,7 +1790,11 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
if (!$res)
|
||||
{
|
||||
$this->errors[] = $info['alias'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$info['alias'],
|
||||
(isset($info['id']) ? $info['id'] : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1800,8 +1851,11 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
if (!$res)
|
||||
{
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$info['name'],
|
||||
(isset($info['id']) ? $info['id'] : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
@@ -1838,8 +1892,11 @@ class AdminImportControllerCore extends AdminController
|
||||
$res = $supplier->add();
|
||||
|
||||
if (!$res)
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.$info['name'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').
|
||||
' '.Tools::displayError('Cannot be saved');
|
||||
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
|
||||
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
|
||||
$info['name'],
|
||||
(isset($info['id']) ? $info['id'] : 'null')
|
||||
);
|
||||
else
|
||||
{
|
||||
// Associate supplier to group shop
|
||||
|
||||
@@ -187,8 +187,10 @@ class AdminLoginControllerCore extends AdminController
|
||||
if (!$employee->getByemail($email) || !$employee)
|
||||
$this->errors[] = Tools::displayError('This account does not exist');
|
||||
elseif ((strtotime($employee->last_passwd_gen.'+'.Configuration::get('PS_PASSWD_TIME_BACK').' minutes') - time()) > 0)
|
||||
$this->errors[] = Tools::displayError('You can regenerate your password only every').' '.
|
||||
Configuration::get('PS_PASSWD_TIME_BACK').' '.Tools::displayError('minute(s)');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('You can regenerate your password only every %d minute(s)'),
|
||||
Configuration::get('PS_PASSWD_TIME_BACK')
|
||||
);
|
||||
}
|
||||
if (_PS_MODE_DEMO_)
|
||||
$errors[] = Tools::displayError('This functionality has been disabled.');
|
||||
|
||||
@@ -380,14 +380,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
foreach ($rules['required'] as $field)
|
||||
if (($value = Tools::getValue($field)) == false && (string)$value != '0')
|
||||
if (!Tools::getValue('id_'.$this->table) || $field != 'passwd')
|
||||
$this->errors[] = Tools::displayError('field').' <b>'.$field.'</b> '.Tools::displayError('is required.');
|
||||
$this->errors[] = sprintf(Tools::displayError('field %s is required.'), $field);
|
||||
foreach ($rules['size'] as $field => $maxLength)
|
||||
if (Tools::getValue($field) && 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[] = sprintf(Tools::displayError('field %1$s is too long. (%2$d chars max)'), $field, $maxLength);
|
||||
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[] = sprintf(Tools::displayError('field %s is invalid.'), $field);
|
||||
|
||||
if (!count($this->errors))
|
||||
{
|
||||
|
||||
@@ -735,8 +735,10 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$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').' '.
|
||||
realpath(_PS_CACHEFS_DIRECTORY_).' '.Tools::displayError('must be writable');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('To use CacheFS the directory %s must be writable.'),
|
||||
realpath(_PS_CACHEFS_DIRECTORY_)
|
||||
);
|
||||
|
||||
if ($caching_system == 'CacheFs' && $cache_active)
|
||||
{
|
||||
|
||||
@@ -328,7 +328,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (!Validate::isGenericName(Tools::getValue('attachment_name_'.(int)($language['id_lang']))))
|
||||
$this->errors[] = Tools::displayError('Invalid Name');
|
||||
elseif (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[] = sprintf(Tools::displayError('Name is too long (%d chars max).'), 32);
|
||||
if (!Validate::isCleanHtml(Tools::getValue('attachment_description_'.(int)($language['id_lang']))))
|
||||
$this->errors[] = Tools::displayError('Invalid description');
|
||||
}
|
||||
@@ -1306,9 +1306,17 @@ 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[] = sprintf(
|
||||
Tools::displayError('The name for feature %1$s is too long in %2$s.'),
|
||||
' <b>'.$feature['name'].'</b>',
|
||||
$current_language->name
|
||||
);
|
||||
elseif (!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;
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('Valid name required for feature. %1$s in %2$s.'),
|
||||
' <b>'.$feature['name'].'</b>',
|
||||
$current_language->name
|
||||
);
|
||||
if (count($this->errors))
|
||||
return 0;
|
||||
// Getting default language
|
||||
@@ -1603,19 +1611,30 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (Tools::getValue('id_'.$this->table) && $field == 'passwd')
|
||||
continue;
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is required');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %s is required.'),
|
||||
call_user_func(array($className, 'displayFieldName'), $field, $className)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Check multilingual required fields
|
||||
foreach ($rules['requiredLang'] as $fieldLang)
|
||||
if ($this->isProductFieldUpdated($fieldLang, $default_language->id) && !Tools::getValue($fieldLang.'_'.$default_language->id))
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).'</b> '.$this->l('is required at least in').' '.$default_language->name;
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('This field %1$s is required at least in %2$s'),
|
||||
call_user_func(array($className, 'displayFieldName'), $fieldLang, $className),
|
||||
$default_language->name
|
||||
);
|
||||
|
||||
// Check fields sizes
|
||||
foreach ($rules['size'] as $field => $maxLength)
|
||||
if ($this->isProductFieldUpdated($field) && ($value = Tools::getValue($field)) && Tools::strlen($value) > $maxLength)
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %1$s is too long (%2$d chars max).'),
|
||||
call_user_func(array($className, 'displayFieldName'), $field, $className),
|
||||
$maxLength
|
||||
);
|
||||
|
||||
if (Tools::getIsset('description_short') && $this->isProductFieldUpdated('description_short'))
|
||||
{
|
||||
@@ -1629,13 +1648,24 @@ class AdminProductsControllerCore extends AdminController
|
||||
foreach ($languages as $language)
|
||||
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue('description_short_'.$language['id_lang'])))
|
||||
if (Tools::strlen(strip_tags($value)) > $limit)
|
||||
$this->errors[] = $this->l('this 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[] = sprintf(
|
||||
Tools::displayError('This field %1$s (%2$s) is too long: %3$d chars max (count now %4$d).'),
|
||||
call_user_func(array($className, 'displayFieldName'), 'description_short'),
|
||||
$language['name'],
|
||||
$limit,
|
||||
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('this 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[] = sprintf(
|
||||
Tools::displayError('The field %1$s is too long (%2$d chars max).'),
|
||||
call_user_func(array($className, 'displayFieldName'), $fieldLang, $className),
|
||||
$maxLength
|
||||
);
|
||||
|
||||
if ($this->isProductFieldUpdated('description_short') && isset($_POST['description_short']))
|
||||
$_POST['description_short'] = $saveShort;
|
||||
|
||||
@@ -1643,14 +1673,21 @@ class AdminProductsControllerCore extends AdminController
|
||||
foreach ($rules['validate'] as $field => $function)
|
||||
if ($this->isProductFieldUpdated($field) && ($value = Tools::getValue($field)))
|
||||
if (!Validate::$function($value))
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %s is invalid.'),
|
||||
call_user_func(array($className, 'displayFieldName'), $field, $className)
|
||||
);
|
||||
|
||||
// Check multilingual fields validity
|
||||
foreach ($rules['validateLang'] as $fieldLang => $function)
|
||||
foreach ($languages as $language)
|
||||
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue($fieldLang.'_'.$language['id_lang'])))
|
||||
if (!Validate::$function($value))
|
||||
$this->errors[] = $this->l('this field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is invalid');
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %1$s (%2$s) is invalid.'),
|
||||
call_user_func(array($className, 'displayFieldName'), $fieldLang, $className),
|
||||
$language['name']
|
||||
);
|
||||
|
||||
// Categories
|
||||
if ($this->isProductFieldUpdated('id_category_default') && (!Tools::isSubmit('categoryBox') || !count(Tools::getValue('categoryBox'))))
|
||||
@@ -1663,7 +1700,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
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[] = sprintf(
|
||||
Tools::displayError('Tags list (%s) is invalid'),
|
||||
$language['name']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user