From 118efc734cd01bbfb97286ecf12cb0dce59e3648 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Wed, 16 Oct 2024 14:30:21 +0800 Subject: [PATCH] Laravel Vapor - Debug approve purchase order issue --- .../Processors/CreateInvoiceDocumentProcessor.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Classes/Modules/Transactions/Processors/CreateInvoiceDocumentProcessor.php b/app/Classes/Modules/Transactions/Processors/CreateInvoiceDocumentProcessor.php index a3456b63..90445088 100644 --- a/app/Classes/Modules/Transactions/Processors/CreateInvoiceDocumentProcessor.php +++ b/app/Classes/Modules/Transactions/Processors/CreateInvoiceDocumentProcessor.php @@ -77,16 +77,19 @@ class CreateInvoiceDocumentProcessor $localFilePath = storage_path('app/documents/' . $currentFile); $oMerger->addPDF($localFilePath, 'all'); - if($filesystemDriver === 's3'){ - $filePathForS3 = 'documents/'.$currentFile; - Log::info('CreateInvoiceDocumentProcessor 2: ' . $filePathForS3); - Storage::disk('s3')->put($filePathForS3, file_get_contents($localFilePath)); - } } $oMerger->merge(); $order_pdf = $oMerger; + + if($filesystemDriver === 's3'){ + $finalTempPdfPath = storage_path('app/documents/temp.pdf'); + $filePathForS3 = 'documents/temp.pdf'; + $fileContent = file_get_contents($finalTempPdfPath); + Log::info('CreateInvoiceDocumentProcessor 2: ' . $filePathForS3); + Storage::disk('s3')->put($filePathForS3, $fileContent); + } } $document_object = new DocumentObject(