From bde276ad674c3dabab3b28237765ba0f170c9c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 3 Mar 2020 23:44:30 +0100 Subject: [PATCH] (V1) Improve migration (#3415) * Imports improvements: - Fix sorting - Fix duplicate imports (Cannot use App\Http\Controllers\BaseController as BaseController because the name is already in use) * Wrap up, sending migration file: - Removed 'enable_invoice_quantity' --- .../Controllers/Migration/StepsController.php | 31 ++++--------------- resources/views/migration/completed.blade.php | 2 +- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/app/Http/Controllers/Migration/StepsController.php b/app/Http/Controllers/Migration/StepsController.php index 6a1d08756e..3e9e1459a2 100644 --- a/app/Http/Controllers/Migration/StepsController.php +++ b/app/Http/Controllers/Migration/StepsController.php @@ -3,6 +3,10 @@ namespace App\Http\Controllers\Migration; use App\Http\Controllers\BaseController; +use App\Http\Requests\MigrationAuthRequest; +use App\Http\Requests\MigrationCompaniesRequest; +use App\Http\Requests\MigrationEndpointRequest; +use App\Http\Requests\MigrationTypeRequest; use App\Libraries\Utils; use App\Models\AccountGateway; use App\Models\AccountGatewaySettings; @@ -16,17 +20,10 @@ use App\Models\PaymentMethod; use App\Models\Product; use App\Models\TaxRate; use App\Models\User; -use Illuminate\Support\Facades\Auth; - -use App\Http\Controllers\BaseController; -use App\Http\Requests\MigrationAuthRequest; -use App\Http\Requests\MigrationCompaniesRequest; -use App\Http\Requests\MigrationEndpointRequest; -use App\Http\Requests\MigrationTypeRequest; -use App\Models\Document; use App\Services\Migration\AuthService; use App\Services\Migration\CompanyService; use App\Services\Migration\CompleteService; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Crypt; class StepsController extends BaseController @@ -147,30 +144,15 @@ class StepsController extends BaseController if($this->shouldGoBack('companies')) return redirect($this->access['companies']['redirect']); - $successful = false; - foreach ($request->companies as $company) { $completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN'))) ->file($this->getMigrationFile()) ->company($company) ->endpoint(session('MIGRATION_ENDPOINT')) ->start(); - - if($completeService->isSuccessful()) { - $successful = true; - } - - $successful = false; } - if($successful) { - return view('migration.completed'); - } - - return response([ - 'message' => 'Failed', - 'errors' => $completeService->getErrors(), - ]); + return view('migration.completed'); } public function completed() @@ -263,7 +245,6 @@ class StepsController extends BaseController 'show_product_details' => $this->account->show_product_notes, 'custom_surcharge_taxes1' => $this->account->custom_invoice_taxes1, 'custom_surcharge_taxes2' => $this->account->custom_invoice_taxes2, - 'enable_invoice_quantity' => !$this->account->hide_quantity, 'subdomain' => $this->account->subdomain, 'size_id' => $this->account->size_id, 'enable_modules' => $this->account->enabled_modules, diff --git a/resources/views/migration/completed.blade.php b/resources/views/migration/completed.blade.php index 849525683a..2a0da3471b 100644 --- a/resources/views/migration/completed.blade.php +++ b/resources/views/migration/completed.blade.php @@ -9,7 +9,7 @@

{!! trans('texts.welcome_to_the_new_version') !!}

- Completed, thanks! + Migration has started. We'll update you with status, on your company e-mail.