mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 04:24:33 -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'] : [];
|
$request_invoices = request()->has('invoices') ? $this->input['invoices'] : [];
|
||||||
|
|
||||||
if ($payment->invoices()->exists()) {
|
if ($payment->invoices()->exists()) {
|
||||||
foreach ($payment->invoices as $paymentable_invoice) {
|
$this->checkInvoice($payment->invoices, $request_invoices);
|
||||||
$this->checkInvoice($paymentable_invoice, $request_invoices);
|
// foreach ($payment->invoices as $paymentable_invoice) {
|
||||||
}
|
// $this->checkInvoice($paymentable_invoice, $request_invoices);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($request_invoices as $request_invoice) {
|
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;
|
$record_found = false;
|
||||||
|
|
||||||
|
foreach($paymentables as $paymentable) {
|
||||||
foreach ($request_invoices as $request_invoice) {
|
foreach ($request_invoices as $request_invoice) {
|
||||||
|
|
||||||
if ($request_invoice['invoice_id'] == $paymentable->pivot->paymentable_id) {
|
if ($request_invoice['invoice_id'] == $paymentable->pivot->paymentable_id) {
|
||||||
$record_found = true;
|
$record_found = true;
|
||||||
|
|
||||||
@ -138,6 +141,7 @@ class ValidRefundableRequest implements Rule
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $record_found) {
|
if (! $record_found) {
|
||||||
$this->error_msg = ctrans('texts.refund_without_invoices');
|
$this->error_msg = ctrans('texts.refund_without_invoices');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user