1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Email error if import fails

This commit is contained in:
Hillel Coren 2017-06-26 23:44:55 +03:00
parent 2542b1a640
commit 2fb227714a
3 changed files with 24 additions and 18 deletions

View File

@ -67,24 +67,30 @@ class ImportData extends Job implements ShouldQueue
$this->user->account->loadLocalizationSettings();
}
if ($this->type === IMPORT_JSON) {
$includeData = $this->settings['include_data'];
$includeSettings = $this->settings['include_settings'];
$files = $this->settings['files'];
$results = $importService->importJSON($files[IMPORT_JSON], $includeData, $includeSettings);
} elseif ($this->type === IMPORT_CSV) {
$map = $this->settings['map'];
$headers = $this->settings['headers'];
$timestamp = $this->settings['timestamp'];
$results = $importService->importCSV($map, $headers, $timestamp);
} else {
$source = $this->settings['source'];
$files = $this->settings['files'];
$results = $importService->importFiles($source, $files);
try {
if ($this->type === IMPORT_JSON) {
$includeData = $this->settings['include_data'];
$includeSettings = $this->settings['include_settings'];
$files = $this->settings['files'];
$results = $importService->importJSON($files[IMPORT_JSON], $includeData, $includeSettings);
} elseif ($this->type === IMPORT_CSV) {
$map = $this->settings['map'];
$headers = $this->settings['headers'];
$timestamp = $this->settings['timestamp'];
$results = $importService->importCSV($map, $headers, $timestamp);
} else {
$source = $this->settings['source'];
$files = $this->settings['files'];
$results = $importService->importFiles($source, $files);
}
$subject = trans('texts.import_complete');
$message = $importService->presentResults($results, $includeSettings);
} catch (Exception $exception) {
$subject = trans('texts.import_failed');
$message = $exception->getMessage();
}
$subject = trans('texts.import_complete');
$message = $importService->presentResults($results, $includeSettings);
$userMailer->sendMessage($this->user, $subject, $message);
if (App::runningInConsole()) {

View File

@ -43,7 +43,7 @@ class HandleUserLoggedIn
{
$account = Auth::user()->account;
if (empty($account->last_login)) {
if (! Utils::isNinja() && empty($account->last_login)) {
event(new UserSignedUp());
}

View File

@ -2289,7 +2289,7 @@ $LANG = array(
'deleted_recurring_expense' => 'Successfully deleted :count projects',
'view_recurring_expense' => 'View Recurring Expense',
'other' => 'Other',
'import_failed' => 'Import Failed',
);