improved tenant identification

This commit is contained in:
Denis Duliçi
2021-04-16 00:59:43 +03:00
parent 9635e6be5d
commit 2b07442260
126 changed files with 1719 additions and 999 deletions

View File

@ -47,12 +47,8 @@ class BillReminder extends Command
$this->info('Sending bill reminders for ' . $company->name . ' company.');
// Set company id
session(['company_id' => $company->id]);
// Override settings and currencies
Overrider::load('settings');
Overrider::load('currencies');
// Set company
$company->makeCurrent();
// Don't send reminders if disabled
if (!setting('schedule.send_bill_reminder')) {
@ -70,9 +66,7 @@ class BillReminder extends Command
}
}
// Unset company_id
session()->forget('company_id');
setting()->forgetAll();
Company::forgetCurrent();
}
protected function remind($day)

View File

@ -47,8 +47,7 @@ class DownloadModule extends Command
$this->alias = $this->argument('alias');
$this->company = $this->argument('company');
session(['company_id' => $this->company]);
setting()->setExtraColumns(['company_id' => $this->company]);
company($this->company)->makeCurrent();
if (!$path = $this->download()) {
return self::CMD_ERROR;

View File

@ -57,8 +57,7 @@ class FinishUpdate extends Command
}
}
session(['company_id' => $company_id]);
setting()->setExtraColumns(['company_id' => $company_id]);
company($company_id)->makeCurrent();
// Disable model cache during update
config(['laravel-model-caching.enabled' => false]);

View File

@ -47,12 +47,8 @@ class InvoiceReminder extends Command
$this->info('Sending invoice reminders for ' . $company->name . ' company.');
// Set company id
session(['company_id' => $company->id]);
// Override settings and currencies
Overrider::load('settings');
Overrider::load('currencies');
// Set company
$company->makeCurrent();
// Don't send reminders if disabled
if (!setting('schedule.send_invoice_reminder')) {
@ -70,9 +66,7 @@ class InvoiceReminder extends Command
}
}
// Unset company_id
session()->forget('company_id');
setting()->forgetAll();
Company::forgetCurrent();
}
protected function remind($day)

View File

@ -7,10 +7,10 @@ use App\Events\Banking\TransactionRecurring;
use App\Events\Document\DocumentCreated;
use App\Events\Document\DocumentRecurring;
use App\Models\Banking\Transaction;
use App\Models\Common\Company;
use App\Models\Common\Recurring;
use App\Models\Document\Document;
use App\Utilities\Date;
use App\Utilities\Overrider;
use Illuminate\Console\Command;
class RecurringCheck extends Command
@ -83,12 +83,7 @@ class RecurringCheck extends Command
continue;
}
// Set company id
session(['company_id' => $recur->company_id]);
// Override settings and currencies
Overrider::load('settings');
Overrider::load('currencies');
company($recur->company_id)->makeCurrent();
$today = Date::today();
@ -121,9 +116,7 @@ class RecurringCheck extends Command
}
}
// Unset company_id
session()->forget('company_id');
setting()->forgetAll();
Company::forgetCurrent();
}
protected function recur($model, $type, $schedule_date)

View File

@ -68,8 +68,7 @@ class Update extends Command
$this->old = $this->getOldVersion();
session(['company_id' => $this->company]);
setting()->setExtraColumns(['company_id' => $this->company]);
company($this->company)->makeCurrent();
if (!$path = $this->download()) {
return self::CMD_ERROR;