Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop

This commit is contained in:
David Bomba 2022-07-18 07:15:43 +10:00
commit 9b00f76a79
11 changed files with 17622 additions and 17601 deletions

View File

@ -105,9 +105,9 @@ class CheckData extends Command
config(['database.default' => $database]);
}
$this->checkInvoiceBalances();
$this->checkInvoiceBalances();
$this->checkClientBalanceEdgeCases();
$this->checkPaidToDatesNew();
$this->checkContacts();
$this->checkVendorContacts();
$this->checkEntityInvitations();
@ -655,6 +655,39 @@ class CheckData extends Command
$this->logMessage("{$this->wrong_paid_to_dates} clients with incorrect client balances");
}
private function checkClientBalanceEdgeCases()
{
Client::query()
->where('is_deleted',false)
->where('balance', '!=', 0)
->cursor()
->each(function ($client){
$count = Invoice::withTrashed()
->where('client_id', $client->id)
->where('is_deleted',false)
->whereIn('status_id', [2,3])
->count();
if($count == 0){
$this->logMessage("# {$client->id} # {$client->name} {$client->balance} is invalid should be 0");
if($this->option('client_balance')){
$this->logMessage("# {$client->id} " . $client->present()->name.' - '.$client->number." Fixing {$client->balance} to 0");
$client->balance = 0;
$client->save();
}
}
});
}
private function invoiceBalanceQuery()
{
$results = \DB::select( \DB::raw("

View File

@ -62,9 +62,6 @@ class UpdateInvoiceRequest extends Request
$rules['discount'] = 'sometimes|numeric';
$rules['project_id'] = ['bail', 'sometimes', new ValidProjectForClient($this->all())];
// if($this->input('status_id') != Invoice::STATUS_DRAFT)
// $rules['balance'] = new InvoiceBalanceSanity($this->invoice, $this->all());
return $rules;
}

View File

@ -498,8 +498,15 @@ class Account extends BaseModel
$plan_expires = Carbon::parse($this->plan_expires);
if(!$this->payment_id && $plan_expires->gt(now()))
return $plan_expires->diffInDays();
if(!$this->payment_id && $plan_expires->gt(now())){
$diff = $plan_expires->diffInDays();
if($diff > 14);
return 0;
return $diff;
}
return 0;
}

View File

@ -309,7 +309,6 @@ class BaseRepository
$model->client->service()->updateBalance(($state['finished_amount'] - $state['starting_amount']))->save();
$model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount']), "Update adjustment for invoice {$model->number}");
}
if (! $model->design_id)

View File

@ -5978,6 +5978,10 @@ google_sign_in_platform_interface
google_sign_in_web
image_picker_for_web
image_picker_platform_interface
in_app_purchase
in_app_purchase_android
in_app_purchase_platform_interface
in_app_purchase_storekit
local_auth
package_info
path_provider

View File

@ -25,7 +25,7 @@ const RESOURCES = {
"assets/assets/images/logo_dark.png": "a233ed1d4d0f7414bf97a9a10f11fb0a",
"assets/assets/images/icon.png": "090f69e23311a4b6d851b3880ae52541",
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "b62641afc9ab487008e996a5c5865e56",
"assets/NOTICES": "e998160e43be5ffa6f6f6e39b398e093",
"assets/NOTICES": "c6e3ca05e75eaf4b48a1de0f34708ab4",
"assets/AssetManifest.json": "38d9aea341601f3a5c6fa7b5a1216ea5",
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
"assets/fonts/MaterialIcons-Regular.otf": "95db9098c58fd6db106f1116bae85a0b",
@ -37,9 +37,9 @@ const RESOURCES = {
"canvaskit/canvaskit.js": "c2b4e5f3d7a3d82aed024e7249a78487",
"canvaskit/profiling/canvaskit.wasm": "95e736ab31147d1b2c7b25f11d4c32cd",
"canvaskit/profiling/canvaskit.js": "ae2949af4efc61d28a4a80fffa1db900",
"/": "9858e13abf0e4be39eba191b4caa480d",
"/": "f0472d186e41814a028b5ca7814378c4",
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
"main.dart.js": "694ca77c93f77b26c245820d8ef1e169"
"main.dart.js": "fe987ef50f1a627038a89c1f4f1dabb0"
};
// The application shell files that are downloaded before a service worker can

17254
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

17728
public/main.foss.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long