mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Allow draft credits to be used in payments
This commit is contained in:
parent
912d0aebc5
commit
17b1119466
@ -46,10 +46,9 @@ class ValidCreditsPresentRule implements Rule
|
||||
|
||||
if (request()->input('credits') && is_array(request()->input('credits'))) {
|
||||
$credit_collection = Credit::whereIn('id', $this->transformKeys(array_column(request()->input('credits'), 'credit_id')))
|
||||
->where('balance', '>', 0)
|
||||
->get();
|
||||
->count();
|
||||
|
||||
return $credit_collection->count() == count(request()->input('credits'));
|
||||
return $credit_collection == count(request()->input('credits'));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -156,6 +156,7 @@ class PaymentRepository extends BaseRepository {
|
||||
$credit = Credit::withTrashed()->find($this->decodePrimaryKey($paid_credit['credit_id']));
|
||||
|
||||
if ($credit) {
|
||||
$credit = $credit->service()->markSent()->save();
|
||||
ApplyCreditPayment::dispatchNow($credit, $payment, $paid_credit['amount'], $credit->company);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user