From e1b052a84371a6c83a518f10672d74d9fa1821a1 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 18 Sep 2021 09:26:28 +1000 Subject: [PATCH 1/4] Minor Fixes --- app/Utils/Traits/MakesInvoiceValues.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index 5361d38a5ac3..bf6b263ecf5c 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -297,6 +297,9 @@ trait MakesInvoiceValues $data[$key][$table_type.'.notes'] = $this->processReservedKeywords($item->notes); $data[$key][$table_type.'.description'] = $this->processReservedKeywords($item->notes); + /* need to test here as this is new - 18/09/2021*/ + if(!array_key_exists($table_type.'.gross_line_total', $data[$key])) + $data[$key][$table_type.'.gross_line_total'] = 0; $data[$key][$table_type . ".{$_table_type}1"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}1", $item->custom_value1, $this->client); $data[$key][$table_type . ".{$_table_type}2"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}2", $item->custom_value2, $this->client); @@ -311,10 +314,7 @@ trait MakesInvoiceValues $data[$key][$table_type.'.cost'] = Number::formatMoney($item->cost, $this->client); $data[$key][$table_type.'.line_total'] = Number::formatMoney($item->line_total, $this->client); - - /* need to test here as this is new - 18/09/2021*/ - if(array_key_exists($table_type.'.gross_line_total', $data[$key])) - $data[$key][$table_type.'.gross_line_total'] = Number::formatMoney($item->gross_line_total, $this->client); + if (isset($item->discount) && $item->discount > 0) { if ($item->is_amount_discount) { From 8c96296f2916caea2ad4a280f39143ddbba62668 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 18 Sep 2021 14:48:13 +1000 Subject: [PATCH 2/4] Fixes for company export --- app/Jobs/Company/CompanyExport.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Jobs/Company/CompanyExport.php b/app/Jobs/Company/CompanyExport.php index 64529b4d1045..74bfb559f94f 100644 --- a/app/Jobs/Company/CompanyExport.php +++ b/app/Jobs/Company/CompanyExport.php @@ -501,12 +501,14 @@ class CompanyExport implements ShouldQueue unlink($zip_path); } + $storage_file_path = Storage::disk(config('filesystems.default'))->url('backups/'.$file_name) + App::forgetInstance('translator'); $t = app('translator'); $t->replace(Ninja::transformTranslations($this->company->settings)); $nmo = new NinjaMailerObject; - $nmo->mailable = new DownloadBackup(Storage::disk(config('filesystems.default'))->url('backups/'.$file_name), $this->company); + $nmo->mailable = new DownloadBackup($storage_file_path, $this->company); $nmo->to_user = $this->user; $nmo->company = $this->company; $nmo->settings = $this->company->settings; From 1f2aa60beecdcb54c8e53e8fd20b4ccff8320fc1 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 18 Sep 2021 14:49:43 +1000 Subject: [PATCH 3/4] Fixes for company export --- app/Jobs/Company/CompanyExport.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Jobs/Company/CompanyExport.php b/app/Jobs/Company/CompanyExport.php index 74bfb559f94f..5fb0b98a42ce 100644 --- a/app/Jobs/Company/CompanyExport.php +++ b/app/Jobs/Company/CompanyExport.php @@ -498,7 +498,6 @@ class CompanyExport implements ShouldQueue if(Ninja::isHosted()) { Storage::disk(config('filesystems.default'))->put('backups/'.$file_name, file_get_contents($zip_path)); - unlink($zip_path); } $storage_file_path = Storage::disk(config('filesystems.default'))->url('backups/'.$file_name) @@ -515,6 +514,10 @@ class CompanyExport implements ShouldQueue NinjaMailerJob::dispatch($nmo); + if(Ninja::isHosted()){ + sleep(3); + unlink($zip_path); + } } } From 70f16d9cf1242c5e54286bcbf2d6c62961558249 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 18 Sep 2021 14:50:15 +1000 Subject: [PATCH 4/4] Fixes for company export --- app/Jobs/Company/CompanyExport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/Company/CompanyExport.php b/app/Jobs/Company/CompanyExport.php index 5fb0b98a42ce..537083a6602e 100644 --- a/app/Jobs/Company/CompanyExport.php +++ b/app/Jobs/Company/CompanyExport.php @@ -500,7 +500,7 @@ class CompanyExport implements ShouldQueue Storage::disk(config('filesystems.default'))->put('backups/'.$file_name, file_get_contents($zip_path)); } - $storage_file_path = Storage::disk(config('filesystems.default'))->url('backups/'.$file_name) + $storage_file_path = Storage::disk(config('filesystems.default'))->url('backups/'.$file_name); App::forgetInstance('translator'); $t = app('translator');