[-] BO : Model return html error messagae instead of json while image uploading

This commit is contained in:
gRoussac
2013-11-15 12:20:10 +01:00
parent 152960639f
commit 6a690b255b
+6 -2
View File
@@ -105,8 +105,10 @@ class QqUploadedFileForm
$legends = Tools::getValue('legend');
if (is_array($legends))
foreach ($legends as $key => $legend)
if (!empty($legend))
if (!empty($legend) && Validate::isGenericName($legend))
$image->legend[(int)$key] = $legend;
else
return array('error' => sprintf(Tools::displayError('Error on image legend "%1s." is not a valid legend.'), Tools::safeOutput($legend)));
if (!Image::getCover($image->id_product))
$image->cover = 1;
else
@@ -192,8 +194,10 @@ class QqUploadedFileXhr
$legends = Tools::getValue('legend');
if (is_array($legends))
foreach ($legends as $key => $legend)
if (!empty($legend))
if (!empty($legend) && Validate::isGenericName($legend))
$image->legend[(int)$key] = $legend;
else
return array('error' => sprintf(Tools::displayError('Error on image legend "%1s." is not a valid legend.'), Tools::safeOutput($legend)));
if (!Image::getCover($image->id_product))
$image->cover = 1;
else