From ea360cead4c3bddf7cfadad0c4006b0e29d5966e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 21 Dec 2020 12:52:33 +1100 Subject: [PATCH] Import notifications --- app/Jobs/Import/CSVImport.php | 3 +- app/Jobs/Mail/BaseMailerJob.php | 5 ++- app/Mail/Import/ImportCompleted.php | 2 +- resources/views/email/import/completed.blade | 41 -------------------- 4 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 resources/views/email/import/completed.blade diff --git a/app/Jobs/Import/CSVImport.php b/app/Jobs/Import/CSVImport.php index 691fbd0d5b37..756d02e51784 100644 --- a/app/Jobs/Import/CSVImport.php +++ b/app/Jobs/Import/CSVImport.php @@ -102,11 +102,12 @@ class CSVImport implements ShouldQueue $this->{"import".ucfirst($this->entity_type)}(); $data = [ - 'entity' => $this->entity_type, + 'entity' => ucfirst($this->entity_type), 'errors' => $this->error_array, 'clients' => $this->maps['clients'], 'products' => $this->maps['products'], 'invoices' => $this->maps['invoices'], + 'settings' => $this->company->settings ]; MailRouter::dispatch(new ImportCompleted($data), $this->company, auth()->user()); diff --git a/app/Jobs/Mail/BaseMailerJob.php b/app/Jobs/Mail/BaseMailerJob.php index d0649ba73fc7..c337e939ce90 100644 --- a/app/Jobs/Mail/BaseMailerJob.php +++ b/app/Jobs/Mail/BaseMailerJob.php @@ -97,8 +97,9 @@ class BaseMailerJob implements ShouldQueue public function failed($exception = null) { - // info('the job failed'); - + info('the job failed'); + info($exception->getMessage()); + $job_failure = new EmailFailure(); $job_failure->string_metric5 = get_parent_class($this); $job_failure->string_metric6 = $exception->getMessage(); diff --git a/app/Mail/Import/ImportCompleted.php b/app/Mail/Import/ImportCompleted.php index ffe431926f11..85178fb0647d 100644 --- a/app/Mail/Import/ImportCompleted.php +++ b/app/Mail/Import/ImportCompleted.php @@ -30,6 +30,6 @@ class ImportCompleted extends Mailable public function build() { return $this->from(config('mail.from.address'), config('mail.from.name')) - ->view('email.import.completed', compact($this->data)); + ->view('email.import.completed', $this->data); } } diff --git a/resources/views/email/import/completed.blade b/resources/views/email/import/completed.blade deleted file mode 100644 index abc340a3dc99..000000000000 --- a/resources/views/email/import/completed.blade +++ /dev/null @@ -1,41 +0,0 @@ -@component('email.template.master', ['design' => 'light', 'settings' =>$settings]) - -@slot('header') - @component('email.components.header') - Migration already completed - @endcomponent -@endslot - -@slot('greeting') - Hello, -@endslot - -Here is the output of your recent import job. - -Entity Type: {{ $entity_type }} - -@if(count($errors['invoices']) >=1) - -@endif - -@component('email.components.button', ['url' => url('/')]) - Visit portal -@endcomponent - - -@slot('signature') -Thank you,
-Invoice Ninja -@endslot - -@slot('footer') - @component('email.components.footer', ['url' => 'https://invoiceninja.com', 'url_text' => '© InvoiceNinja']) - For any info, please visit InvoiceNinja. - @endcomponent -@endslot - -@endcomponent \ No newline at end of file