Fixes for validation rule

This commit is contained in:
David Bomba 2021-07-23 10:16:59 +10:00
parent 62359e4097
commit 8ac7ec8ef4

View File

@ -80,7 +80,7 @@ class ValidRefundableRequest implements Rule
$invoice = Invoice::whereId($invoice['invoice_id'])->whereCompanyId($payment->company_id)->withTrashed()->first();
if ($payment->invoices()->exists()) {
$paymentable_invoice = $payment->invoices->where('invoice_id', $invoice->id)->first();
$paymentable_invoice = $payment->invoices->where('id', $invoice->id)->first();
if (! $paymentable_invoice) {
$this->error_msg = ctrans('texts.invoice_not_related_to_payment', ['invoice' => $invoice->hashed_id]);