mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 13:54:34 -04:00
Patches for refund validation
This commit is contained in:
parent
98bad77942
commit
15f89fdf33
@ -57,9 +57,10 @@ class ValidRefundableRequest implements Rule
|
||||
$request_invoices = request()->has('invoices') ? $this->input['invoices'] : [];
|
||||
|
||||
if ($payment->invoices()->exists()) {
|
||||
foreach ($payment->invoices as $paymentable_invoice) {
|
||||
$this->checkInvoice($paymentable_invoice, $request_invoices);
|
||||
}
|
||||
$this->checkInvoice($payment->invoices, $request_invoices);
|
||||
// foreach ($payment->invoices as $paymentable_invoice) {
|
||||
// $this->checkInvoice($paymentable_invoice, $request_invoices);
|
||||
// }
|
||||
}
|
||||
|
||||
foreach ($request_invoices as $request_invoice) {
|
||||
@ -119,11 +120,13 @@ class ValidRefundableRequest implements Rule
|
||||
// }
|
||||
// }
|
||||
|
||||
private function checkInvoice($paymentable, $request_invoices)
|
||||
private function checkInvoice($paymentables, $request_invoices)
|
||||
{
|
||||
$record_found = false;
|
||||
|
||||
foreach($paymentables as $paymentable) {
|
||||
foreach ($request_invoices as $request_invoice) {
|
||||
|
||||
if ($request_invoice['invoice_id'] == $paymentable->pivot->paymentable_id) {
|
||||
$record_found = true;
|
||||
|
||||
@ -138,6 +141,7 @@ class ValidRefundableRequest implements Rule
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $record_found) {
|
||||
$this->error_msg = ctrans('texts.refund_without_invoices');
|
||||
|
Loading…
x
Reference in New Issue
Block a user