mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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\Ninja\TransactionLog;
|
||||||
use App\Jobs\Payment\EmailPayment;
|
use App\Jobs\Payment\EmailPayment;
|
||||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||||
|
use App\Models\Client;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\TransactionEvent;
|
use App\Models\TransactionEvent;
|
||||||
@ -99,10 +100,15 @@ class MarkPaid extends AbstractService
|
|||||||
$payment->ledger()
|
$payment->ledger()
|
||||||
->updatePaymentBalance($payment->amount * -1);
|
->updatePaymentBalance($payment->amount * -1);
|
||||||
|
|
||||||
$this->invoice->client->fresh();
|
\DB::connection(config('database.default'))->transaction(function () use($payment){
|
||||||
$this->invoice->client->paid_to_date += $payment->amount;
|
|
||||||
$this->invoice->client->balance += $payment->amount * -1;
|
/* Get the last record for the client and set the current balance*/
|
||||||
$this->invoice->client->push();
|
$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
|
$this->invoice = $this->invoice
|
||||||
->service()
|
->service()
|
||||||
|
@ -57,16 +57,21 @@ class MarkSent extends AbstractService
|
|||||||
->service()
|
->service()
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->setDueDate()
|
->setDueDate()
|
||||||
// ->deletePdf() //08-01-2022
|
->touchPdf()
|
||||||
->touchPdf() //08-01-2022
|
|
||||||
->setReminder()
|
->setReminder()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
/*Adjust client balance*/
|
/*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();
|
$this->invoice->markInvitationsSent();
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.3.81',
|
'app_version' => '5.3.82',
|
||||||
'app_tag' => '5.3.81',
|
'app_tag' => '5.3.82',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'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>
|
<script defer src="{{ $path }}?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
||||||
|
|
||||||
|
|
||||||
<center style="padding-top: 150px" id="loader">
|
<center style="padding-top: 150px" id="loader">
|
||||||
<div class="loader"></div>
|
<div class="loader"></div>
|
||||||
</center>
|
</center>
|
||||||
|
@ -1426,7 +1426,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
$this->assertEquals(10, $this->invoice->balance);
|
$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();
|
$this->invoice->service()->markPaid()->save();
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class CompanyLedgerTest extends TestCase
|
|||||||
|
|
||||||
$invoice_ledger = $invoice->company_ledger->sortByDesc('id')->first();
|
$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);
|
$this->assertEquals($invoice->client->paid_to_date, 0);
|
||||||
|
|
||||||
/* Test adding another invoice */
|
/* Test adding another invoice */
|
||||||
@ -203,10 +203,10 @@ class CompanyLedgerTest extends TestCase
|
|||||||
$invoice->service()->markSent()->save();
|
$invoice->service()->markSent()->save();
|
||||||
|
|
||||||
//client balance should = 20
|
//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();
|
$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);
|
$this->assertEquals($invoice->client->paid_to_date, 0);
|
||||||
|
|
||||||
/* Test making a payment */
|
/* Test making a payment */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user