From 9a16432f91e3d036cbcbefd2eebbbfd893b722e4 Mon Sep 17 00:00:00 2001 From: Tiavina Date: Mon, 10 Feb 2025 21:15:05 +0300 Subject: [PATCH] folder creation in statistique --- gestion/lib/Service/ExportThanatoStatisticService.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gestion/lib/Service/ExportThanatoStatisticService.php b/gestion/lib/Service/ExportThanatoStatisticService.php index dbade9d..0fb18a7 100644 --- a/gestion/lib/Service/ExportThanatoStatisticService.php +++ b/gestion/lib/Service/ExportThanatoStatisticService.php @@ -78,9 +78,15 @@ class ExportThanatoStatisticService { $thanatoFolder = $racineFolder.'STATISTIQUES/THANATOS/'; $fileHeader = $this->getExportThanatoFileHeader(); $fileContent = $this->populateExportDataIntoFileContent($exportData,$fileHeader); + $storage = $this->rootFolder->getUserFolder($idNextcloud); + try{ + $storage->newFolder($thanatoFolder); + } + catch(\OCP\Files\NotPermittedException $e) { + + } $filename = $this->getFilename($thanato["nom"],$thanato["prenom"],$month,$year); $fileNamePath = $thanatoFolder."STAT-THANATO-" . $filename . '.csv'; - $storage = $this->rootFolder->getUserFolder($idNextcloud); $storage->newFile($fileNamePath); $file = $storage->get($fileNamePath); $file->putContent($fileContent);