mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 06:54:34 -04:00
minor fixes
This commit is contained in:
parent
9e7375a127
commit
00eb180afc
@ -106,8 +106,8 @@ class CheckData extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->checkInvoiceBalances();
|
$this->checkInvoiceBalances();
|
||||||
|
$this->checkClientBalanceEdgeCases();
|
||||||
$this->checkPaidToDatesNew();
|
$this->checkPaidToDatesNew();
|
||||||
|
|
||||||
$this->checkContacts();
|
$this->checkContacts();
|
||||||
$this->checkVendorContacts();
|
$this->checkVendorContacts();
|
||||||
$this->checkEntityInvitations();
|
$this->checkEntityInvitations();
|
||||||
@ -655,6 +655,39 @@ class CheckData extends Command
|
|||||||
$this->logMessage("{$this->wrong_paid_to_dates} clients with incorrect client balances");
|
$this->logMessage("{$this->wrong_paid_to_dates} clients with incorrect client balances");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function checkClientBalanceEdgeCases()
|
||||||
|
{
|
||||||
|
Client::query()
|
||||||
|
->where('is_deleted',false)
|
||||||
|
->where('balance', '!=', 0)
|
||||||
|
->cursor()
|
||||||
|
->each(function ($client){
|
||||||
|
|
||||||
|
$count = Invoice::withTrashed()
|
||||||
|
->where('client_id', $client->id)
|
||||||
|
->where('is_deleted',false)
|
||||||
|
->whereIn('status_id', [2,3])
|
||||||
|
->count();
|
||||||
|
|
||||||
|
if($count == 0){
|
||||||
|
$this->logMessage("# {$client->id} # {$client->name} {$client->balance} is invalid should be 0");
|
||||||
|
|
||||||
|
if($this->option('client_balance')){
|
||||||
|
|
||||||
|
$this->logMessage("# {$client->id} " . $client->present()->name.' - '.$client->number." Fixing {$client->balance} to 0");
|
||||||
|
|
||||||
|
$client->balance = 0;
|
||||||
|
$client->save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private function invoiceBalanceQuery()
|
private function invoiceBalanceQuery()
|
||||||
{
|
{
|
||||||
$results = \DB::select( \DB::raw("
|
$results = \DB::select( \DB::raw("
|
||||||
|
@ -62,9 +62,6 @@ class UpdateInvoiceRequest extends Request
|
|||||||
$rules['discount'] = 'sometimes|numeric';
|
$rules['discount'] = 'sometimes|numeric';
|
||||||
$rules['project_id'] = ['bail', 'sometimes', new ValidProjectForClient($this->all())];
|
$rules['project_id'] = ['bail', 'sometimes', new ValidProjectForClient($this->all())];
|
||||||
|
|
||||||
// if($this->input('status_id') != Invoice::STATUS_DRAFT)
|
|
||||||
// $rules['balance'] = new InvoiceBalanceSanity($this->invoice, $this->all());
|
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,6 @@ class BaseRepository
|
|||||||
$model->client->service()->updateBalance(($state['finished_amount'] - $state['starting_amount']))->save();
|
$model->client->service()->updateBalance(($state['finished_amount'] - $state['starting_amount']))->save();
|
||||||
$model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount']), "Update adjustment for invoice {$model->number}");
|
$model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount']), "Update adjustment for invoice {$model->number}");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $model->design_id)
|
if (! $model->design_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user