From 43597c17319bdd114d50d391ec826f28e8ba157a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 20 Jul 2014 01:43:46 +0200 Subject: [PATCH] Migrated old error notifications to the """new""" system --- htdocs/adherents/card_subscriptions.php | 9 ++- htdocs/admin/boxes.php | 8 +-- htdocs/admin/fckeditor.php | 5 +- htdocs/admin/fiscalyear.php | 3 - htdocs/admin/menus.php | 9 +-- htdocs/barcode/codeinit.php | 4 -- htdocs/categories/edit.php | 12 ++-- htdocs/categories/fiche.php | 4 +- htdocs/comm/address.php | 7 +-- htdocs/comm/propal.php | 2 +- htdocs/comm/remise.php | 4 +- htdocs/compta/bank/account.php | 25 +++++--- htdocs/compta/deplacement/fiche.php | 20 +++---- htdocs/compta/dons/fiche.php | 29 +++++---- htdocs/compta/paiement/cheque/fiche.php | 9 +-- htdocs/fichinter/fiche.php | 2 +- htdocs/fourn/facture/fiche.php | 63 +++++++++----------- htdocs/fourn/facture/paiement.php | 3 - htdocs/product/admin/product_extrafields.php | 2 - htdocs/product/composition/fiche.php | 15 ++--- htdocs/projet/tasks.php | 6 +- htdocs/societe/consumption.php | 8 --- 22 files changed, 98 insertions(+), 151 deletions(-) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index fa7d59f040e..c3fdd1176a1 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -52,7 +52,6 @@ $object = new Adherent($db); $extrafields = new ExtraFields($db); $adht = new AdherentType($db); $errmsg=''; -$errmsgs=array(); $defaultdelay=1; $defaultdelayunit='y'; @@ -108,7 +107,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights { $langs->load("errors"); $errmsg=$langs->trans($company->error); - $errmsgs=$company->errors; + setEventMessage($company->errors, 'errors'); } else { @@ -282,7 +281,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ { $error++; $errmsg=$object->error; - $errmsgs=$object->errors; + setEventMessage($object->errors, 'errors'); } if (! $error) @@ -444,7 +443,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ if (! ($bank_line_id > 0)) { $errmsg=$paiement->error; - $errmsgs=$paiement->errors; + setEventMessage($paiement->errors, 'errors'); $error++; } } @@ -689,7 +688,7 @@ if ($rowid) dol_fiche_end(); - dol_htmloutput_errors($errmsg,$errmsgs); + dol_htmloutput_errors($errmsg); /* diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index bc140735c61..0a23b26f36c 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -34,7 +34,6 @@ if (! $user->admin) accessforbidden(); $rowid = GETPOST('rowid','int'); $action = GETPOST('action','alpha'); -$errmesg=''; // Define possible position of boxes $pos_name = getStaticMember('InfoBox','listOfPages'); @@ -80,7 +79,7 @@ if ($action == 'add') } else { - $errmesg=$db->lasterror(); + setEventMessage($db->lasterror(), 'errors'); $error++; } } @@ -116,7 +115,7 @@ if ($action == 'add') $resql = $db->query($sql); if (! $resql) { - $errmesg=$db->lasterror(); + setEventMessage($db->lasterror(), 'errors'); $error++; } } @@ -217,9 +216,6 @@ print_fiche_titre($langs->trans("Boxes"),'','setup'); print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; -dol_htmloutput_errors($errmesg); - - /* * Recherche des boites actives par defaut pour chaque position possible * On stocke les boites actives par defaut dans $boxes[position][id_boite]=1 diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 8c5dd6585f7..650def1f1af 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -120,7 +120,10 @@ $var=true; if (empty($conf->use_javascript_ajax)) { - dol_htmloutput_errors('',array($langs->trans("NotAvailable"),$langs->trans("JavascriptDisabled")),1); + setEventMessage(array( + $langs->trans("NotAvailable"), + $langs->trans("JavascriptDisabled") + ), 'errors'); } else { diff --git a/htdocs/admin/fiscalyear.php b/htdocs/admin/fiscalyear.php index 1cc06281a66..dfb404b0b6b 100644 --- a/htdocs/admin/fiscalyear.php +++ b/htdocs/admin/fiscalyear.php @@ -43,7 +43,6 @@ static $tmpstatut2label=array( $statut2label=array(''); foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val); -$mesg=''; $errors=array(); $object = new Fiscalyear($db); @@ -64,8 +63,6 @@ $title = $langs->trans('FiscalYears'); print_fiche_titre($langs->trans('FiscalYears')); -dol_htmloutput_errors($mesg); - $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f"; $sql.= " WHERE f.entity = ".$conf->entity; diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index b09b524b435..2e050a4bbe8 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -49,8 +49,6 @@ foreach($dirmenus as $dirmenu) } $error=0; -$errmsgs=array(); - // Cette page peut etre longue. On augmente le delai autorise. // Ne fonctionne que si on est pas en safe_mode. @@ -105,7 +103,8 @@ if ($action == 'update' && empty($_POST["cancel"])) else { $error++; - $errmsgs[]='Failed to initialize menu '.$key.'.'; + //TODO: Translate + setEventMessage('Failed to initialize menu '.$key.'.', 'errors'); $db->rollback(); } } @@ -268,10 +267,6 @@ else print ''; - -dol_htmloutput_errors('',$errmsgs); - - if ($action != 'edit') { print '
'; diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index a5d207b5339..1484566dbaf 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -37,8 +37,6 @@ $forbarcode=GETPOST('forbarcode'); $fk_barcode_type=GETPOST('fk_barcode_type'); $eraseallbarcode=GETPOST('eraseallbarcode'); -$mesg=''; - $action=GETPOST('action'); $producttmp=new Product($db); @@ -198,8 +196,6 @@ print '
'; print $langs->trans("MassBarcodeInitDesc").'
'; print '
'; -dol_htmloutput_errors($mesg); - //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'
'; //print '
'; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 0c61ab8cca6..aa82fdb455d 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -80,12 +80,12 @@ if ($action == 'update' && $user->rights->categorie->creer) if (empty($categorie->label)) { $action = 'create'; - $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors'); } if (empty($categorie->description)) { $action = 'create'; - $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")), 'errors'); } if (empty($categorie->error)) { @@ -98,12 +98,12 @@ if ($action == 'update' && $user->rights->categorie->creer) } else { - $mesg=$categorie->error; + setEventMessage($categorie->error, 'errors'); } } else { - $mesg=$categorie->error; + setEventMessage($categorie->error, 'errors'); } } @@ -117,10 +117,6 @@ llxHeader("","",$langs->trans("Categories")); print_fiche_titre($langs->trans("ModifCat")); - -dol_htmloutput_errors($mesg); - - $object->fetch($id); $form = new Form($db); diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index aca14acce2b..66370022c20 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -131,7 +131,7 @@ if ($action == 'add' && $user->rights->categorie->creer) if (! $object->label) { $error++; - $errors[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")), 'errors'); $action = 'create'; } @@ -224,8 +224,6 @@ if ($user->rights->categorie->creer) print_fiche_titre($langs->trans("CreateCat")); - dol_htmloutput_errors('',$errors); - print ''; // Ref diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php index 8e892845c66..86333a3996c 100644 --- a/htdocs/comm/address.php +++ b/htdocs/comm/address.php @@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'update') } else { - $mesg = $object->error; + setEventMessage($object->error, 'errors'); $action='create'; } } @@ -147,7 +147,7 @@ if ($action == 'add' || $action == 'update') else { $reload = 0; - $mesg = $object->error; + setEventMessage($object->error, 'errors'); $actino= "edit"; } } @@ -181,9 +181,6 @@ $form = new Form($db); $formcompany = new FormCompany($db); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -dol_htmloutput_errors($mesg); - - if ($action == 'create') { if ($user->rights->societe->creer) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index c2183a2b6e1..64a3475572e 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1645,7 +1645,7 @@ if ($action == 'create') { $numref = $object->getNextNumRef($soc); if (empty($numref)) { $error ++; - dol_htmloutput_errors($object->error); + setEventMessage($object->error, 'errors'); } } else { $numref = $object->ref; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 5fc0c7ec9bb..544ef619720 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -71,7 +71,7 @@ if (GETPOST("action") == 'setremise') } else { - $errmesg=$soc->error; + setEventMessage($soc->error, 'errors'); } } @@ -97,8 +97,6 @@ if ($socid > 0) $objsoc->id=$socid; $objsoc->fetch($socid); - dol_htmloutput_errors($errmesg); - $head = societe_prepare_head($objsoc); dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 8a8f00d2357..69962498312 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -72,8 +72,6 @@ if ($negpage) if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage"); } -$mesg=''; - $object = new Account($db); /* @@ -83,6 +81,8 @@ $dateop=-1; if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) { + $error = 0; + if (price2num($_POST["credit"]) > 0) { $amount = price2num($_POST["credit"]); @@ -98,11 +98,20 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu $label=$_POST["label"]; $cat1=$_POST["cat1"]; - if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); - if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); - if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); + if (! $dateop) { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors'); + } + if (! $operation) { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Type")), 'errors'); + } + if (! $amount) { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors'); + } - if (! $mesg) + if (! $error) { $object->fetch($id); $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); @@ -114,7 +123,7 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu } else { - $mesg=$object->error; + setEventMessage($object->error, 'errors'); } } else @@ -295,8 +304,6 @@ if ($id > 0 || ! empty($ref)) print '
'; - dol_htmloutput_errors($mesg); - /** * Search form */ diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index e0183094d23..9df4bb90652 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -44,8 +44,6 @@ $result = restrictedArea($user, 'deplacement', $id,''); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); -$mesg = ''; - $object = new Deplacement($db); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -73,7 +71,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) } else { - $mesg=$object->error; + setEventMessage($object->error, 'errors'); } } } @@ -88,7 +86,7 @@ else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->depl } else { - $mesg=$object->error; + setEventMessage($object->error, 'errors'); } } @@ -109,17 +107,17 @@ else if ($action == 'add' && $user->rights->deplacement->creer) if (! $object->date) { - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); $error++; } if ($object->type == '-1') // Otherwise it is TF_LUNCH,... { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); $error++; } if (! ($object->fk_user > 0)) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")), 'errors'); $error++; } @@ -134,7 +132,7 @@ else if ($action == 'add' && $user->rights->deplacement->creer) } else { - $mesg=$object->error; + setEventMessage($object->error, 'errors'); $action='create'; } } @@ -174,7 +172,7 @@ else if ($action == 'update' && $user->rights->deplacement->creer) } else { - $mesg=$object->error; + setEventMessage($object->error, 'errors'); } } else @@ -226,8 +224,6 @@ if ($action == 'create') print_fiche_titre($langs->trans("NewTrip")); - dol_htmloutput_errors($mesg); - $datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int')); print '' . "\n"; @@ -299,8 +295,6 @@ else if ($id) $result = $object->fetch($id); if ($result > 0) { - dol_htmloutput_mesg($mesg); - $head = trip_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index 9f9f8793ad5..1b09863d4dd 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -43,9 +43,6 @@ $action=GETPOST('action','alpha'); $cancel=GETPOST('cancel'); $amount=GETPOST('amount'); -$mesg=""; -$mesgs=array(); - $don = new Don($db); $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); @@ -72,14 +69,14 @@ if ($action == 'update') if (empty($donation_date)) { - $mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors'); $action = "create"; $error++; } if (empty($amount)) { - $mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); + $setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors'); $action = "create"; $error++; } @@ -125,14 +122,14 @@ if ($action == 'add') if (empty($donation_date)) { - $mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors'); $action = "create"; $error++; } if (empty($amount)) { - $mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors'); $action = "create"; $error++; } @@ -182,7 +179,9 @@ if ($action == 'valid_promesse') header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - else $mesg=$don->error; + else { + setEventMessage($don->error, 'errors'); + } } if ($action == 'set_cancel') { @@ -191,7 +190,9 @@ if ($action == 'set_cancel') header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - else $mesg=$don->error; + else { + setEventMessage($don->error, 'errors'); + } } if ($action == 'set_paid') { @@ -200,7 +201,9 @@ if ($action == 'set_paid') header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - else $mesg=$don->error; + else { + setEventMessage($don->error, 'errors'); + } } if ($action == 'set_encaisse') { @@ -209,7 +212,9 @@ if ($action == 'set_encaisse') header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - else $mesg=$don->error; + else { + setEventMessage($don->error, 'errors'); + } } /* @@ -263,8 +268,6 @@ if ($action == 'create') { print_fiche_titre($langs->trans("AddDonation")); - dol_htmloutput_errors($mesg,$mesgs); - print ''; print ''; print '
'; diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index a2bf8a7bede..920a1328a62 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -47,8 +47,6 @@ $fieldname = (! empty($ref)?'number':'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname); -$mesg=''; - $sortfield=GETPOST('sortfield', 'alpha'); $sortorder=GETPOST('sortorder', 'alpha'); $page=GETPOST('page', 'int'); @@ -122,12 +120,12 @@ if ($action == 'setref' && $user->rights->banque->cheque) $result=$object->set_number($user,$number); if ($result < 0) { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -337,9 +335,6 @@ else } } - -dol_htmloutput_errors($mesg); - $accounts = array(); if ($action == 'new') diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 1c69741b6a8..637591d0606 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1117,7 +1117,7 @@ else if ($id > 0 || ! empty($ref)) if (empty($numref)) { $error++; - dol_htmloutput_errors($object->error); + setEventMessage($object->error, 'errors'); } } else diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 4e1c3246eff..ebd02a4df91 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -52,8 +52,6 @@ $langs->load('companies'); $langs->load('products'); $langs->load('banks'); -$mesg=''; -$errors=array(); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $action = GETPOST("action"); $confirm = GETPOST("confirm"); @@ -92,12 +90,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { - if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) - { - $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; - } - else - { +// if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) +// { +// $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; +// } +// else +// { $result=$object->createFromClone($id); if ($result > 0) { @@ -107,10 +105,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes') else { $langs->load("errors"); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $action=''; } - } +// } } elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider) @@ -137,7 +135,7 @@ elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourni if (! $idwarehouse || $idwarehouse == -1) { $error++; - $errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors'); $action=''; } } @@ -165,7 +163,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fourn } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -180,7 +178,7 @@ elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights-> } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */ $action=''; } @@ -258,7 +256,9 @@ elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->cree $paiementfourn = new PaiementFourn($db); $result=$paiementfourn->fetch(GETPOST('paiement_id')); if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found - if ($result < 0) $mesg='
'.$paiementfourn->error.'
'; + if ($result < 0) { + setEventMessage($paiementfourn->error, 'errors'); + } } } @@ -272,21 +272,21 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) if (GETPOST('socid','int')<1) { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), 'errors'); $action='create'; $error++; } if ($datefacture == '') { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), 'errors'); $action='create'; $_GET['socid']=$_POST['socid']; $error++; } if (! GETPOST('ref_supplier')) { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), 'errors'); $action='create'; $_GET['socid']=$_POST['socid']; $error++; @@ -457,7 +457,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) { $langs->load("errors"); $db->rollback(); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $action='create'; $_GET['socid']=$_POST['socid']; } @@ -631,14 +631,14 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) // Product not selected $error++; $langs->load("errors"); - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")), 'errors'); } if ($idprod == -1) { // Quantity too low $error++; $langs->load("errors"); - $mesg='
'.$langs->trans("ErrorQtyTooLowForThisSupplier").'
'; + setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors'); } } else if( GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='' ) @@ -732,10 +732,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) else { $db->rollback(); - if (empty($mesg)) - { - $mesg='
'.$object->error.'
'; - } + setEventMessage($object->error, 'errors'); } $action = ''; @@ -798,7 +795,7 @@ elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer) } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } } @@ -948,7 +945,6 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P else { $langs->load("other"); - $mesg='
'; if ($mailfile->error) { $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); @@ -958,7 +954,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P { $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; } - $mesg.='
'; + setEventMessage($mesg, 'errors'); } } } @@ -966,7 +962,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P else { $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; + setEventMessage($langs->trans('ErrorMailRecipientIsEmpty'), 'errors'); dol_syslog('Recipient email is empty'); } /* } @@ -980,7 +976,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P else { $langs->load("other"); - $mesg='
'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
'; + setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), 'errors'); dol_syslog('Unable to read data from the invoice. The invoice file has perhaps not been generated.'); } @@ -1064,11 +1060,11 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fourniss if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); } else { - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } } @@ -1119,7 +1115,6 @@ if ($action == 'create') { print_fiche_titre($langs->trans('NewBill')); - dol_htmloutput_mesg($mesg); dol_htmloutput_events(); $societe=''; @@ -1146,7 +1141,6 @@ if ($action == 'create') $element = $subelement = 'commande'; } if ($element == 'propal') { - dol_htmloutput_errors('',$errors); $element = 'comm/propal'; $subelement = 'propal'; } if ($element == 'contract') { @@ -1479,9 +1473,6 @@ else dol_fiche_head($head, 'card', $titre, 0, 'bill'); - dol_htmloutput_mesg($mesg); - dol_htmloutput_errors('',$errors); - // Confirmation de la suppression d'une ligne produit if ($action == 'confirm_delete_line') { diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index f02e48a9be5..5e7658d25b0 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -503,9 +503,6 @@ if (empty($action)) print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num); - if ($mesg) dol_htmloutput_mesg($mesg); - if ($errmsg) dol_htmloutput_errors($errmsg); - print ''; print '
'; print ''; diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index fd31abaa80e..58b4624f5bc 100644 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -89,8 +89,6 @@ dol_fiche_head($head, 'attributes', $tab, 0, 'product'); print $langs->trans('DefineHereComplementaryAttributes', $tab).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/product/composition/fiche.php b/htdocs/product/composition/fiche.php index 26761a2d56b..47f7bf9c42a 100644 --- a/htdocs/product/composition/fiche.php +++ b/htdocs/product/composition/fiche.php @@ -49,8 +49,6 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); -$mesg = ''; - $product = new Product($db); $productid=0; if ($id > 0 || ! empty($ref)) @@ -83,8 +81,11 @@ $cancel <> $langs->trans("Cancel") && { $error++; $action = 're-edit'; - if ($product->error == "isFatherOfThis") $mesg = $langs->trans("ErrorAssociationIsFatherOfThis"); - else $mesg=$product->error; + if ($product->error == "isFatherOfThis") { + setEventMessage($langs->trans("ErrorAssociationIsFatherOfThis"), 'errors'); + } else { + setEventMessage($product->error, 'errors'); + } } } else @@ -97,7 +98,7 @@ $cancel <> $langs->trans("Cancel") && { $error++; $action = 're-edit'; - $mesg=$product->error; + setEventMessage($product->error, 'errors'); } } } @@ -161,10 +162,6 @@ if ($action == 'search') llxHeader("","",$langs->trans("CardProduct".$product->type)); - -dol_htmloutput_errors($mesg); - - $head=product_prepare_head($product, $user); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==1?'service':'product'); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 7c94401f861..de9ef77746d 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -90,13 +90,13 @@ if ($action == 'createtask' && $user->rights->projet->creer) { if (empty($label)) { - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors'); $action='create'; $error++; } else if (empty($_POST['task_parent'])) { - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("ChildOfTask")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("ChildOfTask")), 'errors'); $action='create'; $error++; } @@ -267,8 +267,6 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie print_fiche_titre($langs->trans("NewTask")); - dol_htmloutput_errors($mesg); - print ''; print ''; print ''; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 07479c59d34..93fd8672c16 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -442,14 +442,6 @@ else { print "
"; print ""; - -/* - * Errors - */ - -dol_htmloutput_errors($warning); -dol_htmloutput_errors($error,$errors); - llxFooter(); $db->close();