From 161f20fae75329bc4da2b7f9134055f02844d1c8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 22:36:50 +1000 Subject: [PATCH 1/3] Fixes for paths to s3 type storage --- app/Http/Controllers/InvoiceController.php | 2 -- app/Models/Company.php | 1 - app/Services/Credit/GetCreditPdf.php | 4 ++++ app/Services/Quote/GetQuotePdf.php | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 8451e1d7a3..3379ecf4a7 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -795,8 +795,6 @@ class InvoiceController extends BaseController $file_path = $invoice->service()->getInvoicePdf($contact); - nlog($file_path); - return response()->download($file_path, basename($file_path)); } diff --git a/app/Models/Company.php b/app/Models/Company.php index 73f2d1e8c9..eeff9efe43 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -100,7 +100,6 @@ class Company extends BaseModel 'country_id' => 'string', 'custom_fields' => 'object', 'settings' => 'object', - 'custom_fields' => 'object', 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', diff --git a/app/Services/Credit/GetCreditPdf.php b/app/Services/Credit/GetCreditPdf.php index 96bb0f818e..84deac828d 100644 --- a/app/Services/Credit/GetCreditPdf.php +++ b/app/Services/Credit/GetCreditPdf.php @@ -13,6 +13,7 @@ namespace App\Services\Credit; use App\Jobs\Entity\CreateEntityPdf; use App\Services\AbstractService; +use App\Utils\TempFile; use Illuminate\Support\Facades\Storage; class GetCreditPdf extends AbstractService @@ -48,6 +49,9 @@ class GetCreditPdf extends AbstractService $file_path = CreateEntityPdf::dispatchNow($this->invitation); } + if(config('filesystems.default') == 's3') + return TempFile::path(Storage::disk($disk)->url($file_path)); + return Storage::disk($disk)->path($file_path); } } diff --git a/app/Services/Quote/GetQuotePdf.php b/app/Services/Quote/GetQuotePdf.php index 582664aaac..2d8b62539c 100644 --- a/app/Services/Quote/GetQuotePdf.php +++ b/app/Services/Quote/GetQuotePdf.php @@ -15,6 +15,7 @@ use App\Jobs\Entity\CreateEntityPdf; use App\Models\ClientContact; use App\Models\Quote; use App\Services\AbstractService; +use App\Utils\TempFile; use Illuminate\Support\Facades\Storage; class GetQuotePdf extends AbstractService @@ -46,6 +47,9 @@ class GetQuotePdf extends AbstractService $file_path = CreateEntityPdf::dispatchNow($invitation); } + if(config('filesystems.default') == 's3') + return TempFile::path(Storage::disk($disk)->url($file_path)); + return Storage::disk($disk)->path($file_path); } } From 048405decc808cae6fe1fe6a1219f18d25a7729c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 22:38:59 +1000 Subject: [PATCH 2/3] check object prior to testing properties --- app/Services/PdfMaker/Design.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PdfMaker/Design.php b/app/Services/PdfMaker/Design.php index 65acf2f4be..fcce4dbbb7 100644 --- a/app/Services/PdfMaker/Design.php +++ b/app/Services/PdfMaker/Design.php @@ -499,7 +499,7 @@ class Design extends BaseDesign } } elseif (Str::startsWith($variable, '$custom')) { $field = explode('_', $variable); - $visible = property_exists($this->client->company->custom_fields, $field[1]) && !empty($this->client->company->custom_fields->{$field[1]}); + $visible = is_object($this->client->company->custom_fields) && property_exists($this->client->company->custom_fields, $field[1]) && !empty($this->client->company->custom_fields->{$field[1]}); $elements[1]['elements'][] = ['element' => 'div', 'elements' => [ ['element' => 'span', 'content' => $variable . '_label', 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']], From fb054633c397d0d74f22241694bd4e0f15881140 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 22:39:28 +1000 Subject: [PATCH 3/3] v5.1.37 --- VERSION.txt | 2 +- config/ninja.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 9a45b61bfd..472daa1d8b 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.1.36 \ No newline at end of file +5.1.37 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index e3ade7f524..7a1bc2b71c 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,7 +14,7 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', ''), - 'app_version' => '5.1.36', + 'app_version' => '5.1.37', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false),