mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 14:12:44 +01:00
Fixes for applying the correct amount to client balance
This commit is contained in:
parent
cf84f5b24d
commit
3345984b65
@ -1 +1 @@
|
||||
5.5.41
|
||||
5.5.42
|
@ -104,7 +104,6 @@ class DeletePayment
|
||||
|
||||
$client = $this->payment
|
||||
->client
|
||||
->fresh()
|
||||
->service()
|
||||
->updateBalance($net_deletable)
|
||||
->save();
|
||||
@ -136,9 +135,8 @@ class DeletePayment
|
||||
});
|
||||
}
|
||||
|
||||
$client = $this->payment->client->fresh();
|
||||
|
||||
$client
|
||||
$this->payment
|
||||
->client
|
||||
->service()
|
||||
->updatePaidToDate(($this->payment->amount - $this->payment->refunded) * -1)
|
||||
->save();
|
||||
@ -146,7 +144,7 @@ class DeletePayment
|
||||
$transaction = [
|
||||
'invoice' => [],
|
||||
'payment' => [],
|
||||
'client' => $client->transaction_event(),
|
||||
'client' => $this->payment->client->transaction_event(),
|
||||
'credit' => [],
|
||||
'metadata' => [],
|
||||
];
|
||||
|
@ -62,12 +62,14 @@ class UpdateInvoicePayment
|
||||
$paid_amount = $paid_invoice->amount;
|
||||
}
|
||||
|
||||
$client->service()->updateBalanceAndPaidToDate($paid_amount*-1, $paid_amount);
|
||||
$client->service()->updatePaidToDate($paid_amount); //always use the payment->amount
|
||||
|
||||
/* Need to determine here is we have an OVER payment - if YES only apply the max invoice amount */
|
||||
if($paid_amount > $invoice->partial && $paid_amount > $invoice->balance)
|
||||
$paid_amount = $invoice->balance;
|
||||
|
||||
$client->service()->updateBalance($paid_amount*-1); //only ever use the amount applied to the invoice
|
||||
|
||||
/*Improve performance here - 26-01-2022 - also change the order of events for invoice first*/
|
||||
//caution what if we amount paid was less than partial - we wipe it!
|
||||
$invoice->balance -= $paid_amount;
|
||||
|
@ -95,10 +95,14 @@ class SystemHealth
|
||||
|
||||
if(strlen(config('ninja.currency_converter_api_key')) == 0){
|
||||
|
||||
try{
|
||||
$cs = DB::table('clients')
|
||||
->select('settings->currency_id as id')
|
||||
->get();
|
||||
|
||||
}
|
||||
catch(\Exception $e){
|
||||
return true; //fresh installs, there may be no DB connection, nor migrations could have run yet.
|
||||
}
|
||||
|
||||
$currency_count = $cs->unique('id')->filter(function ($value){
|
||||
return !is_null($value->id);
|
||||
|
@ -14,8 +14,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => '5.5.41',
|
||||
'app_tag' => '5.5.41',
|
||||
'app_version' => '5.5.42',
|
||||
'app_tag' => '5.5.42',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', ''),
|
||||
|
Loading…
Reference in New Issue
Block a user