mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Migration improvements (#3661)
* Fix migration & add new case * Update logging statement
This commit is contained in:
parent
d516b1b097
commit
9c5e087b87
@ -182,25 +182,31 @@ class MigrationController extends BaseController
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if (app()->environment() === 'local') {
|
||||
info([
|
||||
'Company key' => $company->company_key,
|
||||
'Request key' => $request->company_key,
|
||||
]);
|
||||
}
|
||||
|
||||
$existing_company = Company::where('company_key', $request->company_key)->first();
|
||||
|
||||
if ($request->company_key !== $company->company_key) {
|
||||
info('Migration type: Fresh migration with new company. MigrationController::203');
|
||||
|
||||
/**
|
||||
* This case is still unresolved.
|
||||
*
|
||||
* Following block will happen in case $request->company_key and $company.company_key
|
||||
* are different in which case the migration might fail due duplicated company_key
|
||||
* record.
|
||||
*/
|
||||
if ($existing_company && !$request->force) {
|
||||
info('Migration type: Migration with pre-existing company key, that doesn\t belong to user. No force option.');
|
||||
|
||||
if ($existing_company) {
|
||||
return;
|
||||
Mail::to($user)->send(new ExistingMigration());
|
||||
|
||||
return response()->json([
|
||||
'_id' => Str::uuid(),
|
||||
'method' => config('queue.default'),
|
||||
'started_at' => now(),
|
||||
], 200);
|
||||
}
|
||||
|
||||
$account = auth()->user()->account;
|
||||
//$account = (new ImportMigrations())->getAccount();
|
||||
$company = (new ImportMigrations())->getCompany($account);
|
||||
|
||||
$company_token = new CompanyToken();
|
||||
@ -227,7 +233,7 @@ class MigrationController extends BaseController
|
||||
|
||||
$this->purgeCompany($company);
|
||||
|
||||
$account = (new ImportMigrations())->getAccount();
|
||||
$account = auth()->user()->account;
|
||||
$company = (new ImportMigrations())->getCompany($account);
|
||||
|
||||
$company_token = new CompanyToken();
|
||||
|
@ -51,8 +51,9 @@ class UpdateCompanyRequest extends Request
|
||||
$rules['portal_domain'] = 'nullable|alpha_num';
|
||||
}
|
||||
|
||||
if($this->company->account->isPaidHostedClient())
|
||||
return $settings;
|
||||
// if($this->company->account->isPaidHostedClient()) {
|
||||
// return $settings;
|
||||
// }
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user