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:
parent
4842223170
commit
62bdc708c1
@ -399,7 +399,12 @@ class InvoiceItemSum
|
|||||||
|
|
||||||
$item_tax = 0;
|
$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;
|
//$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);
|
$item_tax_rate1_total = $this->calcAmountLineTax($this->item->tax_rate1, $amount);
|
||||||
|
Loading…
Reference in New Issue
Block a user