diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index d37539a5ab99..fb53e5a953cd 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -483,7 +483,7 @@ trait MakesInvoiceValues $output = (int)$raw - (int)$_value[1]; // 1 (:MONTH) - 4 } - if ($_operation == '/') { + if ($_operation == '/' && (int)$_value[1] != 0) { $output = (int)$raw / (int)$_value[1]; // 1 (:MONTH) / 4 } diff --git a/tests/Feature/MultiPaymentDeleteTest.php b/tests/Feature/MultiPaymentDeleteTest.php index 071d565a5f4d..c41a54b28fbc 100644 --- a/tests/Feature/MultiPaymentDeleteTest.php +++ b/tests/Feature/MultiPaymentDeleteTest.php @@ -355,7 +355,7 @@ class MultiPaymentDeleteTest extends TestCase $this->assertEquals(0, $invoice->fresh()->balance); $this->assertEquals(0, $invoice->client->fresh()->balance); - $this->assertEquals(262, $invoice->client->fresh()->paid_to_date); + $this->assertEquals(0, $invoice->client->fresh()->paid_to_date); //Delete payment 4 which is for $162