From 81d3762f23a98351c08731c19edc21058299adf4 Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Thu, 17 Dec 2015 13:57:16 +0000
Subject: [PATCH] FEAT #3210

---
 core/trunk/core/docservers_tools.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/core/trunk/core/docservers_tools.php b/core/trunk/core/docservers_tools.php
index a74e283331d..2386c8d74fb 100644
--- a/core/trunk/core/docservers_tools.php
+++ b/core/trunk/core/docservers_tools.php
@@ -60,6 +60,10 @@ function Ds_copyOnDocserver(
         $storeInfos = array('error' => _FILE_ALREADY_EXISTS);
         return $storeInfos;
     }
+    if (!is_dir($destinationDir)) {
+        mkdir($destinationDir, 0770, true);
+        Ds_setRights($destinationDir);
+    }
     $cp = copy($sourceFilePath, $destinationDir . $fileDestinationName);
     Ds_setRights($destinationDir . $fileDestinationName);
     if ($cp == false) {
@@ -138,9 +142,10 @@ function Ds_createPathOnDocServer($docServer)
     }
     if (isset($GLOBALS['wb']) && $GLOBALS['wb'] <> '') {
         $path = $docServer . date('Y') . DIRECTORY_SEPARATOR.date('m')
-              . DIRECTORY_SEPARATOR . $GLOBALS['wb'] . DIRECTORY_SEPARATOR;
+              . DIRECTORY_SEPARATOR . 'BATCH' . DIRECTORY_SEPARATOR 
+              . $GLOBALS['wb'] . DIRECTORY_SEPARATOR;
         if (!is_dir($path)) {
-            mkdir($path, 0770);
+            mkdir($path, 0770, true);
             Ds_setRights($path);
         } else {
             return array(
-- 
GitLab