Fix: Error when duplicate ref
This commit is contained in:
parent
fef6419c75
commit
633a45e5a4
@ -43,7 +43,7 @@ $langs->load('bills');
|
|||||||
$langs->load('suppliers');
|
$langs->load('suppliers');
|
||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
|
|
||||||
$facid = isset($_GET["facid"])?$_GET["facid"]:(isset($_POST["facid"])?$_POST["facid"]:'');
|
$facid = GETPOST("facid");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
@ -51,7 +51,7 @@ $result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture
|
|||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
$mesg='';
|
$mesg='';
|
||||||
$action=isset($_GET['action'])?$_GET['action']:$_POST['action'];
|
$action=GETPOST(action);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -210,7 +210,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
|
|||||||
$_GET['socid']=$_POST['socid'];
|
$_GET['socid']=$_POST['socid'];
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($_POST['facnumber']))
|
if (! GETPOST('facnumber'))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'</div>';
|
||||||
$_GET['action']='create';
|
$_GET['action']='create';
|
||||||
@ -320,7 +320,13 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$facid = $facfou->create($user);
|
$facid = $facfou->create($user);
|
||||||
|
if ($facid < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
for ($i = 1 ; $i < 9 ; $i++)
|
for ($i = 1 ; $i < 9 ; $i++)
|
||||||
{
|
{
|
||||||
$label = $_POST['label'.$i];
|
$label = $_POST['label'.$i];
|
||||||
@ -349,11 +355,13 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
|
$langs->load("errors");
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
$mesg='<div class="error">'.$facfou->error.'</div>';
|
$mesg='<div class="error">'.$langs->trans($facfou->error).'</div>';
|
||||||
$_GET['action']='create';
|
$_GET['action']='create';
|
||||||
$_GET['socid']=$_POST['socid'];
|
$_GET['socid']=$_POST['socid'];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user