1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Catch division by zero errors

This commit is contained in:
David Bomba 2023-11-01 15:01:52 +11:00
parent 4842223170
commit 62bdc708c1

View File

@ -399,7 +399,12 @@ class InvoiceItemSum
$item_tax = 0;
$amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total));
try {
$amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total));
} catch(\DivisionByZeroError $e) {
$amount = $this->item->line_total;
}
//$amount = ($this->sub_total > 0) ? $this->item->line_total - ($this->invoice->discount * ($this->item->line_total / $this->sub_total)) : 0;
$item_tax_rate1_total = $this->calcAmountLineTax($this->item->tax_rate1, $amount);