Fix protection in cleaning invoice with transaction. Delete also
extrafield lines.
This commit is contained in:
parent
7165389f6c
commit
a2b1d96d42
@ -267,9 +267,22 @@ if ($action == "delete") {
|
||||
|
||||
if ($result > 0 && $invoice->statut == Facture::STATUS_DRAFT)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
// We delete the lines
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='".$placeid."'";
|
||||
$resql = $db->query($sql);
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet_extrafields where fk_object = ".$placeid;
|
||||
$resql1 = $db->query($sql);
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture = ".$placeid;
|
||||
$resql2 = $db->query($sql);
|
||||
|
||||
if ($resql1 && $resql2)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
$invoice->fetch($placeid);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user