FIX #3490
This commit is contained in:
parent
db1d9d6d8e
commit
1966d75ced
@ -266,7 +266,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$result=$this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -274,10 +274,14 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
else if ($reshook < 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user);
|
$result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -307,7 +311,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -364,7 +364,7 @@ if (empty($reshook))
|
|||||||
if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement();
|
if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement();
|
||||||
|
|
||||||
// If creation from another object of another module
|
// If creation from another object of another module
|
||||||
if ($_POST['origin'] && $_POST['originid'])
|
if (! $error && $_POST['origin'] && $_POST['originid'])
|
||||||
{
|
{
|
||||||
// Parse element/subelement (ex: project_task)
|
// Parse element/subelement (ex: project_task)
|
||||||
$element = $subelement = $_POST['origin'];
|
$element = $subelement = $_POST['origin'];
|
||||||
@ -468,8 +468,7 @@ if (empty($reshook))
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If some invoice's lines already known
|
else if (! $error)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id < 0)
|
if ($id < 0)
|
||||||
@ -479,6 +478,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
// If some invoice's lines already known
|
||||||
for ($i = 1 ; $i < 9 ; $i++)
|
for ($i = 1 ; $i < 9 ; $i++)
|
||||||
{
|
{
|
||||||
$label = $_POST['label'.$i];
|
$label = $_POST['label'.$i];
|
||||||
@ -513,7 +513,8 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
setEventMessage($langs->trans($object->error), 'errors');
|
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action='create';
|
$action='create';
|
||||||
$_GET['socid']=$_POST['socid'];
|
$_GET['socid']=$_POST['socid'];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user