mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 04:54:34 -04:00
Clean up
This commit is contained in:
parent
cb7897b75e
commit
a8982cde44
@ -175,8 +175,6 @@ class CheckData extends Command
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkOauthSanity()
|
private function checkOauthSanity()
|
||||||
|
@ -291,11 +291,11 @@ class LoginController extends BaseController
|
|||||||
return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400);
|
return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cu->first()->account->companies->each(function ($company) use ($cu, $request) {
|
// $cu->first()->account->companies->each(function ($company) use ($cu, $request) {
|
||||||
if ($company->tokens()->where('is_system', true)->count() == 0) {
|
// if ($company->tokens()->where('is_system', true)->count() == 0) {
|
||||||
(new CreateCompanyToken($company, $cu->first()->user, $request->server('HTTP_USER_AGENT')))->handle();
|
// (new CreateCompanyToken($company, $cu->first()->user, $request->server('HTTP_USER_AGENT')))->handle();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
if ($request->has('current_company') && $request->input('current_company') == 'true') {
|
if ($request->has('current_company') && $request->input('current_company') == 'true') {
|
||||||
$cu->where('company_id', $company_token->company_id);
|
$cu->where('company_id', $company_token->company_id);
|
||||||
@ -480,13 +480,13 @@ class LoginController extends BaseController
|
|||||||
return $cu;
|
return $cu;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth()->user()->company_users()->count() != auth()->user()->tokens()->distinct('company_id')->count()) {
|
// if (auth()->user()->company_users()->count() != auth()->user()->tokens()->distinct('company_id')->count()) {
|
||||||
auth()->user()->companies->each(function ($company) {
|
// auth()->user()->companies->each(function ($company) {
|
||||||
if (!CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $company->id)->exists()) {
|
// if (!CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $company->id)->exists()) {
|
||||||
(new CreateCompanyToken($company, auth()->user(), 'Google_O_Auth'))->handle();
|
// (new CreateCompanyToken($company, auth()->user(), 'Google_O_Auth'))->handle();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
$truth->setCompanyToken(CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $set_company->id)->first());
|
$truth->setCompanyToken(CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $set_company->id)->first());
|
||||||
|
|
||||||
|
@ -633,7 +633,7 @@ class BaseController extends Controller
|
|||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
if ($user->getCompany()->is_large || $this->complexPermissionsUser()) {
|
if ($user->getCompany()->is_large) {
|
||||||
$this->manager->parseIncludes($this->mini_load);
|
$this->manager->parseIncludes($this->mini_load);
|
||||||
|
|
||||||
return $this->miniLoadResponse($query);
|
return $this->miniLoadResponse($query);
|
||||||
|
@ -115,6 +115,7 @@ class CreateAccount
|
|||||||
|
|
||||||
$spafe62e = isset($this->request['token_name']) ? $this->request['token_name'] : request()->server('HTTP_USER_AGENT');
|
$spafe62e = isset($this->request['token_name']) ? $this->request['token_name'] : request()->server('HTTP_USER_AGENT');
|
||||||
$sp2d97e8 = (new CreateCompanyToken($sp035a66, $spaa9f78, $spafe62e))->handle();
|
$sp2d97e8 = (new CreateCompanyToken($sp035a66, $spaa9f78, $spafe62e))->handle();
|
||||||
|
|
||||||
if ($spaa9f78) {
|
if ($spaa9f78) {
|
||||||
event(new AccountCreated($spaa9f78, $sp035a66, Ninja::eventVars()));
|
event(new AccountCreated($spaa9f78, $sp035a66, Ninja::eventVars()));
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class CompanySizeCheck implements ShouldQueue
|
|||||||
{
|
{
|
||||||
if (! config('ninja.db.multi_db_enabled')) {
|
if (! config('ninja.db.multi_db_enabled')) {
|
||||||
|
|
||||||
Company::where('is_large', false)->withCount(['invoices', 'clients', 'products'])->cursor()->each(function ($company) {
|
Company::where('is_large', false)->withCount(['invoices', 'clients', 'products', 'quotes'])->cursor()->each(function ($company) {
|
||||||
if ($company->invoices_count > 500 || $company->products_count > 500 || $company->clients_count > 500) {
|
if ($company->invoices_count > 500 || $company->products_count > 500 || $company->clients_count > 500) {
|
||||||
nlog("Marking company {$company->id} as large");
|
nlog("Marking company {$company->id} as large");
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ class CompanySizeCheck implements ShouldQueue
|
|||||||
|
|
||||||
nlog("Company size check db {$db}");
|
nlog("Company size check db {$db}");
|
||||||
|
|
||||||
Company::where('is_large', false)->withCount(['invoices', 'clients', 'products'])->cursor()->each(function ($company) {
|
Company::where('is_large', false)->withCount(['invoices', 'clients', 'products', 'quotes'])->cursor()->each(function ($company) {
|
||||||
if ($company->invoices_count > 500 || $company->products_count > 500 || $company->clients_count > 500) {
|
if ($company->invoices_count > 500 || $company->products_count > 500 || $company->clients_count > 500 || $company->quotes_count > 500) {
|
||||||
nlog("Marking company {$company->id} as large");
|
nlog("Marking company {$company->id} as large");
|
||||||
|
|
||||||
$company->account->companies()->update(['is_large' => true]);
|
$company->account->companies()->update(['is_large' => true]);
|
||||||
|
@ -79,7 +79,6 @@ class CreateUser
|
|||||||
'is_locked' => 0,
|
'is_locked' => 0,
|
||||||
'permissions' => '',
|
'permissions' => '',
|
||||||
'notifications' => CompanySettings::notificationDefaults(),
|
'notifications' => CompanySettings::notificationDefaults(),
|
||||||
//'settings' => DefaultSettings::userSettings(),
|
|
||||||
'settings' => null,
|
'settings' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ class TaskStatusRepository extends BaseRepository
|
|||||||
|
|
||||||
public function archive($task_status)
|
public function archive($task_status)
|
||||||
{
|
{
|
||||||
|
|
||||||
$task_status = TaskStatus::where('id', $task_status->id)
|
$task_status = TaskStatus::where('id', $task_status->id)
|
||||||
->where('company_id', $task_status->company_id)
|
->where('company_id', $task_status->company_id)
|
||||||
->first();
|
->first();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user