mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 11:04:37 -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();
|
$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();
|
$existing_company = Company::where('company_key', $request->company_key)->first();
|
||||||
|
|
||||||
if ($request->company_key !== $company->company_key) {
|
if ($request->company_key !== $company->company_key) {
|
||||||
info('Migration type: Fresh migration with new company. MigrationController::203');
|
info('Migration type: Fresh migration with new company. MigrationController::203');
|
||||||
|
|
||||||
/**
|
if ($existing_company && !$request->force) {
|
||||||
* This case is still unresolved.
|
info('Migration type: Migration with pre-existing company key, that doesn\t belong to user. No force option.');
|
||||||
*
|
|
||||||
* 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) {
|
Mail::to($user)->send(new ExistingMigration());
|
||||||
return;
|
|
||||||
|
return response()->json([
|
||||||
|
'_id' => Str::uuid(),
|
||||||
|
'method' => config('queue.default'),
|
||||||
|
'started_at' => now(),
|
||||||
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
$account = auth()->user()->account;
|
$account = auth()->user()->account;
|
||||||
//$account = (new ImportMigrations())->getAccount();
|
|
||||||
$company = (new ImportMigrations())->getCompany($account);
|
$company = (new ImportMigrations())->getCompany($account);
|
||||||
|
|
||||||
$company_token = new CompanyToken();
|
$company_token = new CompanyToken();
|
||||||
@ -227,7 +233,7 @@ class MigrationController extends BaseController
|
|||||||
|
|
||||||
$this->purgeCompany($company);
|
$this->purgeCompany($company);
|
||||||
|
|
||||||
$account = (new ImportMigrations())->getAccount();
|
$account = auth()->user()->account;
|
||||||
$company = (new ImportMigrations())->getCompany($account);
|
$company = (new ImportMigrations())->getCompany($account);
|
||||||
|
|
||||||
$company_token = new CompanyToken();
|
$company_token = new CompanyToken();
|
||||||
|
@ -51,8 +51,9 @@ class UpdateCompanyRequest extends Request
|
|||||||
$rules['portal_domain'] = 'nullable|alpha_num';
|
$rules['portal_domain'] = 'nullable|alpha_num';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->company->account->isPaidHostedClient())
|
// if($this->company->account->isPaidHostedClient()) {
|
||||||
return $settings;
|
// return $settings;
|
||||||
|
// }
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user