diff --git a/src/Service/Report/Pdf/PdfService.php b/src/Service/Report/Pdf/PdfService.php index 72e040e7..eceecb6b 100644 --- a/src/Service/Report/Pdf/PdfService.php +++ b/src/Service/Report/Pdf/PdfService.php @@ -92,8 +92,10 @@ public function generatePdfReport(array $issues, Filter $filter, ReportElements $sanitizedConstructionSiteName = FileHelper::sanitizeFileName($constructionSite->getName()); $humanReadablePrefix = (new \DateTime())->format(DateTimeFormatter::FILESYSTEM_DATE_TIME_FORMAT).'_'.$sanitizedConstructionSiteName; + $optimalFilename = $humanReadablePrefix.'.pdf'; - $filename = file_exists($optimalFilename) ? $humanReadablePrefix.'_'.uniqid().'.pdf' : $optimalFilename; + $optimalPath = $folder.'/'.$optimalFilename; + $filename = file_exists($optimalPath) ? $humanReadablePrefix.'_'.uniqid().'.pdf' : $optimalFilename; $path = $folder.'/'.$filename; $report->save($path);