diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index de6faf6e3b0..9e181e9ebed 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -512,7 +512,8 @@ if ($action == 'add' && $user->rights->facture->creer)
$object->socid=GETPOST('socid');
$db->begin();
-
+
+ $error=0;
// Replacement invoice
if ($_POST['type'] == 1)
@@ -520,13 +521,13 @@ if ($action == 'add' && $user->rights->facture->creer)
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
{
- $error=1;
+ $error++;
$mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
}
if (! ($_POST['fac_replacement'] > 0))
{
- $error=1;
+ $error++;
$mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'
';
}
@@ -562,14 +563,14 @@ if ($action == 'add' && $user->rights->facture->creer)
{
if (! $_POST['fac_avoir'] > 0)
{
- $error=1;
+ $error++;
$mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'
';
}
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
{
- $error=1;
+ $error++;
$mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
}
@@ -621,7 +622,7 @@ if ($action == 'add' && $user->rights->facture->creer)
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
{
- $error=1;
+ $error++;
$mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
}
@@ -650,7 +651,7 @@ if ($action == 'add' && $user->rights->facture->creer)
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
{
- $error=1;
+ $error++;
$mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
}
@@ -819,7 +820,7 @@ if ($action == 'add' && $user->rights->facture->creer)
else
{
$db->rollback();
- $_GET["action"]='create';
+ $action='create';
$_GET["origin"]=$_POST["origin"];
$_GET["originid"]=$_POST["originid"];
if (! $mesg) $mesg=''.$object->error.'
';
@@ -999,7 +1000,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact
if (empty($mesg)) $mesg=''.$object->error.'
';
}
- $_POST["action"]='';
+ $action='';
}
if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['save'] == $langs->trans('Save'))
@@ -1153,8 +1154,7 @@ if ($_POST['addfile'])
$mesg=dol_add_file_process($upload_dir,0,0);
- $_GET["action"]='presend';
- $_POST["action"]='presend';
+ $action='presend';
}
/*
@@ -1170,8 +1170,7 @@ if (! empty($_POST['removedfile']))
$mesg=dol_remove_file_process($_POST['removedfile'],0);
- $_GET["action"]='presend';
- $_POST["action"]='presend';
+ $action='presend';
}
/*