FIX #15374 : "New" doesn't clear total amounts

Invoice's total amounts where not updated because of direct lines deleting in database.
This commit is contained in:
teleassist 2020-11-30 11:22:49 +01:00 committed by GitHub
parent 4f762cf73d
commit 560194c3b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -411,17 +411,18 @@ if ($action == "delete") {
if ($result > 0 && $invoice->statut == Facture::STATUS_DRAFT)
{
$db->begin();
// We delete the lines
$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);
// We delete the lines
$resdeletelines = 1;
foreach($invoice->lines as $line){
$resdeletelines *= $invoice->deleteline($line->id);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]};
$sql .= " WHERE ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
$resql3 = $db->query($sql);
$resql1 = $db->query($sql);
if ($resql1 && $resql2 && $resql3)
if ($resdeletelines && $resql1)
{
$db->commit();
}
@ -429,8 +430,8 @@ if ($action == "delete") {
{
$db->rollback();
}
$invoice->fetch($placeid);
$invoice->fetch($placeid);
}
}
}