1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

On new company create - check is_large flag

This commit is contained in:
David Bomba 2022-03-14 18:20:14 +11:00
parent 2f4cc673d5
commit 3eeed5e135
2 changed files with 6 additions and 13 deletions

View File

@ -14,6 +14,7 @@ namespace App\Http\Controllers;
use App\DataMapper\Analytics\AccountDeleted;
use App\DataMapper\CompanySettings;
use App\DataMapper\DefaultSettings;
use App\Factory\CompanyFactory;
use App\Http\Requests\Company\CreateCompanyRequest;
use App\Http\Requests\Company\DefaultCompanyRequest;
use App\Http\Requests\Company\DestroyCompanyRequest;
@ -229,9 +230,13 @@ class CompanyController extends BaseController
'permissions' => '',
'settings' => null,
'notifications' => CompanySettings::notificationDefaults(),
//'settings' => DefaultSettings::userSettings(),
]);
if(auth()->user()->company()->account->companies()->where('is_large', 1)->exists())
{
$company->account->companies()->update(['is_large' => true]);
}
/*
* Required dependencies
*/
@ -417,7 +422,6 @@ class CompanyController extends BaseController
if ($request->hasFile('company_logo') || (is_array($request->input('settings')) && !array_key_exists('company_logo', $request->input('settings'))))
$this->removeLogo($company);
$company = $this->company_repo->save($request->all(), $company);
$company->saveSettings($request->input('settings'), $company);

View File

@ -69,16 +69,5 @@ class CompanySizeCheck implements ShouldQueue
});
// Company::where('is_large', false)->cursor()->each(function ($company) {
// if ($company->invoices()->count() > 500 || $company->products()->count() > 500 || $company->clients()->count() > 500) {
// nlog("Marking company {$company->id} as large");
// $company->account->companies->update(['is_large' => true])
// }
// });
}
}