mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Minor fixes
This commit is contained in:
parent
d3d4972242
commit
64c5e2a4e4
@ -703,13 +703,23 @@ class CheckData extends Command
|
||||
->count();
|
||||
|
||||
if($count == 0){
|
||||
$this->logMessage("# {$client->id} # {$client->name} {$client->balance} is invalid should be 0");
|
||||
|
||||
//factor in over payments to the client balance
|
||||
$over_payment = Payment::where('client_id', $client->id)
|
||||
->where('is_deleted', 0)
|
||||
->whereIn('status_id', [1,4])
|
||||
->selectRaw('sum(amount - applied) as p')
|
||||
->pluck('p')
|
||||
->first();
|
||||
|
||||
if($this->option('client_balance')){
|
||||
|
||||
$this->logMessage("# {$client->id} # {$client->name} {$client->balance} is invalid should be {$over_payment}");
|
||||
|
||||
if($this->option('client_balance') && (floatval($over_payment) != floatval($client->balance) )){
|
||||
|
||||
$this->logMessage("# {$client->id} " . $client->present()->name().' - '.$client->number." Fixing {$client->balance} to 0");
|
||||
|
||||
$client->balance = 0;
|
||||
$client->balance = $over_payment * -1;
|
||||
$client->save();
|
||||
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ class PaymentRepository extends BaseRepository {
|
||||
|
||||
$invoice_totals = array_sum(array_column($data['invoices'], 'amount'));
|
||||
|
||||
$invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->get();
|
||||
$invoices = Invoice::withTrashed()->whereIn('id', array_column($data['invoices'], 'invoice_id'))->get();
|
||||
|
||||
$payment->invoices()->saveMany($invoices);
|
||||
|
||||
|
@ -44,6 +44,10 @@ class TriggeredActions extends AbstractService
|
||||
$this->invoice = $this->invoice->service()->markPaid()->save();
|
||||
}
|
||||
|
||||
if ($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true') {
|
||||
$this->invoice = $this->invoice->service()->markSent()->save();
|
||||
}
|
||||
|
||||
if ($this->request->has('amount_paid') && is_numeric($this->request->input('amount_paid'))) {
|
||||
$this->invoice = $this->invoice->service()->applyPaymentAmount($this->request->input('amount_paid'))->save();
|
||||
}
|
||||
@ -53,10 +57,6 @@ class TriggeredActions extends AbstractService
|
||||
$this->sendEmail();
|
||||
}
|
||||
|
||||
if ($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true') {
|
||||
$this->invoice = $this->invoice->service()->markSent()->save();
|
||||
}
|
||||
|
||||
if ($this->request->has('cancel') && $this->request->input('cancel') == 'true') {
|
||||
$this->invoice = $this->invoice->service()->handleCancellation()->save();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user