diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index a521f766574..cae2461a780 100755
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -62,7 +62,7 @@ if ($action == 'create')
{
if (! is_array($selected))
{
- $mesg='
'.$langs->trans('Error_OrderNotChecked').'
';
+ $mesgs[]=''.$langs->trans('Error_OrderNotChecked').'
';
}
else
{
@@ -80,9 +80,9 @@ $htmlother = new FormOther($db);
/*
* 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.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/invoice.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 ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
+ if (! empty($conf->projet->enabled)) {
+ 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('products');
$langs->load('main');
@@ -117,7 +119,6 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
$_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']);
$projectid=isset($_GET['projectid'])?$_GET['projectid']:0;
$id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility
@@ -242,7 +243,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
}
else
{
- $mesg=$discount->error;
+ $mesgs[]=$discount->error;
$error++;
break;
}
@@ -310,7 +311,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
}
else
{
- $mesg=$srcobject->error;
+ $mesgs[]=$srcobject->error;
$error++;
}
$ii++;
@@ -318,7 +319,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
}
else
{
- $mesg=$object->error;
+ $mesgs[]=$object->error;
$error++;
}
}
@@ -338,7 +339,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
$action='create';
$_GET["origin"]=$_POST["origin"];
$_GET["originid"]=$_POST["originid"];
- if (! $mesg) $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
}
}
@@ -354,9 +355,10 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
if ($action == 'create')
{
$facturestatic=new Facture($db);
+
llxHeader();
print_fiche_titre($langs->trans('NewBill'));
- dol_htmloutput_mesg($mesg);
+
$soc = new Societe($db);
if ($socid) $res=$soc->fetch($socid);
if ($res)
@@ -474,7 +476,6 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
print "\n";
}
-
//Mode liste
else
{
@@ -669,8 +670,8 @@ else
}
-$db->close();
-dol_htmloutput_mesg($mesg);
-llxFooter();
+dol_htmloutput_mesg($mesg,$mesgs);
+llxFooter();
+$db->close();
?>
\ No newline at end of file
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 806af455da9..410c8f3bc29 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -54,11 +54,6 @@ $langs->load('main');
if (! empty($conf->margin->enabled))
$langs->load('margins');
-$mesg='';
-$errors=array();
-
-if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
-
$sall=trim(GETPOST('sall'));
$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"]))
{
- $mesg=''.$langs->trans("NoCloneOptionsSpecified").'
';
+ $mesgs[]=''.$langs->trans("NoCloneOptionsSpecified").'
';
}
else
{
@@ -130,7 +125,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
}
else
{
- $mesg=$object->error;
+ $mesgs[]=$object->error;
$action='';
}
}
@@ -152,7 +147,7 @@ else if ($action == 'reopen' && $user->rights->facture->creer)
}
else
{
- $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
}
}
}
@@ -170,7 +165,7 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
}
else
{
- $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
}
}
@@ -206,7 +201,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
}
else
{
- $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
$action='';
}
}
@@ -230,7 +225,7 @@ else if ($action == 'valid' && $user->rights->facture->creer)
// Si avoir, le signe doit etre negatif
if ($object->total_ht >= 0)
{
- $mesg=''.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'
';
+ $mesgs[]=''.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'
';
$action='';
}
}
@@ -239,7 +234,7 @@ else if ($action == 'valid' && $user->rights->facture->creer)
// Si non avoir, le signe doit etre positif
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0)
{
- $mesg=''.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'
';
+ $mesgs[]=''.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'
';
$action='';
}
}
@@ -306,7 +301,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
$result=$object->insert_discount($_POST["remise_id"]);
if ($result < 0)
{
- $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
}
}
else
@@ -323,7 +318,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
$result=$discount->link_to_invoice(0,$id);
if ($result < 0)
{
- $mesg=''.$discount->error.'
';
+ $mesgs[]=''.$discount->error.'
';
}
}
}
@@ -390,7 +385,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
}
else
{
- $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
}
}
}
@@ -486,7 +481,7 @@ else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->righ
}
else
{
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
';
}
}
// Classify "abandoned"
@@ -501,7 +496,7 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes')
}
else
{
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
';
}
}
@@ -560,18 +555,18 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
$result=$object->set_paid($user);
if ($result > 0)
{
- //$mesg='OK'.$discount->id;
+ //$mesgs[]='OK'.$discount->id;
$db->commit();
}
else
{
- $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
$db->rollback();
}
}
else
{
- $mesg=''.$discount->error.'
';
+ $mesgs[]=''.$discount->error.'
';
$db->rollback();
}
}
@@ -595,13 +590,13 @@ else if ($action == 'add' && $user->rights->facture->creer)
if (empty($datefacture))
{
$error++;
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
}
if (! ($_POST['fac_replacement'] > 0))
{
$error++;
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'
';
}
if (! $error)
@@ -627,7 +622,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->type = 1;
$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)
{
$error++;
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'
';
}
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
{
$error++;
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
}
if (! $error)
@@ -696,7 +691,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
if (empty($datefacture))
{
$error++;
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
}
if (! $error)
@@ -725,7 +720,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
if (empty($datefacture))
{
$error++;
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
}
if (! $error)
@@ -816,7 +811,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
}
else
{
- $mesg=$discount->error;
+ $mesgs[]=$discount->error;
$error++;
break;
}
@@ -895,13 +890,13 @@ else if ($action == 'add' && $user->rights->facture->creer)
}
else
{
- $mesg=$srcobject->error;
+ $mesgs[]=$srcobject->error;
$error++;
}
}
else
{
- $mesg=$object->error;
+ $mesgs[]=$object->error;
$error++;
}
}
@@ -938,7 +933,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$action='create';
$_GET["origin"]=$_POST["origin"];
$_GET["originid"]=$_POST["originid"];
- if (! $mesg) $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
}
}
@@ -950,27 +945,27 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
if ($_POST['np_price'] < 0 && $_POST["qty"] < 0)
{
$langs->load("errors");
- $mesg=''.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'
';
+ $mesgs[]=''.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'
';
$result = -1 ;
}
if (empty($_POST['idprod']) && $_POST["type"] < 0)
{
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
';
$result = -1 ;
}
if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not ''
{
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'
';
$result = -1 ;
}
if (empty($_POST['idprod']) && empty($_POST["np_desc"]) && empty($_POST["dp_desc"]))
{
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'
';
$result = -1 ;
}
if (! isset($_POST['qty']) || $_POST['qty']=='')
{
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'
';
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'
';
$result = -1 ;
}
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'];
else
$pa_ht = null;
-
+
$info_bits=0;
if ($tva_npr) $info_bits |= 0x01;
@@ -1155,7 +1150,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
}
else
{
- if (empty($mesg)) $mesg=''.$object->error.'
';
+ $mesgs[]=''.$object->error.'
';
}
$action='';
@@ -1194,7 +1189,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
// Check parameters
if (! GETPOST('productid') && GETPOST("type") < 0)
{
- $mesg = ''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
';
+ $mesgs[] = ''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
';
$result = -1 ;
}
// 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)))
{
//print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min;
- $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'
';
+ $mesgs[] = ''.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'
';
$result=-1;
}
@@ -1328,7 +1323,7 @@ if (GETPOST('addfile'))
$vardir=$conf->user->dir_output."/".$user->id;
$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';
}
@@ -1345,7 +1340,7 @@ if (! empty($_POST['removedfile']))
$upload_dir_tmp = $vardir.'/temp';
// 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';
}
@@ -1476,8 +1471,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
{
// Redirect here
// This avoid sending mail twice if going out and then back to page
- $_SESSION['message'] = $mesg;
- Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&mesg=1');
+ $_SESSION['dol_message'] = $mesg;
+ Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id);
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.='';
+ $mesgs[]=$mesg;
}
}
/* }
else
{
$langs->load("other");
- $mesg=''.$langs->trans('ErrorMailRecipientIsEmpty').'
';
+ $mesgs[]=''.$langs->trans('ErrorMailRecipientIsEmpty').'
';
dol_syslog('Recipient email is empty');
}*/
}
else
{
$langs->load("errors");
- $mesg=''.$langs->trans('ErrorCantReadFile',$file).'
';
+ $mesgs[]=''.$langs->trans('ErrorCantReadFile',$file).'
';
dol_syslog('Failed to read file: '.$file);
}
}
else
{
$langs->load("other");
- $mesg=''.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
';
+ $mesgs[]=''.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
';
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;
$file = $upload_dir . '/' . GETPOST('file');
dol_delete_file($file,0,0,0,$object);
- $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
+ $mesgs[] = ''.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
}
}
@@ -1597,11 +1593,11 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
- $mesg = ''.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
';
+ $mesgs[] = ''.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
';
}
else
{
- $mesg = ''.$object->error.'
';
+ $mesgs[] = ''.$object->error.'
';
}
}
}
@@ -1661,9 +1657,6 @@ if ($action == 'create')
print_fiche_titre($langs->trans('NewBill'));
- dol_htmloutput_mesg($mesg);
- dol_htmloutput_errors('',$errors);
-
$soc = new Societe($db);
if ($socid) $res=$soc->fetch($socid);
@@ -2109,8 +2102,6 @@ else if ($id > 0 || ! empty($ref))
/*
* Show object in view mode
*/
- dol_htmloutput_mesg($mesg);
- dol_htmloutput_errors('',$errors);
$result=$object->fetch($id,$ref);
if ($result > 0)
@@ -3332,7 +3323,8 @@ else if ($id > 0 || ! empty($ref))
}
}
+dol_htmloutput_mesg('',$mesgs);
llxFooter();
$db->close();
-?>
+?>
\ No newline at end of file
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 6c356015ab1..9a29f016914 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -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/invoice.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 ($conf->projet->enabled)
+if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
+if (! empty($conf->projet->enabled))
{
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
}
$langs->load('bills');
-//print 'ee'.$langs->trans('BillsCustomer');exit;
-
$langs->load('companies');
$langs->load('products');
$langs->load('main');
-if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
-
$sall=trim(GETPOST('sall'));
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 0f6378e880b..ed3320135fc 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -725,7 +725,7 @@ $bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
$mesg=''; $mesgs=array();
if (isset($_SESSION['dol_message']))
{
- $mesg=$_SESSION['dol_message'];
+ $mesgs[]=$_SESSION['dol_message'];
unset($_SESSION['dol_message']);
}