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 '