|
@@ -56,7 +56,7 @@ class GenerateDocumentsService
|
|
|
$this->generateOrderForMount($order);
|
|
$this->generateOrderForMount($order);
|
|
|
|
|
|
|
|
// create zip archive
|
|
// create zip archive
|
|
|
- $fileModel = (new FileService())->createZipArchive('orders/' . $order->id . '/tmp', self::INSTALL_FILENAME . $order->common_name . '.zip', $userId);
|
|
|
|
|
|
|
+ $fileModel = (new FileService())->createZipArchive('orders/' . $order->id . '/tmp', self::INSTALL_FILENAME . fileName($order->common_name) . '.zip', $userId);
|
|
|
|
|
|
|
|
// remove temp files
|
|
// remove temp files
|
|
|
Storage::disk('public')->deleteDirectory('orders/' . $order->id . '/tmp');
|
|
Storage::disk('public')->deleteDirectory('orders/' . $order->id . '/tmp');
|
|
@@ -99,7 +99,7 @@ class GenerateDocumentsService
|
|
|
$sheet->setCellValue('G33', Str::trim($str));
|
|
$sheet->setCellValue('G33', Str::trim($str));
|
|
|
|
|
|
|
|
//
|
|
//
|
|
|
- $fileName = 'Заявка на монтаж - ' . Str::replace('/', '-', $order->object_address) . '.xlsx';
|
|
|
|
|
|
|
+ $fileName = 'Заявка на монтаж - ' . fileName($order->object_address) . '.xlsx';
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
Storage::disk('public')->makeDirectory('orders/' . $order->id . '/tmp');
|
|
Storage::disk('public')->makeDirectory('orders/' . $order->id . '/tmp');
|
|
|
|
|
|
|
@@ -158,7 +158,7 @@ class GenerateDocumentsService
|
|
|
|
|
|
|
|
|
|
|
|
|
// create zip archive
|
|
// create zip archive
|
|
|
- $fileModel = (new FileService())->createZipArchive('orders/' . $order->id . '/tmp', self::HANDOVER_FILENAME . $order->common_name . '.zip', $userId);
|
|
|
|
|
|
|
+ $fileModel = (new FileService())->createZipArchive('orders/' . $order->id . '/tmp', self::HANDOVER_FILENAME . fileName($order->common_name) . '.zip', $userId);
|
|
|
|
|
|
|
|
// remove temp files
|
|
// remove temp files
|
|
|
Storage::disk('public')->deleteDirectory('orders/' . $order->id . '/tmp');
|
|
Storage::disk('public')->deleteDirectory('orders/' . $order->id . '/tmp');
|
|
@@ -333,7 +333,7 @@ class GenerateDocumentsService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// save file
|
|
// save file
|
|
|
- $fileName = '4.Паспорт объекта - ' . Str::replace('/', '-', $order->object_address) . '.xlsx';
|
|
|
|
|
|
|
+ $fileName = '4.Паспорт объекта - ' . fileName($order->object_address) . '.xlsx';
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
Storage::disk('public')->makeDirectory('orders/' . $order->id . '/tmp');
|
|
Storage::disk('public')->makeDirectory('orders/' . $order->id . '/tmp');
|
|
|
|
|
|
|
@@ -348,11 +348,11 @@ class GenerateDocumentsService
|
|
|
*/
|
|
*/
|
|
|
public function generateReclamationPack(Reclamation $reclamation, int $userId): string
|
|
public function generateReclamationPack(Reclamation $reclamation, int $userId): string
|
|
|
{
|
|
{
|
|
|
- Storage::disk('public')->makeDirectory('reclamations/' . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address) . '/ФОТО НАРУШЕНИЯ/');
|
|
|
|
|
|
|
+ Storage::disk('public')->makeDirectory('reclamations/' . $reclamation->id . '/tmp/' . fileName($reclamation->order->object_address) . '/ФОТО НАРУШЕНИЯ/');
|
|
|
// copy photos
|
|
// copy photos
|
|
|
foreach ($reclamation->photos_before as $photo) {
|
|
foreach ($reclamation->photos_before as $photo) {
|
|
|
$from = $photo->path;
|
|
$from = $photo->path;
|
|
|
- $to = 'reclamations/' . $reclamation->id . '/tmp/' . $reclamation->order->object_address . '/ФОТО НАРУШЕНИЯ/' . $photo->original_name;
|
|
|
|
|
|
|
+ $to = 'reclamations/' . $reclamation->id . '/tmp/' . fileName($reclamation->order->object_address) . '/ФОТО НАРУШЕНИЯ/' . $photo->original_name;
|
|
|
if (!Storage::disk('public')->exists($to)) {
|
|
if (!Storage::disk('public')->exists($to)) {
|
|
|
Storage::disk('public')->copy($from, $to);
|
|
Storage::disk('public')->copy($from, $to);
|
|
|
}
|
|
}
|
|
@@ -364,7 +364,7 @@ class GenerateDocumentsService
|
|
|
$this->generateReclamationGuarantee($reclamation);
|
|
$this->generateReclamationGuarantee($reclamation);
|
|
|
|
|
|
|
|
// create zip archive
|
|
// create zip archive
|
|
|
- $fileModel = (new FileService())->createZipArchive('reclamations/' . $reclamation->id . '/tmp', self::RECLAMATION_FILENAME . Str::replace('/', '-', $reclamation->order->object_address) . '.zip', $userId);
|
|
|
|
|
|
|
+ $fileModel = (new FileService())->createZipArchive('reclamations/' . $reclamation->id . '/tmp', self::RECLAMATION_FILENAME . fileName($reclamation->order->object_address) . '.zip', $userId);
|
|
|
|
|
|
|
|
// remove temp files
|
|
// remove temp files
|
|
|
Storage::disk('public')->deleteDirectory('reclamations/' . $reclamation->id . '/tmp');
|
|
Storage::disk('public')->deleteDirectory('reclamations/' . $reclamation->id . '/tmp');
|
|
@@ -402,11 +402,11 @@ class GenerateDocumentsService
|
|
|
$sheet->setCellValue('U20', DateHelper::getHumanDate($reclamation->create_date, true));
|
|
$sheet->setCellValue('U20', DateHelper::getHumanDate($reclamation->create_date, true));
|
|
|
|
|
|
|
|
// save file
|
|
// save file
|
|
|
- $fileName = 'Монтажная заявка - ' . Str::replace('/', '-', $reclamation->order->object_address) . '.xlsx';
|
|
|
|
|
|
|
+ $fileName = 'Монтажная заявка - ' . fileName($reclamation->order->object_address) . '.xlsx';
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
- $fd = 'reclamations/' . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address);
|
|
|
|
|
|
|
+ $fd = 'reclamations/' . $reclamation->id . '/tmp/' . fileName($reclamation->order->object_address);
|
|
|
Storage::disk('public')->makeDirectory($fd);
|
|
Storage::disk('public')->makeDirectory($fd);
|
|
|
- $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address) . '/' . $fileName;
|
|
|
|
|
|
|
+ $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . fileName($reclamation->order->object_address) . '/' . $fileName;
|
|
|
Storage::disk('public')->delete($fd . '/' . $fileName);
|
|
Storage::disk('public')->delete($fd . '/' . $fileName);
|
|
|
$writer->save($fp);
|
|
$writer->save($fp);
|
|
|
PdfConverterClient::convert($fp);
|
|
PdfConverterClient::convert($fp);
|
|
@@ -447,11 +447,11 @@ class GenerateDocumentsService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// save file
|
|
// save file
|
|
|
- $fileName = 'Акт - ' . Str::replace('/', '-', $reclamation->order->object_address) . '.xlsx';
|
|
|
|
|
|
|
+ $fileName = 'Акт - ' . fileName($reclamation->order->object_address) . '.xlsx';
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
- $fd = 'reclamations/' . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address);
|
|
|
|
|
|
|
+ $fd = 'reclamations/' . $reclamation->id . '/tmp/' . fileName($reclamation->order->object_address);
|
|
|
Storage::disk('public')->makeDirectory($fd);
|
|
Storage::disk('public')->makeDirectory($fd);
|
|
|
- $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address) . '/' . $fileName;
|
|
|
|
|
|
|
+ $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . fileName($reclamation->order->object_address) . '/' . $fileName;
|
|
|
Storage::disk('public')->delete($fd . '/' . $fileName);
|
|
Storage::disk('public')->delete($fd . '/' . $fileName);
|
|
|
$writer->save($fp);
|
|
$writer->save($fp);
|
|
|
PdfConverterClient::convert($fp);
|
|
PdfConverterClient::convert($fp);
|
|
@@ -488,11 +488,11 @@ class GenerateDocumentsService
|
|
|
$sheet->setCellValue('A19', $text);
|
|
$sheet->setCellValue('A19', $text);
|
|
|
|
|
|
|
|
// save file
|
|
// save file
|
|
|
- $fileName = 'Гарантийное письмо - ' . Str::replace('/', '-', $reclamation->order->object_address) . '.xlsx';
|
|
|
|
|
|
|
+ $fileName = 'Гарантийное письмо - ' . fileName($reclamation->order->object_address) . '.xlsx';
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
- $fd = 'reclamations/' . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address);
|
|
|
|
|
|
|
+ $fd = 'reclamations/' . $reclamation->id . '/tmp/' . fileName($reclamation->order->object_address);
|
|
|
Storage::disk('public')->makeDirectory($fd);
|
|
Storage::disk('public')->makeDirectory($fd);
|
|
|
- $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . Str::replace('/', '-', $reclamation->order->object_address) . '/' . $fileName;
|
|
|
|
|
|
|
+ $fp = storage_path('app/public/reclamations/') . $reclamation->id . '/tmp/' . fileName($reclamation->order->object_address) . '/' . $fileName;
|
|
|
Storage::disk('public')->delete($fd . '/' . $fileName);
|
|
Storage::disk('public')->delete($fd . '/' . $fileName);
|
|
|
$writer->save($fp);
|
|
$writer->save($fp);
|
|
|
PdfConverterClient::convert($fp);
|
|
PdfConverterClient::convert($fp);
|