Additional checks when reversing

This commit is contained in:
David Bomba 2025-09-23 18:36:27 +10:00
parent 8c34d0cc5c
commit 2dd324c0bf
1 changed files with 4 additions and 0 deletions

View File

@ -66,6 +66,10 @@ class ValidInvoiceCreditRule implements Rule
$this->error_message = 'Cannot reverse an invoice that has already been reversed.';
return false;
}
else if($invoice->is_deleted) {
$this->error_message = 'Cannot reverse an invoice that has already been deleted.';
return false;
}
$existing_credit_amounts = $invoice->credits()->sum('amount');