From 787d3bd6a918eff66ef2e75ca893412652f44b96 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 15 Jan 2013 11:00:32 +0100 Subject: [PATCH] Fix: use event method --- htdocs/product/fiche.php | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) 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='
'.$langs->trans("ErrorProductAlreadyExists",$object->ref); $mesg.=' '.$langs->trans("ShowCardHere").'.'; $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 ''."\n"; print ''; @@ -1066,8 +1059,6 @@ else // Fiche en mode visu else { - dol_htmloutput_mesg($mesg); - $head=product_prepare_head($object, $user); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type==1?'service':'product');