Working on import

This commit is contained in:
Hillel Coren 2017-04-02 20:19:10 +03:00
parent ab67faf362
commit 5791e2bc9f
3 changed files with 8 additions and 7 deletions

View File

@ -37,7 +37,7 @@ class ImportController extends BaseController
$destinationPath = storage_path() . '/import'; $destinationPath = storage_path() . '/import';
$extension = $file->getClientOriginalExtension(); $extension = $file->getClientOriginalExtension();
if (! in_array($extension, ['csv', 'xls', 'json'])) { if (! in_array($extension, ['csv', 'xls', 'xlsx', 'json'])) {
continue; continue;
} }
@ -72,7 +72,7 @@ class ImportController extends BaseController
'include_settings' => $includeSettings, 'include_settings' => $includeSettings,
]; ];
$this->dispatch(new ImportData(Auth::user(), IMPORT_JSON, $settings)); $this->dispatch(new ImportData(Auth::user(), IMPORT_JSON, $settings));
$message = 'started...'; $message = trans('texts.import_started');
} }
} else { } else {
if (config('queue.default') === 'sync') { if (config('queue.default') === 'sync') {
@ -84,7 +84,7 @@ class ImportController extends BaseController
'source' => $source, 'source' => $source,
]; ];
$this->dispatch(new ImportData(Auth::user(), false, $settings)); $this->dispatch(new ImportData(Auth::user(), false, $settings));
$message = 'started...'; $message = trans('texts.import_started');
} }
} }
return redirect('/settings/' . ACCOUNT_IMPORT_EXPORT)->withWarning($message); return redirect('/settings/' . ACCOUNT_IMPORT_EXPORT)->withWarning($message);
@ -112,7 +112,7 @@ class ImportController extends BaseController
'headers' => $headers, 'headers' => $headers,
]; ];
$this->dispatch(new ImportData(Auth::user(), IMPORT_CSV, $settings)); $this->dispatch(new ImportData(Auth::user(), IMPORT_CSV, $settings));
$message = 'started...'; $message = trans('texts.import_started');
} }
return redirect('/settings/' . ACCOUNT_IMPORT_EXPORT)->withWarning($message); return redirect('/settings/' . ACCOUNT_IMPORT_EXPORT)->withWarning($message);

View File

@ -229,7 +229,7 @@ class ImportService
} }
} }
unlink($fileName); @unlink($fileName);
return $this->results; return $this->results;
} }
@ -321,7 +321,7 @@ class ImportService
} }
} }
unlink($fileName); @unlink($fileName);
return $results; return $results;
} }
@ -726,7 +726,7 @@ class ImportService
} }
} }
unlink($fileName); @unlink(storage_path() . '/import/' . $fileName);
return $results; return $results;
} }

View File

@ -2462,6 +2462,7 @@ $LANG = array(
'bcc_email_help' => 'Privately include this address with client emails.', 'bcc_email_help' => 'Privately include this address with client emails.',
'import_complete' => 'Your import has successfully completed.', 'import_complete' => 'Your import has successfully completed.',
'confirm_account_to_import' => 'Please confirm your account to import data.', 'confirm_account_to_import' => 'Please confirm your account to import data.',
'import_started' => 'Your import has started, we\'ll send you an email once it completes.',
); );