Alexander Musikhin 2 сар өмнө
parent
commit
8c6ea6cae5

+ 8 - 8
app/Services/GenerateDocumentsService.php

@@ -348,7 +348,7 @@ class GenerateDocumentsService
      */
     public function generateReclamationPack(Reclamation $reclamation, int $userId): string
     {
-        Storage::disk('public')->makeDirectory('reclamations/' . $reclamation->id . '/tmp/' . $reclamation->order->object_address . '/ФОТО НАРУШЕНИЯ/');
+        Storage::disk('public')->makeDirectory('reclamations/' . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address) . '/ФОТО НАРУШЕНИЯ/');
         // copy photos
         foreach ($reclamation->photos_before as $photo) {
             $from = $photo->path;
@@ -364,7 +364,7 @@ class GenerateDocumentsService
         $this->generateReclamationGuarantee($reclamation);
 
         // create zip archive
-        $fileModel = (new FileService())->createZipArchive('reclamations/' . $reclamation->id . '/tmp', self::RECLAMATION_FILENAME . $reclamation->order->object_address . '.zip', $userId);
+        $fileModel = (new FileService())->createZipArchive('reclamations/' . $reclamation->id . '/tmp', self::RECLAMATION_FILENAME . Str::replace('/', '-', $reclamation->order->object_address) . '.zip', $userId);
 
         // remove temp files
         Storage::disk('public')->deleteDirectory('reclamations/' . $reclamation->id . '/tmp');
@@ -404,9 +404,9 @@ class GenerateDocumentsService
         // save file
         $fileName = 'Монтажная заявка - ' . Str::replace('/', '-', $reclamation->order->object_address) . '.xlsx';
         $writer = new Xlsx($spreadsheet);
-        $fd = 'reclamations/' . $reclamation->id . '/tmp/' . $reclamation->order->object_address;
+        $fd = 'reclamations/' . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address);
         Storage::disk('public')->makeDirectory($fd);
-        $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . $reclamation->order->object_address . '/' . $fileName;
+        $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address) . '/' . $fileName;
         Storage::disk('public')->delete($fd . '/' . $fileName);
         $writer->save($fp);
         PdfConverterClient::convert($fp);
@@ -449,9 +449,9 @@ class GenerateDocumentsService
         // save file
         $fileName = 'Акт - ' . Str::replace('/', '-', $reclamation->order->object_address) . '.xlsx';
         $writer = new Xlsx($spreadsheet);
-        $fd = 'reclamations/' . $reclamation->id . '/tmp/' . $reclamation->order->object_address;
+        $fd = 'reclamations/' . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address);
         Storage::disk('public')->makeDirectory($fd);
-        $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . $reclamation->order->object_address . '/' . $fileName;
+        $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address) . '/' . $fileName;
         Storage::disk('public')->delete($fd . '/' . $fileName);
         $writer->save($fp);
         PdfConverterClient::convert($fp);
@@ -490,9 +490,9 @@ class GenerateDocumentsService
         // save file
         $fileName = 'Гарантийное письмо - ' . Str::replace('/', '-', $reclamation->order->object_address) . '.xlsx';
         $writer = new Xlsx($spreadsheet);
-        $fd = 'reclamations/' . $reclamation->id . '/tmp/' . $reclamation->order->object_address;
+        $fd = 'reclamations/' . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address);
         Storage::disk('public')->makeDirectory($fd);
-        $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . $reclamation->order->object_address . '/' . $fileName;
+        $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address) . '/' . $fileName;
         Storage::disk('public')->delete($fd . '/' . $fileName);
         $writer->save($fp);
         PdfConverterClient::convert($fp);