diff --git a/src/module_vmap/web_service/ws/Querys.class.inc b/src/module_vmap/web_service/ws/Querys.class.inc index 8780bb041e10a312ff2706e44fb0853a56bf681b..bcaff1db2ebb91f0e9689adec87a28efd28d0374 100644 --- a/src/module_vmap/web_service/ws/Querys.class.inc +++ b/src/module_vmap/web_service/ws/Querys.class.inc @@ -1440,32 +1440,18 @@ class Querys extends Vmap { $this->aValues['my_vitis_id'] = $this->aValues[$bo_id_field]; - // Définit si il a des fichiers a uploader - $bUploadFiles = false; - foreach ($this->aValues as $key => $value) { - if (strrpos($key, '_file')) { - $sName = substr($key, 0, strrpos($key, '_file')); - if (isset($this->aValues[$sName . '_name'])) { - $bUploadFiles = true; - } - } - } - // Fichiers à uploader ? - if ($bUploadFiles) { - // Création du dossier contenneur si il n'existe pas - $sDirPath = $this->createElementFilesFolder($sBusinessObjectId, $this->aValues['my_vitis_id']); - if (!is_dir($sDirPath)) { - $oError = new VitisError(1, "Unable to acces to the business object direrctory :" . $sDirPath); - $aXmlRacineAttribute['status'] = 0; - $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - return $sMessage; + if (!empty($_FILES) && !empty($this->aValues['my_vitis_id'])) { + + // Écriture du fichier + $oFileManager = new Files_manager($this->aProperties); + foreach ($_FILES as $sName => $aFile) { + $aUploadReturn = $oFileManager->uploadInWsDataDir('vitis', $sBusinessObjectId, $this->aValues['my_vitis_id'], $sName, 'documents'); + $this->aValues[$sName] = $aUploadReturn['field_value']; } - // Mise en place des fichiers - $this->aValues = $this->extractFiles($this->aValues, $sDirPath); - } - $aReturn = $this->genericPut($bo_schema, $bo_table, $bo_id_field); + $this->genericPut($bo_schema, $bo_table, $bo_id_field); + } // Lance l'évènement webSocket if (!empty($bo_event)) {