1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

- Show message if migration didn't start properly

- Update completed.blade.php with errors message
- Better status checking in CompleteService.php
This commit is contained in:
Benjamin Beganović 2021-03-30 10:49:29 +02:00
parent 3d69498c6e
commit 25dca51b5e
3 changed files with 12 additions and 13 deletions

View File

@ -175,7 +175,11 @@ class StepsController extends BaseController
->endpoint(session('MIGRATION_ENDPOINT'))
->start();
return view('migration.completed');
if ($completeService->isSuccessful()) {
return view('migration.completed');
}
return view('migration.completed', ['customMessage' => $completeService->getErrors()[0]]);
}
public function completed()
@ -250,7 +254,7 @@ class StepsController extends BaseController
'documents' => $this->getDocuments(),
];
$localMigrationData['force'] = array_key_exists('force', $company) ? true : false;
$localMigrationData['force'] = array_key_exists('force', $company);
$file = storage_path("migrations/{$fileName}.zip");

View File

@ -55,20 +55,16 @@ class CompleteService
$body = \Unirest\Request\Body::multipart(['companies' => json_encode($data)], $files);
try {
$response = Request::post($this->getUrl(), $this->getHeaders(), $body);
} catch (\Exception $e) {
info($e->getMessage());
}
$response = Request::post($this->getUrl(), $this->getHeaders(), $body);
if ($response->code == 200) {
if (in_array($response->code, [200])) {
$this->isSuccessful = true;
}
} else {
info($response->raw_body);
if (in_array($response->code, [401, 422, 500])) {
$this->isSuccessful = false;
$this->errors = [
'Oops, something went wrong. Migration can\'t be processed at the moment.',
'Oops, something went wrong. Migration can\'t be processed at the moment. Please checks the logs.',
];
}

View File

@ -9,8 +9,7 @@
<h3 class="panel-title">{!! trans('texts.welcome_to_the_new_version') !!}</h3>
</div>
<div class="panel-body">
Migration has started. We'll update you with status, on your company e-mail.
<!-- Note: This message needs edit, like next instructions, etc. -->
{{ $customMessage ?? 'Migration has started. We\'ll update you with status, on your company e-mail.' }}
</div>
</div>