Fix: try to use $mesgs (array) for stock all messages and

$_SESSION['dol_message'] for specific message when a page is reloading
This commit is contained in:
Regis Houssin 2012-07-23 21:31:10 +02:00
parent d5ff308992
commit eba0db736e
4 changed files with 67 additions and 78 deletions

View File

@ -62,7 +62,7 @@ if ($action == 'create')
{ {
if (! is_array($selected)) if (! is_array($selected))
{ {
$mesg='<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>'; $mesgs[]='<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>';
} }
else else
{ {
@ -80,9 +80,9 @@ $htmlother = new FormOther($db);
/* /*
* Actions * Actions
*/ */
if (($action == 'create' || $action == 'add') && ! $mesg ) if (($action == 'create' || $action == 'add') && empty($mesgs))
{ {
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
@ -92,8 +92,10 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); if (! empty($conf->projet->enabled)) {
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
}
$langs->load('bills'); $langs->load('bills');
$langs->load('products'); $langs->load('products');
$langs->load('main'); $langs->load('main');
@ -117,7 +119,6 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
$_POST['originid']=$orders_id[0]; $_POST['originid']=$orders_id[0];
} }
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
$sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']); $sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']);
$projectid=isset($_GET['projectid'])?$_GET['projectid']:0; $projectid=isset($_GET['projectid'])?$_GET['projectid']:0;
$id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility $id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility
@ -242,7 +243,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
} }
else else
{ {
$mesg=$discount->error; $mesgs[]=$discount->error;
$error++; $error++;
break; break;
} }
@ -310,7 +311,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
} }
else else
{ {
$mesg=$srcobject->error; $mesgs[]=$srcobject->error;
$error++; $error++;
} }
$ii++; $ii++;
@ -318,7 +319,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
} }
else else
{ {
$mesg=$object->error; $mesgs[]=$object->error;
$error++; $error++;
} }
} }
@ -338,7 +339,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
$action='create'; $action='create';
$_GET["origin"]=$_POST["origin"]; $_GET["origin"]=$_POST["origin"];
$_GET["originid"]=$_POST["originid"]; $_GET["originid"]=$_POST["originid"];
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>'; $mesgs[]='<div class="error">'.$object->error.'</div>';
} }
} }
@ -354,9 +355,10 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
if ($action == 'create') if ($action == 'create')
{ {
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
llxHeader(); llxHeader();
print_fiche_titre($langs->trans('NewBill')); print_fiche_titre($langs->trans('NewBill'));
dol_htmloutput_mesg($mesg);
$soc = new Societe($db); $soc = new Societe($db);
if ($socid) $res=$soc->fetch($socid); if ($socid) $res=$soc->fetch($socid);
if ($res) if ($res)
@ -474,7 +476,6 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
print "</form>\n"; print "</form>\n";
} }
//Mode liste //Mode liste
else else
{ {
@ -669,8 +670,8 @@ else
} }
$db->close(); dol_htmloutput_mesg($mesg,$mesgs);
dol_htmloutput_mesg($mesg);
llxFooter();
llxFooter();
$db->close();
?> ?>

View File

@ -54,11 +54,6 @@ $langs->load('main');
if (! empty($conf->margin->enabled)) if (! empty($conf->margin->enabled))
$langs->load('margins'); $langs->load('margins');
$mesg='';
$errors=array();
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
$sall=trim(GETPOST('sall')); $sall=trim(GETPOST('sall'));
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0); $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
@ -116,7 +111,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
{ {
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>'; $mesgs[]='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
} }
else else
{ {
@ -130,7 +125,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
} }
else else
{ {
$mesg=$object->error; $mesgs[]=$object->error;
$action=''; $action='';
} }
} }
@ -152,7 +147,7 @@ else if ($action == 'reopen' && $user->rights->facture->creer)
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; $mesgs[]='<div class="error">'.$object->error.'</div>';
} }
} }
} }
@ -170,7 +165,7 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; $mesgs[]='<div class="error">'.$object->error.'</div>';
} }
} }
@ -206,7 +201,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
} }
else else
{ {
$mesg='<div clas="error">'.$object->error.'</div>'; $mesgs[]='<div clas="error">'.$object->error.'</div>';
$action=''; $action='';
} }
} }
@ -230,7 +225,7 @@ else if ($action == 'valid' && $user->rights->facture->creer)
// Si avoir, le signe doit etre negatif // Si avoir, le signe doit etre negatif
if ($object->total_ht >= 0) if ($object->total_ht >= 0)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'</div>';
$action=''; $action='';
} }
} }
@ -239,7 +234,7 @@ else if ($action == 'valid' && $user->rights->facture->creer)
// Si non avoir, le signe doit etre positif // Si non avoir, le signe doit etre positif
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'</div>';
$action=''; $action='';
} }
} }
@ -306,7 +301,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
$result=$object->insert_discount($_POST["remise_id"]); $result=$object->insert_discount($_POST["remise_id"]);
if ($result < 0) if ($result < 0)
{ {
$mesg='<div class="error">'.$object->error.'</div>'; $mesgs[]='<div class="error">'.$object->error.'</div>';
} }
} }
else else
@ -323,7 +318,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
$result=$discount->link_to_invoice(0,$id); $result=$discount->link_to_invoice(0,$id);
if ($result < 0) if ($result < 0)
{ {
$mesg='<div class="error">'.$discount->error.'</div>'; $mesgs[]='<div class="error">'.$discount->error.'</div>';
} }
} }
} }
@ -390,7 +385,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; $mesgs[]='<div class="error">'.$object->error.'</div>';
} }
} }
} }
@ -486,7 +481,7 @@ else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->righ
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>';
} }
} }
// Classify "abandoned" // Classify "abandoned"
@ -501,7 +496,7 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes')
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>';
} }
} }
@ -560,18 +555,18 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
$result=$object->set_paid($user); $result=$object->set_paid($user);
if ($result > 0) if ($result > 0)
{ {
//$mesg='OK'.$discount->id; //$mesgs[]='OK'.$discount->id;
$db->commit(); $db->commit();
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; $mesgs[]='<div class="error">'.$object->error.'</div>';
$db->rollback(); $db->rollback();
} }
} }
else else
{ {
$mesg='<div class="error">'.$discount->error.'</div>'; $mesgs[]='<div class="error">'.$discount->error.'</div>';
$db->rollback(); $db->rollback();
} }
} }
@ -595,13 +590,13 @@ else if ($action == 'add' && $user->rights->facture->creer)
if (empty($datefacture)) if (empty($datefacture))
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
} }
if (! ($_POST['fac_replacement'] > 0)) if (! ($_POST['fac_replacement'] > 0))
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'</div>';
} }
if (! $error) if (! $error)
@ -627,7 +622,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->type = 1; $object->type = 1;
$id=$object->createFromCurrent($user); $id=$object->createFromCurrent($user);
if ($id <= 0) $mesg=$object->error; if ($id <= 0) $mesgs[]=$object->error;
} }
} }
@ -637,14 +632,14 @@ else if ($action == 'add' && $user->rights->facture->creer)
if (! $_POST['fac_avoir'] > 0) if (! $_POST['fac_avoir'] > 0)
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'</div>';
} }
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) if (empty($datefacture))
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
} }
if (! $error) if (! $error)
@ -696,7 +691,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
if (empty($datefacture)) if (empty($datefacture))
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
} }
if (! $error) if (! $error)
@ -725,7 +720,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
if (empty($datefacture)) if (empty($datefacture))
{ {
$error++; $error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
} }
if (! $error) if (! $error)
@ -816,7 +811,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
} }
else else
{ {
$mesg=$discount->error; $mesgs[]=$discount->error;
$error++; $error++;
break; break;
} }
@ -895,13 +890,13 @@ else if ($action == 'add' && $user->rights->facture->creer)
} }
else else
{ {
$mesg=$srcobject->error; $mesgs[]=$srcobject->error;
$error++; $error++;
} }
} }
else else
{ {
$mesg=$object->error; $mesgs[]=$object->error;
$error++; $error++;
} }
} }
@ -938,7 +933,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$action='create'; $action='create';
$_GET["origin"]=$_POST["origin"]; $_GET["origin"]=$_POST["origin"];
$_GET["originid"]=$_POST["originid"]; $_GET["originid"]=$_POST["originid"];
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>'; $mesgs[]='<div class="error">'.$object->error.'</div>';
} }
} }
@ -950,27 +945,27 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
if ($_POST['np_price'] < 0 && $_POST["qty"] < 0) if ($_POST['np_price'] < 0 && $_POST["qty"] < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'</div>';
$result = -1 ; $result = -1 ;
} }
if (empty($_POST['idprod']) && $_POST["type"] < 0) if (empty($_POST['idprod']) && $_POST["type"] < 0)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
$result = -1 ; $result = -1 ;
} }
if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not '' if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not ''
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>';
$result = -1 ; $result = -1 ;
} }
if (empty($_POST['idprod']) && empty($_POST["np_desc"]) && empty($_POST["dp_desc"])) if (empty($_POST['idprod']) && empty($_POST["np_desc"]) && empty($_POST["dp_desc"]))
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'</div>';
$result = -1 ; $result = -1 ;
} }
if (! isset($_POST['qty']) || $_POST['qty']=='') if (! isset($_POST['qty']) || $_POST['qty']=='')
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'</div>'; $mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'</div>';
$result = -1 ; $result = -1 ;
} }
if ($result >= 0 && ( ($_POST['np_price']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod'] ) ) if ($result >= 0 && ( ($_POST['np_price']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod'] ) )
@ -1082,7 +1077,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$pa_ht = $_POST['np_buying_price']; $pa_ht = $_POST['np_buying_price'];
else else
$pa_ht = null; $pa_ht = null;
$info_bits=0; $info_bits=0;
if ($tva_npr) $info_bits |= 0x01; if ($tva_npr) $info_bits |= 0x01;
@ -1155,7 +1150,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
} }
else else
{ {
if (empty($mesg)) $mesg='<div class="error">'.$object->error.'</div>'; $mesgs[]='<div class="error">'.$object->error.'</div>';
} }
$action=''; $action='';
@ -1194,7 +1189,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
// Check parameters // Check parameters
if (! GETPOST('productid') && GETPOST("type") < 0) if (! GETPOST('productid') && GETPOST("type") < 0)
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>'; $mesgs[] = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
$result = -1 ; $result = -1 ;
} }
// Check minimum price // Check minimum price
@ -1210,7 +1205,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
if ($object->type!=2 && $price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) if ($object->type!=2 && $price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
{ {
//print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min; //print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min;
$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'</div>'; $mesgs[] = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'</div>';
$result=-1; $result=-1;
} }
@ -1328,7 +1323,7 @@ if (GETPOST('addfile'))
$vardir=$conf->user->dir_output."/".$user->id; $vardir=$conf->user->dir_output."/".$user->id;
$upload_dir_tmp = $vardir.'/temp'; $upload_dir_tmp = $vardir.'/temp';
$mesg=dol_add_file_process($upload_dir_tmp,0,0); $mesgs[]=dol_add_file_process($upload_dir_tmp,0,0);
$action='presend'; $action='presend';
} }
@ -1345,7 +1340,7 @@ if (! empty($_POST['removedfile']))
$upload_dir_tmp = $vardir.'/temp'; $upload_dir_tmp = $vardir.'/temp';
// TODO Delete only files that was uploaded from email form // TODO Delete only files that was uploaded from email form
$mesg=dol_remove_file_process($_POST['removedfile'],0); $mesgs[]=dol_remove_file_process($_POST['removedfile'],0);
$action='presend'; $action='presend';
} }
@ -1476,8 +1471,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
{ {
// Redirect here // Redirect here
// This avoid sending mail twice if going out and then back to page // This avoid sending mail twice if going out and then back to page
$_SESSION['message'] = $mesg; $_SESSION['dol_message'] = $mesg;
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&mesg=1'); Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id);
exit; exit;
} }
} }
@ -1495,27 +1490,28 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$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>'; $mesg.='</div>';
$mesgs[]=$mesg;
} }
} }
/* } /* }
else else
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>'; $mesgs[]='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
dol_syslog('Recipient email is empty'); dol_syslog('Recipient email is empty');
}*/ }*/
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>'; $mesgs[]='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
dol_syslog('Failed to read file: '.$file); dol_syslog('Failed to read file: '.$file);
} }
} }
else else
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'</div>'; $mesgs[]='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'</div>';
dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.'); dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.');
} }
@ -1571,7 +1567,7 @@ else if ($action == 'remove_file')
$upload_dir = $conf->facture->dir_output; $upload_dir = $conf->facture->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
dol_delete_file($file,0,0,0,$object); dol_delete_file($file,0,0,0,$object);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>'; $mesgs[] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
} }
} }
@ -1597,11 +1593,11 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
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>'; $mesgs[] = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
} }
else else
{ {
$mesg = '<div class="error">'.$object->error.'</div>'; $mesgs[] = '<div class="error">'.$object->error.'</div>';
} }
} }
} }
@ -1661,9 +1657,6 @@ if ($action == 'create')
print_fiche_titre($langs->trans('NewBill')); print_fiche_titre($langs->trans('NewBill'));
dol_htmloutput_mesg($mesg);
dol_htmloutput_errors('',$errors);
$soc = new Societe($db); $soc = new Societe($db);
if ($socid) $res=$soc->fetch($socid); if ($socid) $res=$soc->fetch($socid);
@ -2109,8 +2102,6 @@ else if ($id > 0 || ! empty($ref))
/* /*
* Show object in view mode * Show object in view mode
*/ */
dol_htmloutput_mesg($mesg);
dol_htmloutput_errors('',$errors);
$result=$object->fetch($id,$ref); $result=$object->fetch($id,$ref);
if ($result > 0) if ($result > 0)
@ -3332,7 +3323,8 @@ else if ($id > 0 || ! empty($ref))
} }
} }
dol_htmloutput_mesg('',$mesgs);
llxFooter(); llxFooter();
$db->close(); $db->close();
?> ?>

View File

@ -38,22 +38,18 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
if ($conf->projet->enabled) if (! empty($conf->projet->enabled))
{ {
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
} }
$langs->load('bills'); $langs->load('bills');
//print 'ee'.$langs->trans('BillsCustomer');exit;
$langs->load('companies'); $langs->load('companies');
$langs->load('products'); $langs->load('products');
$langs->load('main'); $langs->load('main');
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
$sall=trim(GETPOST('sall')); $sall=trim(GETPOST('sall'));
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0); $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);

View File

@ -725,7 +725,7 @@ $bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
$mesg=''; $mesgs=array(); $mesg=''; $mesgs=array();
if (isset($_SESSION['dol_message'])) if (isset($_SESSION['dol_message']))
{ {
$mesg=$_SESSION['dol_message']; $mesgs[]=$_SESSION['dol_message'];
unset($_SESSION['dol_message']); unset($_SESSION['dol_message']);
} }