diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index 1bd270b93ce..30b8d2187bc 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -122,9 +122,7 @@ if (empty($reshook))
$object->fetch($id,$ref);
$result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy'));
if ($result < 0)
- {
- $mesg=join(',',$object->errors);
- }
+ setEventMessage(join(',',$object->errors), 'errors');
$action="";
}
@@ -133,9 +131,7 @@ if (empty($reshook))
$object->fetch($id,$ref);
$result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell'));
if ($result < 0)
- {
- $mesg=join(',',$object->errors);
- }
+ setEventMessage(join(',',$object->errors), 'errors');
$action="";
}
@@ -146,13 +142,13 @@ if (empty($reshook))
if (! GETPOST('libelle'))
{
- $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'
';
+ setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), 'errors');
$action = "create";
$error++;
}
if (empty($ref))
{
- $mesg=''.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'
';
+ setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), 'errors');
$action = "create";
$error++;
}
@@ -230,7 +226,7 @@ if (empty($reshook))
}
else
{
- $mesg=''.$langs->trans($object->error).'
';
+ setEventMessage($langs->trans($object->error), 'errors');
$action = "create";
}
}
@@ -289,14 +285,14 @@ if (empty($reshook))
}
else
{
+ setEventMessage($langs->trans($object->error), 'errors');
$action = 'edit';
- $mesg = $object->error;
}
}
else
{
+ setEventMessage($langs->trans("ErrorProductBadRefOrLabel"), 'errors');
$action = 'edit';
- $mesg = $langs->trans("ErrorProductBadRefOrLabel");
}
}
@@ -309,7 +305,7 @@ if (empty($reshook))
{
if (! GETPOST('clone_content') && ! GETPOST('clone_prices') )
{
- $mesg=''.$langs->trans("NoCloneOptionsSpecified").'
';
+ setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
}
else
{
@@ -351,12 +347,13 @@ if (empty($reshook))
$mesg='';
+ setEventMessage($mesg, 'errors');
//dol_print_error($object->db);
}
else
{
$db->rollback();
- $mesg=$object->error;
+ setEventMessage($langs->trans($object->error), 'errors');
dol_print_error($db,$object->error);
}
}
@@ -389,7 +386,7 @@ if (empty($reshook))
}
else
{
- $mesg=$object->error;
+ setEventMessage($langs->trans($object->error), 'errors');
$reload = 0;
$action='';
}
@@ -474,7 +471,7 @@ if (empty($reshook))
return;
}
- $mesg = $langs->trans("ErrorUnknown").": $result";
+ setEventMessage($langs->trans("ErrorUnknown").": $result", 'errors');
}
// Add product into order
@@ -717,8 +714,6 @@ else
else $title=$langs->trans("NewProduct");
print_fiche_titre($title);
- dol_htmloutput_mesg($mesg);
-
print '';
print '';
$tmpcode='';
@@ -903,8 +898,6 @@ else
if ($object->isservice()) $type = $langs->trans('Service');
print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, "");
- dol_htmloutput_errors($mesg);
-
// Main official, simple, and not duplicated code
print '