mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for credit imports
This commit is contained in:
parent
d40de524f4
commit
348b925947
@ -1173,11 +1173,26 @@ class Import implements ShouldQueue
|
|||||||
|
|
||||||
unset($modified['id']);
|
unset($modified['id']);
|
||||||
|
|
||||||
|
|
||||||
$credit = $credit_repository->save(
|
$credit = $credit_repository->save(
|
||||||
$modified,
|
$modified,
|
||||||
CreditFactory::create($this->company->id, $modified['user_id'])
|
CreditFactory::create($this->company->id, $modified['user_id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if($credit->status_id == 4)
|
||||||
|
{
|
||||||
|
|
||||||
|
$client = $credit->client;
|
||||||
|
$client->balance -= $credit->balance;
|
||||||
|
$client->credit_balance -= $credit->amount;
|
||||||
|
$client->saveQuietly();
|
||||||
|
|
||||||
|
$credit->paid_to_date = $credit->amount;
|
||||||
|
$credit->balance = 0;
|
||||||
|
$credit->saveQuietly();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//remove credit balance from ledger
|
//remove credit balance from ledger
|
||||||
if ($credit->balance > 0 && $credit->client->balance > 0) {
|
if ($credit->balance > 0 && $credit->client->balance > 0) {
|
||||||
$client = $credit->client;
|
$client = $credit->client;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user