mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fixes for regression - incorrect type setting in ClientSettings
This commit is contained in:
parent
edbb42a114
commit
8a6eea8350
@ -1 +1 @@
|
||||
5.3.81
|
||||
5.3.82
|
@ -18,6 +18,7 @@ use App\Jobs\Invoice\InvoiceWorkflowSettings;
|
||||
use App\Jobs\Ninja\TransactionLog;
|
||||
use App\Jobs\Payment\EmailPayment;
|
||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\TransactionEvent;
|
||||
@ -99,10 +100,15 @@ class MarkPaid extends AbstractService
|
||||
$payment->ledger()
|
||||
->updatePaymentBalance($payment->amount * -1);
|
||||
|
||||
$this->invoice->client->fresh();
|
||||
$this->invoice->client->paid_to_date += $payment->amount;
|
||||
$this->invoice->client->balance += $payment->amount * -1;
|
||||
$this->invoice->client->push();
|
||||
\DB::connection(config('database.default'))->transaction(function () use($payment){
|
||||
|
||||
/* Get the last record for the client and set the current balance*/
|
||||
$client = Client::where('id', $this->invoice->client_id)->lockForUpdate()->first();
|
||||
$client->paid_to_date += $payment->amount;
|
||||
$client->balance += $payment->amount * -1;
|
||||
$client->save();
|
||||
|
||||
}, 1);
|
||||
|
||||
$this->invoice = $this->invoice
|
||||
->service()
|
||||
|
@ -57,16 +57,21 @@ class MarkSent extends AbstractService
|
||||
->service()
|
||||
->applyNumber()
|
||||
->setDueDate()
|
||||
// ->deletePdf() //08-01-2022
|
||||
->touchPdf() //08-01-2022
|
||||
->touchPdf()
|
||||
->setReminder()
|
||||
->save();
|
||||
|
||||
/*Adjust client balance*/
|
||||
$this->client->fresh();
|
||||
$this->client->balance += $adjustment;
|
||||
$this->client->save();
|
||||
|
||||
|
||||
\DB::connection(config('database.default'))->transaction(function () use($adjustment){
|
||||
|
||||
/* Get the last record for the client and set the current balance*/
|
||||
$client = Client::where('id', $this->client->id)->lockForUpdate()->first();
|
||||
$client->balance += $adjustment;
|
||||
$client->save();
|
||||
|
||||
}, 1);
|
||||
|
||||
$this->invoice->markInvitationsSent();
|
||||
|
||||
|
@ -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.3.81',
|
||||
'app_tag' => '5.3.81',
|
||||
'app_version' => '5.3.82',
|
||||
'app_tag' => '5.3.82',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', ''),
|
||||
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\ClientGroupSettingsSaver;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ClientSettingsParseForTypes extends Migration
|
||||
{
|
||||
use ClientGroupSettingsSaver;
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
|
||||
if(Ninja::isSelfHost())
|
||||
{
|
||||
|
||||
Client::cursor()->each( function ($client) {
|
||||
$entity_settings = $this->checkSettingType($client->settings);
|
||||
$entity_settings->md5 = md5(time());
|
||||
$client->settings = $entity_settings;
|
||||
$client->save();
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -152,7 +152,6 @@
|
||||
|
||||
<script defer src="{{ $path }}?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
||||
|
||||
|
||||
<center style="padding-top: 150px" id="loader">
|
||||
<div class="loader"></div>
|
||||
</center>
|
||||
|
@ -1426,7 +1426,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
|
||||
$this->assertEquals(10, $this->invoice->balance);
|
||||
$this->assertEquals(10, $this->invoice->client->balance);
|
||||
$this->assertEquals(10, $this->invoice->client->fresh()->balance);
|
||||
|
||||
$this->invoice->service()->markPaid()->save();
|
||||
|
||||
|
@ -187,7 +187,7 @@ class CompanyLedgerTest extends TestCase
|
||||
|
||||
$invoice_ledger = $invoice->company_ledger->sortByDesc('id')->first();
|
||||
|
||||
$this->assertEquals($invoice_ledger->balance, $invoice->client->balance);
|
||||
$this->assertEquals($invoice_ledger->balance, $this->client->balance);
|
||||
$this->assertEquals($invoice->client->paid_to_date, 0);
|
||||
|
||||
/* Test adding another invoice */
|
||||
@ -203,10 +203,10 @@ class CompanyLedgerTest extends TestCase
|
||||
$invoice->service()->markSent()->save();
|
||||
|
||||
//client balance should = 20
|
||||
$this->assertEquals($invoice->client->balance, 20);
|
||||
$this->assertEquals($this->client->fresh()->balance, 20);
|
||||
$invoice_ledger = $invoice->company_ledger->sortByDesc('id')->first();
|
||||
|
||||
$this->assertEquals($invoice_ledger->balance, $invoice->client->balance);
|
||||
$this->assertEquals($invoice_ledger->balance, $this->client->fresh()->balance);
|
||||
$this->assertEquals($invoice->client->paid_to_date, 0);
|
||||
|
||||
/* Test making a payment */
|
||||
|
Loading…
Reference in New Issue
Block a user