Fixes for edge cases when applying :MONTH in invoice pdfs

This commit is contained in:
David Bomba 2021-09-06 11:48:08 +10:00
parent b06d761c8e
commit d575fac950
2 changed files with 2 additions and 2 deletions

View File

@ -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
}

View File

@ -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