Migrated old error notifications to the """new""" system

This commit is contained in:
Marcos García de La Fuente 2014-07-20 01:43:46 +02:00
parent ac824728bc
commit 43597c1731
22 changed files with 98 additions and 151 deletions

View File

@ -52,7 +52,6 @@ $object = new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$adht = new AdherentType($db); $adht = new AdherentType($db);
$errmsg=''; $errmsg='';
$errmsgs=array();
$defaultdelay=1; $defaultdelay=1;
$defaultdelayunit='y'; $defaultdelayunit='y';
@ -108,7 +107,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans($company->error); $errmsg=$langs->trans($company->error);
$errmsgs=$company->errors; setEventMessage($company->errors, 'errors');
} }
else else
{ {
@ -282,7 +281,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
{ {
$error++; $error++;
$errmsg=$object->error; $errmsg=$object->error;
$errmsgs=$object->errors; setEventMessage($object->errors, 'errors');
} }
if (! $error) if (! $error)
@ -444,7 +443,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
if (! ($bank_line_id > 0)) if (! ($bank_line_id > 0))
{ {
$errmsg=$paiement->error; $errmsg=$paiement->error;
$errmsgs=$paiement->errors; setEventMessage($paiement->errors, 'errors');
$error++; $error++;
} }
} }
@ -689,7 +688,7 @@ if ($rowid)
dol_fiche_end(); dol_fiche_end();
dol_htmloutput_errors($errmsg,$errmsgs); dol_htmloutput_errors($errmsg);
/* /*

View File

@ -34,7 +34,6 @@ if (! $user->admin) accessforbidden();
$rowid = GETPOST('rowid','int'); $rowid = GETPOST('rowid','int');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$errmesg='';
// Define possible position of boxes // Define possible position of boxes
$pos_name = getStaticMember('InfoBox','listOfPages'); $pos_name = getStaticMember('InfoBox','listOfPages');
@ -80,7 +79,7 @@ if ($action == 'add')
} }
else else
{ {
$errmesg=$db->lasterror(); setEventMessage($db->lasterror(), 'errors');
$error++; $error++;
} }
} }
@ -116,7 +115,7 @@ if ($action == 'add')
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) if (! $resql)
{ {
$errmesg=$db->lasterror(); setEventMessage($db->lasterror(), 'errors');
$error++; $error++;
} }
} }
@ -217,9 +216,6 @@ print_fiche_titre($langs->trans("Boxes"),'','setup');
print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n"; print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
dol_htmloutput_errors($errmesg);
/* /*
* Recherche des boites actives par defaut pour chaque position possible * Recherche des boites actives par defaut pour chaque position possible
* On stocke les boites actives par defaut dans $boxes[position][id_boite]=1 * On stocke les boites actives par defaut dans $boxes[position][id_boite]=1

View File

@ -120,7 +120,10 @@ $var=true;
if (empty($conf->use_javascript_ajax)) 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 else
{ {

View File

@ -43,7 +43,6 @@ static $tmpstatut2label=array(
$statut2label=array(''); $statut2label=array('');
foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val); foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val);
$mesg='';
$errors=array(); $errors=array();
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
@ -64,8 +63,6 @@ $title = $langs->trans('FiscalYears');
print_fiche_titre($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 = "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.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;

View File

@ -49,8 +49,6 @@ foreach($dirmenus as $dirmenu)
} }
$error=0; $error=0;
$errmsgs=array();
// Cette page peut etre longue. On augmente le delai autorise. // Cette page peut etre longue. On augmente le delai autorise.
// Ne fonctionne que si on est pas en safe_mode. // Ne fonctionne que si on est pas en safe_mode.
@ -105,7 +103,8 @@ if ($action == 'update' && empty($_POST["cancel"]))
else else
{ {
$error++; $error++;
$errmsgs[]='Failed to initialize menu '.$key.'.'; //TODO: Translate
setEventMessage('Failed to initialize menu '.$key.'.', 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -268,10 +267,6 @@ else
print '</div>'; print '</div>';
dol_htmloutput_errors('',$errmsgs);
if ($action != 'edit') if ($action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';

View File

@ -37,8 +37,6 @@ $forbarcode=GETPOST('forbarcode');
$fk_barcode_type=GETPOST('fk_barcode_type'); $fk_barcode_type=GETPOST('fk_barcode_type');
$eraseallbarcode=GETPOST('eraseallbarcode'); $eraseallbarcode=GETPOST('eraseallbarcode');
$mesg='';
$action=GETPOST('action'); $action=GETPOST('action');
$producttmp=new Product($db); $producttmp=new Product($db);
@ -198,8 +196,6 @@ print '<br>';
print $langs->trans("MassBarcodeInitDesc").'<br>'; print $langs->trans("MassBarcodeInitDesc").'<br>';
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>'; //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
//print '<br>'; //print '<br>';

View File

@ -80,12 +80,12 @@ if ($action == 'update' && $user->rights->categorie->creer)
if (empty($categorie->label)) if (empty($categorie->label))
{ {
$action = 'create'; $action = 'create';
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors');
} }
if (empty($categorie->description)) if (empty($categorie->description))
{ {
$action = 'create'; $action = 'create';
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")), 'errors');
} }
if (empty($categorie->error)) if (empty($categorie->error))
{ {
@ -98,12 +98,12 @@ if ($action == 'update' && $user->rights->categorie->creer)
} }
else else
{ {
$mesg=$categorie->error; setEventMessage($categorie->error, 'errors');
} }
} }
else else
{ {
$mesg=$categorie->error; setEventMessage($categorie->error, 'errors');
} }
} }
@ -117,10 +117,6 @@ llxHeader("","",$langs->trans("Categories"));
print_fiche_titre($langs->trans("ModifCat")); print_fiche_titre($langs->trans("ModifCat"));
dol_htmloutput_errors($mesg);
$object->fetch($id); $object->fetch($id);
$form = new Form($db); $form = new Form($db);

View File

@ -131,7 +131,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
if (! $object->label) if (! $object->label)
{ {
$error++; $error++;
$errors[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")), 'errors');
$action = 'create'; $action = 'create';
} }
@ -224,8 +224,6 @@ if ($user->rights->categorie->creer)
print_fiche_titre($langs->trans("CreateCat")); print_fiche_titre($langs->trans("CreateCat"));
dol_htmloutput_errors('',$errors);
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';
// Ref // Ref

View File

@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'update')
} }
else else
{ {
$mesg = $object->error; setEventMessage($object->error, 'errors');
$action='create'; $action='create';
} }
} }
@ -147,7 +147,7 @@ if ($action == 'add' || $action == 'update')
else else
{ {
$reload = 0; $reload = 0;
$mesg = $object->error; setEventMessage($object->error, 'errors');
$actino= "edit"; $actino= "edit";
} }
} }
@ -181,9 +181,6 @@ $form = new Form($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
dol_htmloutput_errors($mesg);
if ($action == 'create') if ($action == 'create')
{ {
if ($user->rights->societe->creer) if ($user->rights->societe->creer)

View File

@ -1645,7 +1645,7 @@ if ($action == 'create') {
$numref = $object->getNextNumRef($soc); $numref = $object->getNextNumRef($soc);
if (empty($numref)) { if (empty($numref)) {
$error ++; $error ++;
dol_htmloutput_errors($object->error); setEventMessage($object->error, 'errors');
} }
} else { } else {
$numref = $object->ref; $numref = $object->ref;

View File

@ -71,7 +71,7 @@ if (GETPOST("action") == 'setremise')
} }
else else
{ {
$errmesg=$soc->error; setEventMessage($soc->error, 'errors');
} }
} }
@ -97,8 +97,6 @@ if ($socid > 0)
$objsoc->id=$socid; $objsoc->id=$socid;
$objsoc->fetch($socid); $objsoc->fetch($socid);
dol_htmloutput_errors($errmesg);
$head = societe_prepare_head($objsoc); $head = societe_prepare_head($objsoc);
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company');

View File

@ -72,8 +72,6 @@ if ($negpage)
if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage"); if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage");
} }
$mesg='';
$object = new Account($db); $object = new Account($db);
/* /*
@ -83,6 +81,8 @@ $dateop=-1;
if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier)
{ {
$error = 0;
if (price2num($_POST["credit"]) > 0) if (price2num($_POST["credit"]) > 0)
{ {
$amount = price2num($_POST["credit"]); $amount = price2num($_POST["credit"]);
@ -98,11 +98,20 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
$label=$_POST["label"]; $label=$_POST["label"];
$cat1=$_POST["cat1"]; $cat1=$_POST["cat1"];
if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); if (! $dateop) {
if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); $error++;
if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); 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); $object->fetch($id);
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); $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 else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
else else
@ -295,8 +304,6 @@ if ($id > 0 || ! empty($ref))
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
/** /**
* Search form * Search form
*/ */

View File

@ -44,8 +44,6 @@ $result = restrictedArea($user, 'deplacement', $id,'');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$mesg = '';
$object = new Deplacement($db); $object = new Deplacement($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // 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 else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -88,7 +86,7 @@ else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->depl
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
@ -109,17 +107,17 @@ else if ($action == 'add' && $user->rights->deplacement->creer)
if (! $object->date) if (! $object->date)
{ {
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
$error++; $error++;
} }
if ($object->type == '-1') // Otherwise it is TF_LUNCH,... if ($object->type == '-1') // Otherwise it is TF_LUNCH,...
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
$error++; $error++;
} }
if (! ($object->fk_user > 0)) if (! ($object->fk_user > 0))
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")), 'errors');
$error++; $error++;
} }
@ -134,7 +132,7 @@ else if ($action == 'add' && $user->rights->deplacement->creer)
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
$action='create'; $action='create';
} }
} }
@ -174,7 +172,7 @@ else if ($action == 'update' && $user->rights->deplacement->creer)
} }
else else
{ {
$mesg=$object->error; setEventMessage($object->error, 'errors');
} }
} }
else else
@ -226,8 +224,6 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewTrip")); 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')); $datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
@ -299,8 +295,6 @@ else if ($id)
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) if ($result > 0)
{ {
dol_htmloutput_mesg($mesg);
$head = trip_prepare_head($object); $head = trip_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');

View File

@ -43,9 +43,6 @@ $action=GETPOST('action','alpha');
$cancel=GETPOST('cancel'); $cancel=GETPOST('cancel');
$amount=GETPOST('amount'); $amount=GETPOST('amount');
$mesg="";
$mesgs=array();
$don = new Don($db); $don = new Don($db);
$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
@ -72,14 +69,14 @@ if ($action == 'update')
if (empty($donation_date)) if (empty($donation_date))
{ {
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
if (empty($amount)) if (empty($amount))
{ {
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); $setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
@ -125,14 +122,14 @@ if ($action == 'add')
if (empty($donation_date)) if (empty($donation_date))
{ {
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
if (empty($amount)) if (empty($amount))
{ {
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
@ -182,7 +179,9 @@ if ($action == 'valid_promesse')
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else $mesg=$don->error; else {
setEventMessage($don->error, 'errors');
}
} }
if ($action == 'set_cancel') if ($action == 'set_cancel')
{ {
@ -191,7 +190,9 @@ if ($action == 'set_cancel')
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else $mesg=$don->error; else {
setEventMessage($don->error, 'errors');
}
} }
if ($action == 'set_paid') if ($action == 'set_paid')
{ {
@ -200,7 +201,9 @@ if ($action == 'set_paid')
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else $mesg=$don->error; else {
setEventMessage($don->error, 'errors');
}
} }
if ($action == 'set_encaisse') if ($action == 'set_encaisse')
{ {
@ -209,7 +212,9 @@ if ($action == 'set_encaisse')
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else $mesg=$don->error; else {
setEventMessage($don->error, 'errors');
}
} }
/* /*
@ -263,8 +268,6 @@ if ($action == 'create')
{ {
print_fiche_titre($langs->trans("AddDonation")); print_fiche_titre($langs->trans("AddDonation"));
dol_htmloutput_errors($mesg,$mesgs);
print '<form name="add" action="fiche.php" method="post">'; print '<form name="add" action="fiche.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -47,8 +47,6 @@ $fieldname = (! empty($ref)?'number':'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname); $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname);
$mesg='';
$sortfield=GETPOST('sortfield', 'alpha'); $sortfield=GETPOST('sortfield', 'alpha');
$sortorder=GETPOST('sortorder', 'alpha'); $sortorder=GETPOST('sortorder', 'alpha');
$page=GETPOST('page', 'int'); $page=GETPOST('page', 'int');
@ -122,12 +120,12 @@ if ($action == 'setref' && $user->rights->banque->cheque)
$result=$object->set_number($user,$number); $result=$object->set_number($user,$number);
if ($result < 0) if ($result < 0)
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
@ -337,9 +335,6 @@ else
} }
} }
dol_htmloutput_errors($mesg);
$accounts = array(); $accounts = array();
if ($action == 'new') if ($action == 'new')

View File

@ -1117,7 +1117,7 @@ else if ($id > 0 || ! empty($ref))
if (empty($numref)) if (empty($numref))
{ {
$error++; $error++;
dol_htmloutput_errors($object->error); setEventMessage($object->error, 'errors');
} }
} }
else else

View File

@ -52,8 +52,6 @@ $langs->load('companies');
$langs->load('products'); $langs->load('products');
$langs->load('banks'); $langs->load('banks');
$mesg='';
$errors=array();
$id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int'));
$action = GETPOST("action"); $action = GETPOST("action");
$confirm = GETPOST("confirm"); $confirm = GETPOST("confirm");
@ -92,12 +90,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes') if ($action == 'confirm_clone' && $confirm == 'yes')
{ {
if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) // if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{ // {
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>'; // $mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
} // }
else // else
{ // {
$result=$object->createFromClone($id); $result=$object->createFromClone($id);
if ($result > 0) if ($result > 0)
{ {
@ -107,10 +105,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans($object->error).'</div>'; setEventMessage($langs->trans($object->error), 'errors');
$action=''; $action='';
} }
} // }
} }
elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider) 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) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
$action=''; $action='';
} }
} }
@ -165,7 +163,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fourn
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
@ -180,7 +178,7 @@ elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights->
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
/* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */ /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */
$action=''; $action='';
} }
@ -258,7 +256,9 @@ elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->cree
$paiementfourn = new PaiementFourn($db); $paiementfourn = new PaiementFourn($db);
$result=$paiementfourn->fetch(GETPOST('paiement_id')); $result=$paiementfourn->fetch(GETPOST('paiement_id'));
if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found
if ($result < 0) $mesg='<div class="error">'.$paiementfourn->error.'</div>'; if ($result < 0) {
setEventMessage($paiementfourn->error, 'errors');
}
} }
} }
@ -272,21 +272,21 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
if (GETPOST('socid','int')<1) if (GETPOST('socid','int')<1)
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), 'errors');
$action='create'; $action='create';
$error++; $error++;
} }
if ($datefacture == '') if ($datefacture == '')
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), 'errors');
$action='create'; $action='create';
$_GET['socid']=$_POST['socid']; $_GET['socid']=$_POST['socid'];
$error++; $error++;
} }
if (! GETPOST('ref_supplier')) if (! GETPOST('ref_supplier'))
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'</div>'; setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), 'errors');
$action='create'; $action='create';
$_GET['socid']=$_POST['socid']; $_GET['socid']=$_POST['socid'];
$error++; $error++;
@ -457,7 +457,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
{ {
$langs->load("errors"); $langs->load("errors");
$db->rollback(); $db->rollback();
$mesg='<div class="error">'.$langs->trans($object->error).'</div>'; setEventMessage($langs->trans($object->error), 'errors');
$action='create'; $action='create';
$_GET['socid']=$_POST['socid']; $_GET['socid']=$_POST['socid'];
} }
@ -631,14 +631,14 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
// Product not selected // Product not selected
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")), 'errors');
} }
if ($idprod == -1) if ($idprod == -1)
{ {
// Quantity too low // Quantity too low
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>'; setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors');
} }
} }
else if( GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='' ) else if( GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='' )
@ -732,10 +732,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
else else
{ {
$db->rollback(); $db->rollback();
if (empty($mesg)) setEventMessage($object->error, 'errors');
{
$mesg='<div class="error">'.$object->error.'</div>';
}
} }
$action = ''; $action = '';
@ -798,7 +795,7 @@ elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer)
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -948,7 +945,6 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
else else
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">';
if ($mailfile->error) if ($mailfile->error)
{ {
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); $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.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
} }
$mesg.='</div>'; setEventMessage($mesg, 'errors');
} }
} }
} }
@ -966,7 +962,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
else else
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>'; setEventMessage($langs->trans('ErrorMailRecipientIsEmpty'), 'errors');
dol_syslog('Recipient email is empty'); dol_syslog('Recipient email is empty');
} }
/* } /* }
@ -980,7 +976,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
else else
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'</div>'; 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.'); 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') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>'; setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} }
else else
{ {
$mesg = '<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -1119,7 +1115,6 @@ if ($action == 'create')
{ {
print_fiche_titre($langs->trans('NewBill')); print_fiche_titre($langs->trans('NewBill'));
dol_htmloutput_mesg($mesg);
dol_htmloutput_events(); dol_htmloutput_events();
$societe=''; $societe='';
@ -1146,7 +1141,6 @@ if ($action == 'create')
$element = $subelement = 'commande'; $element = $subelement = 'commande';
} }
if ($element == 'propal') { if ($element == 'propal') {
dol_htmloutput_errors('',$errors);
$element = 'comm/propal'; $subelement = 'propal'; $element = 'comm/propal'; $subelement = 'propal';
} }
if ($element == 'contract') { if ($element == 'contract') {
@ -1479,9 +1473,6 @@ else
dol_fiche_head($head, 'card', $titre, 0, 'bill'); dol_fiche_head($head, 'card', $titre, 0, 'bill');
dol_htmloutput_mesg($mesg);
dol_htmloutput_errors('',$errors);
// Confirmation de la suppression d'une ligne produit // Confirmation de la suppression d'une ligne produit
if ($action == 'confirm_delete_line') if ($action == 'confirm_delete_line')
{ {

View File

@ -503,9 +503,6 @@ if (empty($action))
print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num); 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 '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -89,8 +89,6 @@ dol_fiche_head($head, 'attributes', $tab, 0, 'product');
print $langs->trans('DefineHereComplementaryAttributes', $tab).'<br>'."\n"; print $langs->trans('DefineHereComplementaryAttributes', $tab).'<br>'."\n";
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg);
// Load attribute_label // Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype); $extrafields->fetch_name_optionals_label($elementtype);

View File

@ -49,8 +49,6 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
$mesg = '';
$product = new Product($db); $product = new Product($db);
$productid=0; $productid=0;
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
@ -83,8 +81,11 @@ $cancel <> $langs->trans("Cancel") &&
{ {
$error++; $error++;
$action = 're-edit'; $action = 're-edit';
if ($product->error == "isFatherOfThis") $mesg = $langs->trans("ErrorAssociationIsFatherOfThis"); if ($product->error == "isFatherOfThis") {
else $mesg=$product->error; setEventMessage($langs->trans("ErrorAssociationIsFatherOfThis"), 'errors');
} else {
setEventMessage($product->error, 'errors');
}
} }
} }
else else
@ -97,7 +98,7 @@ $cancel <> $langs->trans("Cancel") &&
{ {
$error++; $error++;
$action = 're-edit'; $action = 're-edit';
$mesg=$product->error; setEventMessage($product->error, 'errors');
} }
} }
} }
@ -161,10 +162,6 @@ if ($action == 'search')
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
dol_htmloutput_errors($mesg);
$head=product_prepare_head($product, $user); $head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type); $titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');

View File

@ -90,13 +90,13 @@ if ($action == 'createtask' && $user->rights->projet->creer)
{ {
if (empty($label)) if (empty($label))
{ {
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors');
$action='create'; $action='create';
$error++; $error++;
} }
else if (empty($_POST['task_parent'])) else if (empty($_POST['task_parent']))
{ {
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("ChildOfTask")); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("ChildOfTask")), 'errors');
$action='create'; $action='create';
$error++; $error++;
} }
@ -267,8 +267,6 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie
print_fiche_titre($langs->trans("NewTask")); print_fiche_titre($langs->trans("NewTask"));
dol_htmloutput_errors($mesg);
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="createtask">'; print '<input type="hidden" name="action" value="createtask">';

View File

@ -442,14 +442,6 @@ else {
print "</table>"; print "</table>";
print "</form>"; print "</form>";
/*
* Errors
*/
dol_htmloutput_errors($warning);
dol_htmloutput_errors($error,$errors);
llxFooter(); llxFooter();
$db->close(); $db->close();