[-] FO : fixed bug #PSCFV-9388 - newsletter is required error, showing two times

This commit is contained in:
Vincent Augagneur
2013-06-26 11:46:02 +02:00
parent c5e65e1360
commit 3d2e46b14f
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -977,11 +977,11 @@ abstract class ObjectModelCore
// Checking for required fields
if (isset($data['required']) && $data['required'] && ($value = Tools::getValue($field, $this->{$field})) == false && (string)$value != '0')
if (!$this->id || $field != 'passwd')
$errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is required.');
$errors[$field] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is required.');
// Checking for maximum fields sizes
if (isset($data['size']) && ($value = Tools::getValue($field, $this->{$field})) && Tools::strlen($value) > $data['size'])
$errors[] = sprintf(
$errors[$field] = sprintf(
Tools::displayError('%1$s is too long. Maximum length: %2$d'),
self::displayFieldName($field, get_class($this), $htmlentities),
$data['size']
@@ -992,7 +992,7 @@ abstract class ObjectModelCore
if (($value = Tools::getValue($field, $this->{$field})) || ($field == 'postcode' && $value == '0'))
{
if (isset($data['validate']) && !Validate::$data['validate']($value) && (!empty($value) || $data['required']))
$errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.');
$errors[$field] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.');
else
{
if (isset($data['copy_post']) && !$data['copy_post'])
@@ -1136,7 +1136,7 @@ abstract class ObjectModelCore
$value = Tools::getValue($field);
if (empty($value))
$errors[] = sprintf(Tools::displayError('The field %s is required.'), self::displayFieldName($field, get_class($this), $htmlentities));
$errors[$field] = sprintf(Tools::displayError('The field %s is required.'), self::displayFieldName($field, get_class($this), $htmlentities));
}
return $errors;