diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 0a251536ff6..670260f1287 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -68,11 +68,11 @@ if ($action == 'update' || $action == 'add') if (! $error) { - $mesg = '
'.$langs->trans("SetupSaved").'
'; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = '
'.$langs->trans("Error").'
'; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -117,10 +117,6 @@ $head = member_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Members"), 0, 'user'); - -dol_htmloutput_mesg($mesg); - - print_fiche_titre($langs->trans("MemberMainOptions"),'',''); print ''; print ''; diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 8a520a55c4e..740a5c97879 100644 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -60,11 +60,11 @@ if ($action == 'update') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -86,8 +86,6 @@ $head = member_admin_prepare_head(); dol_fiche_head($head, 'public', $langs->trans("Members"), 0, 'user'); -dol_htmloutput_mesg($mesg); - if ($conf->use_javascript_ajax) { print "\n".''."\n"; } - - if ($mesg) print $mesg; - /* * Barre d'action */ @@ -1438,8 +1431,6 @@ if ($step == 5 && $datatoimport) } print ''; } - - if ($mesg) print $mesg; } @@ -1679,8 +1670,6 @@ if ($step == 6 && $datatoimport) print $langs->trans("FileWasImported",$importid).'
'; print $langs->trans("YouCanUseImportIdToFindRecord",$importid).'
'; print ''; - - if ($mesg) print $mesg; } diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 7eefafb9c8c..30e02591190 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -67,7 +67,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - $mesg='
'.$langs->trans("SetupSaved").'
'; + setEventMessage($langs->trans("SetupSaved")); } else { @@ -227,8 +227,6 @@ if (! empty($conf->adherent->enabled)) print "
"; print info_admin($langs->trans("YouCanAddTagOnUrl")); -dol_htmloutput_mesg($mesg); - $db->close(); dol_fiche_end(); llxFooter(); diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ca77dabe8c4..e79ffcf13c6 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -91,12 +91,12 @@ if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -178,11 +178,11 @@ if($action) if (! $error) { - $mesg = ''.$langs->trans("SetupSaved").''; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = ''.$langs->trans("Error").''; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -505,14 +505,13 @@ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) } else { + //TODO: Translate print "\n"; } print '
ERROR: $dir is not a directory !
'; } -dol_htmloutput_mesg($mesg); - llxFooter(); $db->close(); 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/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 527615cc7c4..037bb2b1f8b 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -43,7 +43,7 @@ $rowid=GETPOST('rowid','int'); $action=GETPOST('action', 'alpha'); $socid=GETPOST('socid', 'int'); $backtopage=GETPOST('backtopage','alpha'); -$error=0; $mesg = ''; +$error=0; // If socid provided by ajax company selector if (! empty($_REQUEST['search_fourn_id'])) @@ -92,7 +92,7 @@ if ($action == 'remove_pf') { $result=$product->remove_product_fournisseur_price($rowid); $action = ''; - $mesg = '
'.$langs->trans("PriceRemoved").'.
'; + setEventMessage($langs->trans("PriceRemoved")); } } } @@ -112,27 +112,27 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) if ($tva_tx == '') { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")), 'errors'); } if (empty($quantity)) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")), 'errors'); } if (empty($ref_fourn)) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")), 'errors'); } if ($id_fourn <= 0) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")), 'errors'); } if ($_POST["price"] < 0 || $_POST["price"] == '') { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); } $product = new ProductFournisseur($db); @@ -140,7 +140,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) if ($result <= 0) { $error++; - $mesg=$product->error; + setEventMessage($product->error, 'errors'); } if (! $error) @@ -157,12 +157,12 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) $product->fetch($product->product_id_already_linked); $productLink = $product->getNomUrl(1,'supplier'); - $mesg='
'.$langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink).'
'; + setEventMessage($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), 'errors'); } else if ($ret < 0) { $error++; - $mesg='
'.$product->error.'
'; + setEventMessage($product->error, 'errors'); } } @@ -177,7 +177,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) if ($ret < 0) { $error++; - $mesg='
'.$product->error.'
'; + setEventMessage($product->error, 'errors'); } } @@ -264,10 +264,6 @@ if ($id || $ref) print "\n"; - - dol_htmloutput_mesg($mesg); - - // Form to add or update a price if (($action == 'add_price' || $action == 'updateprice' ) && ($user->rights->produit->creer || $user->rights->service->creer)) { diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 8d82b5548a5..7e4c4f12b10 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -230,7 +230,9 @@ else llxHeader('',$title,$helpurl,''); // Displays product removal confirmation - if (GETPOST('delprod')) dol_htmloutput_mesg($langs->trans("ProductDeleted",GETPOST('delprod'))); + if (GETPOST('delprod')) { + setEventMessage($langs->trans("ProductDeleted", GETPOST('delprod'))); + } $param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy; $param.=($fourn_id?"&fourn_id=".$fourn_id:""); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f5db524ed27..9c0597ec0f6 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -94,15 +94,16 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit- if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) { $action = ''; - $mesg = '
' . $langs->trans("RecordSaved") . '
'; + setEventMessage($langs->trans("RecordSaved")); } else { $action = 'edit_price'; - $mesg = '
' . $object->error . '
'; + setEventMessage($object->error, 'errors'); } } else if ($action == 'delete' && $user->rights->produit->supprimer) { $result = $object->log_price_delete($user, $_GET ["lineid"]); - if ($result < 0) - $mesg = '
' . $object->error . '
'; + if ($result < 0) { + setEventMessage($object->error, 'errors'); + } } /** @@ -136,11 +137,11 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu if (empty($quantity)) { $error ++; - $mesg = '
' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Qty")) . '
'; + setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("Qty")), 'errors'); } if (empty($newprice)) { $error ++; - $mesg = '
' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Price")) . '
'; + setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("Price")), 'errors'); } if (! $error) { // Calcul du prix HT et du prix unitaire @@ -547,10 +548,6 @@ print "\n"; print "\n"; -if (! empty($mesg)) { - dol_htmloutput_mesg($mesg); -} - /* ************************************************************************** */ /* */ /* Barre d'action */ diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 874b082ceae..86e930d8cf1 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -43,8 +43,6 @@ $id = GETPOST("id",'int'); if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="DESC"; -$mesg = ''; - // Security check $result=restrictedArea($user,'stock'); @@ -80,10 +78,10 @@ if ($action == 'add' && $user->rights->stock->creer) } $action = 'create'; - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } else { - $mesg='
'.$langs->trans("ErrorWarehouseRefRequired").'
'; + setEventMessage($langs->trans("ErrorWarehouseRefRequired"), 'errors'); $action="create"; // Force retour sur page creation } } @@ -101,7 +99,7 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->right } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); $action=''; } } @@ -124,18 +122,17 @@ if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) if ( $object->update($id, $user) > 0) { $action = ''; - //$mesg = '
Fiche mise a jour
'; } else { $action = 'edit'; - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } else { $action = 'edit'; - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -167,8 +164,6 @@ if ($action == 'create') print ''; print ''."\n"; - dol_htmloutput_mesg($mesg); - print ''; // Ref @@ -219,8 +214,6 @@ else $id=GETPOST("id",'int'); if ($id) { - dol_htmloutput_mesg($mesg); - $object = new Entrepot($db); $result = $object->fetch($id); if ($result < 0) @@ -496,7 +489,7 @@ else */ if (($action == 'edit' || $action == 're-edit') && 1) { - print_fiche_titre($langs->trans("WarehouseEdit"), $mesg); + $langs->trans("WarehouseEdit"); print ''; print ''; diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php index 93e8bf95647..a88dbf8b0fb 100644 --- a/htdocs/projet/activity/list.php +++ b/htdocs/projet/activity/list.php @@ -97,7 +97,7 @@ if ($action == 'addtime' && $user->rights->projet->creer) } else { - $mesg='
'.$langs->trans("ErrorTimeSpentIsEmpty").'
'; + setEventMessage($langs->trans("ErrorTimeSpentIsEmpty"), 'errors'); } } @@ -128,17 +128,9 @@ if ($id) $tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0); // We want to see all task of project i am allowed to see, not only mine. Later only mine will be editable later. $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($user,0,($project->id?$project->id:$projectsListId),0); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$user,($project->id?$project->id:$projectsListId),0); -//var_dump($tasksarray); -//var_dump($projectsrole); -//var_dump($taskrole); - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); - -dol_htmloutput_mesg($mesg); - - print ''; print ''; print ''; diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index c564a23a480..a23f65edafb 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -60,11 +60,11 @@ if ($action == 'updateMask') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -79,11 +79,11 @@ if ($action == 'updateMaskTask') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -121,13 +121,13 @@ else if ($action == 'specimen') } else { - $mesg='
'.$obj->error.'
'; + setEventMessage($obj->error, 'errors'); dol_syslog($obj->error, LOG_ERR); } } else { - $mesg='
'.$langs->trans("ErrorModuleNotFound").'
'; + setEventMessage($langs->trans("ErrorModuleNotFound"), 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -166,13 +166,13 @@ else if ($action == 'specimentask') } else { - $mesg='
'.$obj->error.'
'; + setEventMessage($obj->error, 'errors'); dol_syslog($obj->error, LOG_ERR); } } else { - $mesg='
'.$langs->trans("ErrorModuleNotFound").'
'; + setEventMessage($langs->trans("ErrorModuleNotFound"), 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -786,8 +786,6 @@ foreach ($dirmodels as $reldir) print '

'; -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index c6880547c60..ebee8cd3fa4 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -79,11 +79,11 @@ if ($action == 'addcontact' && $user->rights->projet->creer) 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'); } } } @@ -137,7 +137,6 @@ $userstatic=new User($db); /* Mode vue et edition */ /* */ /* *************************************************************************** */ -dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 00fdf65d15a..a2b5fa40e82 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -92,7 +92,7 @@ if (empty($reshook)) else { dol_syslog($object->error,LOG_DEBUG); - $mesg='
'.$langs->trans("CantRemoveProject").'
'; + setEventMessage($langs->trans("CantRemoveProject"), 'errors'); } } header("Location: ".$backtopage); @@ -111,7 +111,7 @@ if (empty($reshook)) else { dol_syslog($object->error,LOG_DEBUG); - $mesg='
'.$langs->trans("CantRemoveProject").'
'; + setEventMessage($langs->trans("CantRemoveProject"), 'errors'); } } @@ -120,12 +120,12 @@ if (empty($reshook)) $error=0; if (empty($_POST["ref"])) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")), 'errors'); $error++; } if (empty($_POST["title"])) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors'); $error++; } @@ -155,14 +155,14 @@ if (empty($reshook)) if ($result < 0) { $langs->load("errors"); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $error++; } } else { $langs->load("errors"); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $error++; } @@ -194,13 +194,13 @@ if (empty($reshook)) { $error++; //$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")), 'errors'); } if (empty($_POST["title"])) { $error++; //$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors'); } $db->begin(); @@ -245,7 +245,7 @@ if (empty($reshook)) if ($result < 0) { $error++; - $mesg='
'.$langs->trans("ErrorShiftTaskDate").':'.$object->error.'
'; + setEventMessage($langs->trans("ErrorShiftTaskDate").':'.$object->error, 'errors'); } } } @@ -306,7 +306,7 @@ if (empty($reshook)) $result = $object->setValid($user); if ($result <= 0) { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -315,7 +315,7 @@ if (empty($reshook)) $result = $object->setClose($user); if ($result <= 0) { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -324,7 +324,7 @@ if (empty($reshook)) $result = $object->setValid($user); if ($result <= 0) { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -355,7 +355,7 @@ if (empty($reshook)) $result=$object->createFromClone($object->id,$clone_contacts,$clone_tasks,$clone_project_files,$clone_task_files,$clone_notes); if ($result <= 0) { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } else { @@ -391,8 +391,6 @@ if ($action == 'create' && $user->rights->projet->creer) print_fiche_titre($langs->trans("NewProject")); - dol_htmloutput_mesg($mesg); - print ''; print ''; print ''; @@ -490,8 +488,6 @@ else * Show or edit */ - dol_htmloutput_mesg($mesg); - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); $res=$object->fetch_optionals($object->id,$extralabels); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 7c94401f861..f72b8c6963d 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++; } @@ -199,8 +199,6 @@ if ($id > 0 || ! empty($ref)) $head=project_prepare_head($object); dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project')); - dol_htmloutput_mesg(); - $param=($mode=='mine'?'&mode=mine':''); print ''; @@ -267,8 +265,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/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 722e3c9aaae..3cc8b51ca1a 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -75,11 +75,11 @@ if ($action == 'addcontact' && $user->rights->projet->creer) 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'); } } } @@ -223,8 +223,6 @@ if ($id > 0 || ! empty($ref)) //$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project //$arrayofuseridoftask=$object->getListContactId('internal'); - dol_htmloutput_mesg($mesg); - $head = task_prepare_head($object); dol_fiche_head($head, 'task_contact', $langs->trans("Task"), 0, 'projecttask'); diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 14339291c4c..5a445f4f013 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -69,7 +69,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) if (empty($_POST["label"])) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors'); } if (! $error) { @@ -122,7 +122,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->s else { $langs->load("errors"); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $action=''; } } @@ -294,8 +294,6 @@ if ($id > 0 || ! empty($ref)) //$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project //$arrayofuseridoftask=$object->getListContactId('internal'); - dol_htmloutput_mesg($mesg); - $head=task_prepare_head($object); dol_fiche_head($head, 'task_task', $langs->trans("Task"),0,'projecttask'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 19a0bd5f99f..73249620cbb 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -263,8 +263,6 @@ if ($id > 0 || ! empty($ref)) $head=task_prepare_head($object); dol_fiche_head($head, 'task_time', $langs->trans("Task"),0,'projecttask'); - dol_htmloutput_mesg($mesg); - if ($action == 'deleteline') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.'&lineid='.$_GET["lineid"].($withproject?'&withproject=1':''),$langs->trans("DeleteATimeSpent"),$langs->trans("ConfirmDeleteATimeSpent"),"confirm_delete",'','',1); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 52a72e954ae..b1680d2803e 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -77,11 +77,11 @@ if ($action == 'updateoptions') if (! $res > 0) $error++; if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -92,11 +92,11 @@ if ($action == 'updateoptions') if (! $res > 0) $error++; if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } } @@ -121,12 +121,12 @@ if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -220,11 +220,11 @@ if ($action=="setaddrefinlist") { if (! $res > 0) $error++; if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -298,9 +298,6 @@ $head = societe_admin_prepare_head(null); dol_fiche_head($head, 'general', $langs->trans("ThirdParties"), 0, 'company'); -dol_htmloutput_mesg($mesg); - - $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']); // Module to manage customer/supplier code 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(); diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 198739398a2..18de91a6a31 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -66,12 +66,12 @@ if ($action == 'add') if (empty($contactid)) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Contact")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Contact")), 'errors'); $error++; } if ($actionid <= 0) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), 'errors'); $error++; } @@ -258,8 +258,6 @@ if ($result > 0) print ''; print '
'; - dol_htmloutput_mesg($mesg); - // List of active notifications print_fiche_titre($langs->trans("ListOfActiveNotifications"),'',''); $var=true; diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index ea64135bd43..b95839d67b9 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -79,7 +79,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $result = $account->update($user); if (! $result) { - $message=$account->error; + setEventMessage($account->error, 'errors'); $_GET["action"]='edit'; // Force chargement page edition } else @@ -137,7 +137,7 @@ if ($action == 'add' && ! $_POST["cancel"]) $result = $account->update($user); // TODO Use create and include update into create method if (! $result) { - $message=$account->error; + setEventMessage($account->error, 'errors'); $_GET["action"]='create'; // Force chargement page création } else @@ -158,7 +158,7 @@ if ($action == 'setasdefault') header('Location: '.$url); exit; } else { - $message=$db->lasterror; + setEventMessage($db->lasterror, 'errors'); } } @@ -176,12 +176,12 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') } else { - $message = $account->error; + setEventMessage($account->error, 'errors'); } } else { - $message = $account->error; + setEventMessage($account->error, 'errors'); } } @@ -399,8 +399,6 @@ if ($socid && $action != 'edit' && $action != "create") if ($socid && $action == 'edit' && $user->rights->societe->creer) { - dol_htmloutput_mesg($message); - print '
'; print ''; print ''; @@ -515,8 +513,6 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) if ($socid && $action == 'create' && $user->rights->societe->creer) { - dol_htmloutput_mesg($message); - print ''; print ''; print ''; diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php index c8d2d68ebb7..f0b3532018b 100644 --- a/htdocs/societe/societe.php +++ b/htdocs/societe/societe.php @@ -284,7 +284,7 @@ if ($resql) // Show delete result message if (GETPOST('delsoc')) { - dol_htmloutput_mesg($langs->trans("CompanyDeleted",GETPOST('delsoc')),'','ok'); + setEventMessage($langs->trans("CompanyDeleted",GETPOST('delsoc'))); } $langs->load("other"); diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 3a5827904f2..5251f6bc750 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -45,7 +45,6 @@ $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); $subaction = GETPOST('subaction','alpha'); $group = GETPOST("group","int",3); -$message=''; // Define value to know what current user can do on users $canadduser=(! empty($user->admin) || $user->rights->user->user->creer); @@ -110,6 +109,8 @@ if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) } if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) { + $error = 0; + if ($id <> $user->id) { $object->fetch($id); @@ -119,11 +120,12 @@ if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) $nb = $object->getNbOfUsers("active"); if ($nb >= $conf->file->main_limit_users) { - $message='
'.$langs->trans("YourQuotaOfUsersIsReached").'
'; + $error++; + setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); } } - if (! $message) + if (! $error) { $object->setstatus(1); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); @@ -142,7 +144,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) if ($result < 0) { $langs->load("errors"); - $message='
'.$langs->trans("ErrorUserCannotBeDelete").'
'; + setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors'); } else { @@ -155,14 +157,18 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) // Action ajout user if ($action == 'add' && $canadduser) { + $error = 0; + if (! $_POST["lastname"]) { - $message='
'.$langs->trans("NameNotDefined").'
'; + $error++; + setEventMessage($langs->trans("NameNotDefined"), 'errors'); $action="create"; // Go back to create page } if (! $_POST["login"]) { - $message='
'.$langs->trans("LoginNotDefined").'
'; + $error++; + setEventMessage($langs->trans("LoginNotDefined"), 'errors'); $action="create"; // Go back to create page } @@ -171,13 +177,13 @@ if ($action == 'add' && $canadduser) $nb = $object->getNbOfUsers("active"); if ($nb >= $conf->file->main_limit_users) { - $message='
'.$langs->trans("YourQuotaOfUsersIsReached").'
'; + $error++; + setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); $action="create"; // Go back to create page } } - if (! $message) - { + if (!$error) { $object->lastname = GETPOST("lastname",'alpha'); $object->firstname = GETPOST("firstname",'alpha'); $object->login = GETPOST("login",'alpha'); @@ -266,7 +272,7 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) } else { - $message.=$object->error; + setEventMessage($object->error, 'errors'); } } } @@ -281,13 +287,13 @@ if ($action == 'update' && ! $_POST["cancel"]) if (! $_POST["lastname"]) { - $message='
'.$langs->trans("NameNotDefined").'
'; + setEventMessage($langs->trans("NameNotDefined"), 'errors'); $action="edit"; // Go back to create page $error++; } if (! $_POST["login"]) { - $message='
'.$langs->trans("LoginNotDefined").'
'; + setEventMessage($langs->trans("LoginNotDefined"), 'errors'); $action="edit"; // Go back to create page $error++; } @@ -304,7 +310,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $result=$tmpuser->fetch(0, GETPOST("login")); if ($result > 0) { - $message='
'.$langs->trans("ErrorLoginAlreadyExists").'
'; + setEventMessage($langs->trans("ErrorLoginAlreadyExists"), 'errors'); $action="edit"; // Go back to create page $error++; } @@ -367,11 +373,11 @@ if ($action == 'update' && ! $_POST["cancel"]) if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $message.='
'.$langs->trans("ErrorLoginAlreadyExists",$object->login).'
'; + setEventMessage($langs->trans("ErrorLoginAlreadyExists",$object->login), 'errors'); } else { - $message.='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -395,12 +401,12 @@ if ($action == 'update' && ! $_POST["cancel"]) $sql.= " SET fk_socpeople=NULL, fk_societe=NULL"; $sql.= " WHERE rowid=".$object->id; } + dol_syslog("fiche::update", LOG_DEBUG); $resql=$db->query($sql); - dol_syslog("fiche::update", LOG_DEBUG); if (! $resql) { $error++; - $message.='
'.$db->lasterror().'
'; + setEventMessage($db->lasterror(), 'errors'); } } @@ -427,7 +433,7 @@ if ($action == 'update' && ! $_POST["cancel"]) if (! $result > 0) { - $message .= '
'.$langs->trans("ErrorFailedToSaveFile").'
'; + setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors'); } else { @@ -445,7 +451,7 @@ if ($action == 'update' && ! $_POST["cancel"]) if (! $error && ! count($object->errors)) { - $message.='
'.$langs->trans("UserModified").'
'; + setEventMessage($langs->trans("UserModified")); $db->commit(); $login=$_SESSION["dol_login"]; @@ -469,7 +475,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $ret=$object->setPassword($user,$_POST["password"]); if ($ret < 0) { - $message.='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } } @@ -484,7 +490,7 @@ if ((($action == 'confirm_password' && $confirm == 'yes') if ($newpassword < 0) { // Echec - $message = '
'.$langs->trans("ErrorFailedToSetNewPassword").'
'; + setEventMessage($langs->trans("ErrorFailedToSetNewPassword"), 'errors'); } else { @@ -493,18 +499,16 @@ if ((($action == 'confirm_password' && $confirm == 'yes') { if ($object->send_password($user,$newpassword) > 0) { - $message = '
'.$langs->trans("PasswordChangedAndSentTo",$object->email).'
'; - //$message.=$newpassword; + setEventMessage($langs->trans("PasswordChangedAndSentTo",$object->email)); } else { - $message = '
'.$langs->trans("PasswordChangedTo",$newpassword).'
'; - $message.= '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } else { - $message = '
'.$langs->trans("PasswordChangedTo",$newpassword).'
'; + setEventMessage($langs->trans("PasswordChangedTo",$newpassword), 'errors'); } } } @@ -562,7 +566,7 @@ if ($action == 'adduserldap') } else { - $message='
'.$ldap->error.'
'; + setEventMessage($ldap->error, 'errors'); } } @@ -590,8 +594,6 @@ if (($action == 'create') || ($action == 'adduserldap')) print "
"; print "
"; - dol_htmloutput_mesg($message); - if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')) { /* @@ -648,12 +650,12 @@ if (($action == 'create') || ($action == 'adduserldap')) } else { - $message='
'.$ldap->error.'
'; + setEventMessage($ldap->error, 'errors'); } } else { - $message='
'.$ldap->error.'
'; + setEventMessage($ldap->error, 'errors'); } // Si la liste des users est rempli, on affiche la liste deroulante @@ -977,7 +979,7 @@ else $entries = $ldap->fetch($object->login,$userSearchFilter); if (! $entries) { - $message .= $ldap->error; + setEventMessage($ldap->error, 'errors'); } $passDoNotExpire = 0; @@ -1056,8 +1058,6 @@ else print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$object->login),"confirm_delete", '', 0, 1); } - dol_htmloutput_mesg($message); - /* * Fiche en mode visu */ diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index 625195bfa68..f97ef35ae6e 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -48,7 +48,6 @@ $id=GETPOST('id', 'int'); $action=GETPOST('action', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); $userid=GETPOST('user', 'int'); -$message=''; // Security check $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); @@ -76,7 +75,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") else { $langs->load("errors"); - $message = '
'.$langs->trans('ErrorForbidden').'
'; + setEventMessage($langs->trans('ErrorForbidden'), 'errors'); } } @@ -87,14 +86,10 @@ if ($action == 'add') { if ($caneditperms) { - if (! $_POST["nom"]) - { - $message='
'.$langs->trans("NameNotDefined").'
'; + if (! $_POST["nom"]) { + setEventMessage($langs->trans("NameNotDefined"), 'errors'); $action="create"; // Go back to create page - } - - if (! $message) - { + } else { $object->nom = trim($_POST["nom"]); $object->note = trim($_POST["note"]); @@ -117,7 +112,7 @@ if ($action == 'add') $db->rollback(); $langs->load("errors"); - $message='
'.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'
'; + setEventMessage($langs->trans("ErrorGroupAlreadyExists",$object->nom), 'errors'); $action="create"; // Go back to create page } } @@ -125,7 +120,7 @@ if ($action == 'add') else { $langs->load("errors"); - $message = '
'.$langs->trans('ErrorForbidden').'
'; + setEventMessage($langs->trans('ErrorForbidden'), 'errors'); } } @@ -151,14 +146,14 @@ if ($action == 'adduser' || $action =='removeuser') } else { - $message.=$edituser->error; + setEventMessage($edituser->error, 'errors'); } } } else { $langs->load("errors"); - $message = '
'.$langs->trans('ErrorForbidden').'
'; + setEventMessage($langs->trans('ErrorForbidden'), 'errors'); } } @@ -183,19 +178,19 @@ if ($action == 'update') if ($ret >= 0 && ! count($object->errors)) { - $message.='
'.$langs->trans("GroupModified").'
'; + setEventMessage($langs->trans("GroupModified")); $db->commit(); } else { - $message.='
'.$object->error.'
'; + setEventMessage($object->error); $db->rollback(); } } else { $langs->load("errors"); - $message = '
'.$langs->trans('ErrorForbidden').'
'; + setEventMessage($langs->trans('ErrorForbidden')); } } @@ -214,8 +209,6 @@ if ($action == 'create') { print_fiche_titre($langs->trans("NewGroup")); - if ($message) { print $message."
"; } - print dol_set_focus('#nom'); print ''; @@ -340,9 +333,6 @@ else print "\n"; print "
\n"; - - dol_htmloutput_mesg($message); - /* * Liste des utilisateurs dans le groupe */ diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index cde5e764af5..c3e147620c2 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -56,8 +56,6 @@ $fgroup->getrights(); if ($action == 'dolibarr2ldap') { - $message=""; - $db->begin(); $ldap=new Ldap(); @@ -71,12 +69,12 @@ if ($action == 'dolibarr2ldap') if ($result >= 0) { - $message.='
'.$langs->trans("GroupSynchronized").'
'; + setEventMessage($langs->trans("GroupSynchronized")); $db->commit(); } else { - $message.='
'.$ldap->error.'
'; + setEventMessage($ldap->error); $db->rollback(); } } @@ -135,10 +133,6 @@ print "\n"; print ''; - -dol_htmloutput_mesg($message); - - /* * Barre d'actions */ diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index ebf776e64aa..87a0dec31e2 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -52,8 +52,6 @@ $fuser->getrights(); if ($_GET["action"] == 'dolibarr2ldap') { - $message=""; - $db->begin(); $ldap=new Ldap(); @@ -67,12 +65,12 @@ if ($_GET["action"] == 'dolibarr2ldap') if ($result >= 0) { - $message.='
'.$langs->trans("UserSynchronized").'
'; + setEventMessage($langs->trans("UserSynchronized")); $db->commit(); } else { - $message.='
'.$ldap->error.'
'; + setEventMessage($ldap->error, 'errors'); $db->rollback(); } } @@ -152,10 +150,6 @@ print ''; print ''; - -dol_htmloutput_mesg($message); - - /* * Barre d'actions */