Fix transaction
This commit is contained in:
parent
7b2f4771f0
commit
dde18e803d
@ -940,7 +940,6 @@ class Invoices extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
@ -958,8 +957,12 @@ class Invoices extends DolibarrApi
|
||||
|
||||
if (! $this->invoice->paye) // protection against multiple submit
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$this->invoice->fetch_lines();
|
||||
|
||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||
|
||||
// Loop on each vat rate
|
||||
$i=0;
|
||||
foreach($this->invoice->lines as $line)
|
||||
@ -1009,14 +1012,14 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Could not set paid');
|
||||
$this->db->rollback();
|
||||
$this->db->rollback();
|
||||
throw new RestException(500, 'Could not set paid');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Discount creation error');
|
||||
$this->db->rollback();
|
||||
$this->db->rollback();
|
||||
throw new RestException(500, 'Discount creation error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user