diff --git a/app/Console/Commands/PostUpdate.php b/app/Console/Commands/PostUpdate.php index 491a60c7fdec..3f0a91503987 100644 --- a/app/Console/Commands/PostUpdate.php +++ b/app/Console/Commands/PostUpdate.php @@ -12,6 +12,7 @@ namespace App\Console\Commands; use App\Jobs\Util\VersionCheck; +use App\Utils\Ninja; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; @@ -59,7 +60,12 @@ class PostUpdate extends Command info("finished running composer install "); try { - Artisan::call('optimize'); + + if(Ninja::isHosted()) + Artisan::call('optimize'); + else + Artisan::call('config:clear'); + } catch (\Exception $e) { info("I wasn't able to optimize."); } diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 903e350de92e..8325f4ff7d05 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -169,7 +169,8 @@ class SetupController extends Controller /* Run migrations */ if (!config('ninja.disable_auto_update')) { - Artisan::call('optimize'); + Artisan::call('config:clear'); + // Artisan::call('optimize'); } Artisan::call('migrate', ['--force' => true]); diff --git a/app/Jobs/Invoice/ZipInvoices.php b/app/Jobs/Invoice/ZipInvoices.php index 476307dca8ce..50ebcdd4d63c 100644 --- a/app/Jobs/Invoice/ZipInvoices.php +++ b/app/Jobs/Invoice/ZipInvoices.php @@ -111,7 +111,7 @@ class ZipInvoices implements ShouldQueue } catch(\PhpZip\Exception\ZipException $e){ - // handle exception + nlog("could not make zip => ". $e->getMessage()); } finally{ $zipFile->close(); diff --git a/app/Jobs/Util/UnlinkFile.php b/app/Jobs/Util/UnlinkFile.php index 3d0b4278ad11..9947a61880f0 100644 --- a/app/Jobs/Util/UnlinkFile.php +++ b/app/Jobs/Util/UnlinkFile.php @@ -39,6 +39,10 @@ class UnlinkFile implements ShouldQueue */ public function handle() { + /* Do not delete files if we are on the sync queue*/ + if(config('queue.default') == 'sync') + return; + Storage::disk($this->disk)->delete($this->file_path); } } diff --git a/app/Mail/DownloadBackup.php b/app/Mail/DownloadBackup.php index b70cb90b8dbe..d00e9a9aec5f 100644 --- a/app/Mail/DownloadBackup.php +++ b/app/Mail/DownloadBackup.php @@ -43,6 +43,9 @@ class DownloadBackup extends Mailable return $this->from(config('mail.from.address'), config('mail.from.name')) ->subject(ctrans('texts.download_backup_subject', ['company' => $company->present()->name()])) + ->text('email.admin.download_files_text',[ + 'url' => $this->file_path, + ]) ->view('email.admin.download_files', [ 'url' => $this->file_path, 'logo' => $company->present()->logo, diff --git a/app/Mail/DownloadCredits.php b/app/Mail/DownloadCredits.php index 85b8b1e9c727..3f9d7a6e6af5 100644 --- a/app/Mail/DownloadCredits.php +++ b/app/Mail/DownloadCredits.php @@ -42,6 +42,9 @@ class DownloadCredits extends Mailable return $this->from(config('mail.from.address'), config('mail.from.name')) ->subject(ctrans('texts.download_files')) + ->text('email.admin.download_credits_text', [ + 'url' => $this->file_path, + ]) ->view('email.admin.download_credits', [ 'url' => $this->file_path, 'logo' => $this->company->present()->logo, diff --git a/app/Mail/DownloadInvoices.php b/app/Mail/DownloadInvoices.php index 51846f667c82..34b0d6d14766 100644 --- a/app/Mail/DownloadInvoices.php +++ b/app/Mail/DownloadInvoices.php @@ -42,6 +42,9 @@ class DownloadInvoices extends Mailable return $this->from(config('mail.from.address'), config('mail.from.name')) ->subject(ctrans('texts.download_files')) + ->text('email.admin.download_invoices_text', [ + 'url' => $this->file_path, + ]) ->view('email.admin.download_invoices', [ 'url' => $this->file_path, 'logo' => $this->company->present()->logo, diff --git a/app/Mail/DownloadQuotes.php b/app/Mail/DownloadQuotes.php index 687d10fc143a..62ba83a3c927 100644 --- a/app/Mail/DownloadQuotes.php +++ b/app/Mail/DownloadQuotes.php @@ -42,6 +42,9 @@ class DownloadQuotes extends Mailable return $this->from(config('mail.from.address'), config('mail.from.name')) ->subject(ctrans('texts.download_files')) + ->text('email.admin.download_quotes_text', [ + 'url' => $this->file_path, + ]) ->view('email.admin.download_quotes', [ 'url' => $this->file_path, 'logo' => $this->company->present()->logo, diff --git a/app/Mail/ExistingMigration.php b/app/Mail/ExistingMigration.php index 449b8dbfdc8c..d03d4b4fc2bb 100644 --- a/app/Mail/ExistingMigration.php +++ b/app/Mail/ExistingMigration.php @@ -44,6 +44,7 @@ class ExistingMigration extends Mailable return $this ->from(config('mail.from.address'), config('mail.from.name')) + ->text('email.migration.existing_text') ->view('email.migration.existing'); } } diff --git a/app/Mail/MigrationCompleted.php b/app/Mail/MigrationCompleted.php index 19374f757e32..ced994b6f2ae 100644 --- a/app/Mail/MigrationCompleted.php +++ b/app/Mail/MigrationCompleted.php @@ -48,6 +48,7 @@ class MigrationCompleted extends Mailable $data['logo'] = $this->company->present()->logo(); $result = $this->from(config('mail.from.address'), config('mail.from.name')) + ->text('email.import.completed_text', $data) ->view('email.import.completed', $data); return $result; diff --git a/resources/views/email/admin/download_credits_text.blade.php b/resources/views/email/admin/download_credits_text.blade.php new file mode 100644 index 000000000000..fbc71736f3eb --- /dev/null +++ b/resources/views/email/admin/download_credits_text.blade.php @@ -0,0 +1,5 @@ +{!! ctrans('texts.credits_backup_subject') !!} + +{!! ctrans('texts.download_timeframe') !!} + +{!! $url !!} \ No newline at end of file diff --git a/resources/views/email/admin/download_files_text.blade.php b/resources/views/email/admin/download_files_text.blade.php new file mode 100644 index 000000000000..dd6c55aa559f --- /dev/null +++ b/resources/views/email/admin/download_files_text.blade.php @@ -0,0 +1,5 @@ +{!! ctrans('texts.download_backup_subject') !!} + +{!! ctrans('texts.download_timeframe') !!} + +{!! $url !!} \ No newline at end of file diff --git a/resources/views/email/admin/download_invoices_text.blade.php b/resources/views/email/admin/download_invoices_text.blade.php new file mode 100644 index 000000000000..c39d09549ae8 --- /dev/null +++ b/resources/views/email/admin/download_invoices_text.blade.php @@ -0,0 +1,5 @@ +{!! ctrans('texts.invoices_backup_subject') !!} + +{!! ctrans('texts.download_timeframe') !!} + +{!! $url !!} \ No newline at end of file diff --git a/resources/views/email/admin/download_quotes_text.blade.php b/resources/views/email/admin/download_quotes_text.blade.php new file mode 100644 index 000000000000..49574a3377a1 --- /dev/null +++ b/resources/views/email/admin/download_quotes_text.blade.php @@ -0,0 +1,5 @@ +{!! ctrans('texts.quotes_backup_subject') !!} + +{!! ctrans('texts.download_timeframe') !!} + +{!! $url !!} \ No newline at end of file diff --git a/resources/views/email/import/completed_text.blade.php b/resources/views/email/import/completed_text.blade.php new file mode 100644 index 000000000000..0f772d901142 --- /dev/null +++ b/resources/views/email/import/completed_text.blade.php @@ -0,0 +1,73 @@ +Hello, here is the output of your recent import job. + +If your logo imported correctly it will available display below. If it didn't import, you'll need to reupload your logo + +{!! $company->present()->logo() !!} + +@if(isset($company) && $company->clients->count() >=1) + {!! ctrans('texts.clients') !!}: {!! $company->clients->count() !!} +@endif + +@if(isset($company) && count($company->products) >=1) + {!! ctrans('texts.products') !!}: {!! count($company->products) !!} +@endif + +@if(isset($company) && count($company->invoices) >=1) + {!! ctrans('texts.invoices') !!}: {!! count($company->invoices) !!} +@endif + +@if(isset($company) && count($company->payments) >=1) + {!! ctrans('texts.payments') !!}: {!! count($company->payments) !!} +@endif + +@if(isset($company) && count($company->recurring_invoices) >=1) + {!! ctrans('texts.recurring_invoices') !!}: {!! count($company->recurring_invoices) !!} +@endif + +@if(isset($company) && count($company->quotes) >=1) + {!! ctrans('texts.quotes') !!}: {!! count($company->quotes) !!} +@endif + +@if(isset($company) && count($company->credits) >=1) + {!! ctrans('texts.credits') !!}: {!! count($company->credits) !!} +@endif + +@if(isset($company) && count($company->projects) >=1) + {!! ctrans('texts.projects') !!}: {!! count($company->projects) !!} +@endif + +@if(isset($company) && count($company->tasks) >=1) + {!! ctrans('texts.tasks') !!}: {!! count($company->tasks) !!} +@endif + +@if(isset($company) && count($company->vendors) >=1) + {!! ctrans('texts.vendors') !!}: {!! count($company->vendors) !!} +@endif + +@if(isset($company) && count($company->expenses) >=1) + {!! ctrans('texts.expenses') !!}: {!! count($company->expenses) !!} +@endif + +@if(isset($company) && count($company->company_gateways) >=1) + {!! ctrans('texts.gateways') !!}: {!! count($company->company_gateways) !!} +@endif + +@if(isset($company) && count($company->client_gateway_tokens) >=1) + {!! ctrans('texts.tokens') !!}: {!! count($company->client_gateway_tokens) !!} +@endif + +@if(isset($company) && count($company->tax_rates) >=1) + {!! ctrans('texts.tax_rates') !!}: {!! count($company->tax_rates) !!} +@endif + +@if(isset($company) && count($company->documents) >=1) + {!! ctrans('texts.documents') !!}: {!! count($company->documents) !!} +@endif + +{!! url('/') !!} + +{!! ctrans('texts.email_signature') !!} + +{!! ctrans('texts.email_from') !!} + + diff --git a/resources/views/email/migration/existing_text.blade.php b/resources/views/email/migration/existing_text.blade.php new file mode 100644 index 000000000000..53bc7074140d --- /dev/null +++ b/resources/views/email/migration/existing_text.blade.php @@ -0,0 +1,3 @@ +{!! ctrans('texts.migration_already_completed') !!} + +{!! ctrans('texts.migration_already_completed_desc', ['company_name' => $company_name]) !!} \ No newline at end of file