mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
Working on check data script
This commit is contained in:
parent
3d59717776
commit
8ddc14c4d0
@ -73,9 +73,9 @@ class PaymentAmountsBalanceRule implements Rule
|
||||
return true;
|
||||
} // if no invoices are present, then this is an unapplied payment, let this pass validation!
|
||||
|
||||
info("payment amounts = {$payment_amounts}");
|
||||
info("invoice amounts = {$invoice_amounts}");
|
||||
//return true;
|
||||
// info("payment amounts = {$payment_amounts}");
|
||||
// info("invoice amounts = {$invoice_amounts}");
|
||||
|
||||
return $payment_amounts >= $invoice_amounts;
|
||||
}
|
||||
}
|
||||
|
@ -79,8 +79,6 @@ class PaymentRepository extends BaseRepository
|
||||
$is_existing_payment = false;
|
||||
$client = Client::find($data['client_id']);
|
||||
|
||||
info("client paid to date {$client->paid_to_date}");
|
||||
|
||||
/*We only update the paid to date ONCE per payment*/
|
||||
if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) {
|
||||
if ($data['amount'] == '') {
|
||||
@ -89,23 +87,16 @@ info("client paid to date {$client->paid_to_date}");
|
||||
|
||||
$client->service()->updatePaidToDate($data['amount'])->save();
|
||||
|
||||
info("client paid to date {$client->paid_to_date}");
|
||||
}
|
||||
|
||||
if (array_key_exists('credits', $data) && is_array($data['credits']) && count($data['credits']) > 0) {
|
||||
|
||||
|
||||
$_credit_totals = array_sum(array_column($data['credits'], 'amount'));
|
||||
|
||||
$data['amount'] -= $_credit_totals;
|
||||
|
||||
info("credit totals = {$_credit_totals}");
|
||||
|
||||
$client->service()->updatePaidToDate($_credit_totals)->save();
|
||||
|
||||
|
||||
info("client paid to date {$client->paid_to_date}");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user