Merge pull request #5687 from turbo124/master

Fixes for migration
This commit is contained in:
David Bomba 2021-05-12 17:28:51 +10:00 committed by GitHub
commit 897c134ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 11 deletions

View File

@ -176,12 +176,15 @@ class StepsController extends BaseController
); );
} }
try {
$migrationData = $this->generateMigrationData($request->all()); $migrationData = $this->generateMigrationData($request->all());
$completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN'))) $completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')))
->data($migrationData) ->data($migrationData)
->endpoint(session('MIGRATION_ENDPOINT')) ->endpoint(session('MIGRATION_ENDPOINT'))
->start(); ->start();
}
finally {
if ($completeService->isSuccessful()) { if ($completeService->isSuccessful()) {
return view('migration.completed'); return view('migration.completed');
@ -189,6 +192,7 @@ class StepsController extends BaseController
return view('migration.completed', ['customMessage' => $completeService->getErrors()[0]]); return view('migration.completed', ['customMessage' => $completeService->getErrors()[0]]);
} }
}
public function completed() public function completed()
{ {
@ -223,6 +227,8 @@ class StepsController extends BaseController
*/ */
public function generateMigrationData(array $data): array public function generateMigrationData(array $data): array
{ {
set_time_limit(0);
$migrationData = []; $migrationData = [];
foreach ($data['companies'] as $company) { foreach ($data['companies'] as $company) {

View File

@ -538,7 +538,13 @@ info("get company");
elseif($design_id == 1) elseif($design_id == 1)
return 2; return 2;
elseif($design_id == 2) elseif($design_id == 2)
return 3;
elseif($design_id == 3)
return 4;
elseif($design_id == 4)
return 1; return 1;
elseif($design_id == 10)
return 2;
return $design_id; return $design_id;
} }
@ -1298,6 +1304,8 @@ info("translated gateway_type = {$translated_gateway_type}");
} }
catch(\Exception $e){ catch(\Exception $e){
info($config);
} }
// foreach ($gateway_types as $gateway_type_id) { // foreach ($gateway_types as $gateway_type_id) {

View File

@ -4284,7 +4284,11 @@ $LANG = array(
'migration_create_account_notice' => 'Please ensure you have created an account on the new platform first <a href="https://invoicing.co">here</a> , please ensure that the credentials are <b>identical</b> to your v4 credentials. Once the account has been created, you can start the migration process here.', 'migration_create_account_notice' => 'Please ensure you have created an account on the new platform first <a href="https://invoicing.co">here</a> , please ensure that the credentials are <b>identical</b> to your v4 credentials. Once the account has been created, you can start the migration process here.',
'auth' => 'Authentication', 'auth' => 'Authentication',
'companies' => 'Select companies for migration', 'companies' => 'Select companies for migration',
'activity_100' => ':user created recurring invoice :recurring_invoice',
'activity_101' => ':user updated recurring invoice :recurring_invoice',
'activity_102' => ':user archived recurring invoice :recurring_invoice',
'activity_103' => ':user deleted recurring invoice :recurring_invoice',
'activity_104' => ':user restored recurring invoice :recurring_invoice',
); );