diff --git a/app/Services/Migration/CompanyService.php b/app/Services/Migration/CompanyService.php index ff3a3d635fd6..1709a3342c83 100644 --- a/app/Services/Migration/CompanyService.php +++ b/app/Services/Migration/CompanyService.php @@ -14,16 +14,24 @@ class CompanyService public function start() { try { - foreach (session(SESSION_USER_ACCOUNTS) as $company) { - $account = Account::find($company->account_id); + if (session(SESSION_USER_ACCOUNTS)) { + foreach (session(SESSION_USER_ACCOUNTS) as $company) { + $account = Account::find($company->account_id); - if ($account) { - $this->companies[] = [ - 'id' => $company->account_id, - 'name' => $account->name, - 'company_key' => $account->account_key, - ]; + if ($account) { + $this->companies[] = [ + 'id' => $account->id, + 'name' => $account->present()->name(), + 'company_key' => $account->account_key, + ]; + } } + } else { + $this->companies[] = [ + 'id' => auth()->user()->account->id, + 'name' => auth()->user()->account->present()->name(), + 'company_key' => auth()->user()->account->account_key, + ]; } $this->isSuccessful = true; diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 8625beb08eca..3ddc2e308def 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -3273,8 +3273,9 @@ $LANG = array( 'migrate_intro_text' => 'We\'ve been working on next version of Invoice Ninja. Click the button below to start the migration.', 'start_migration' => 'Start Migration', 'auth' => 'Auth', - 'endpoint' => 'Endpont', + 'endpoint' => 'Endpoint', 'migration' => 'Migration', + 'companies' => 'Companies', 'welcome_to_the_new_version' => 'Welcome to the new version of Invoice Ninja', 'download_data' => 'Press button below to download the data.', 'migration_import' => 'Awesome! Now you are ready to import your migration. Go to your new installation to import your data',