mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Prevent divide by zero with discounts
This commit is contained in:
parent
ac850dff35
commit
4204cbb06f
@ -510,7 +510,9 @@ class InvoiceRepository extends BaseRepository
|
|||||||
|
|
||||||
if ($invoice->discount > 0) {
|
if ($invoice->discount > 0) {
|
||||||
if ($invoice->is_amount_discount) {
|
if ($invoice->is_amount_discount) {
|
||||||
$lineTotal -= round(($lineTotal / $total) * $invoice->discount, 2);
|
if ($total != 0) {
|
||||||
|
$lineTotal -= round(($lineTotal / $total) * $invoice->discount, 2);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$lineTotal -= round($lineTotal * ($invoice->discount / 100), 2);
|
$lineTotal -= round($lineTotal * ($invoice->discount / 100), 2);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user