diff --git a/apps/maarch_entreprise/xml/alfresco.json.default b/apps/maarch_entreprise/xml/alfresco.json.default index 98ecf5e434be7e771c68c63790709626086c11cf..0a41d5ca6b5c1538f19de7f10d274fda08485264 100644 --- a/apps/maarch_entreprise/xml/alfresco.json.default +++ b/apps/maarch_entreprise/xml/alfresco.json.default @@ -7,7 +7,10 @@ "attachment" : { "cm:name": "title" }, - "folder" : { + "folderCreation" : { + "cm:title": "un titre" + }, + "folderModification" : { "cm:description": "une description" } } diff --git a/src/app/external/alfresco/controllers/AlfrescoController.php b/src/app/external/alfresco/controllers/AlfrescoController.php index 064eacad3c57024262923e0f8d01bc92e35e97ac..d6d0d29e4cc95370d53952827496fceba62c4939 100644 --- a/src/app/external/alfresco/controllers/AlfrescoController.php +++ b/src/app/external/alfresco/controllers/AlfrescoController.php @@ -593,12 +593,16 @@ class AlfrescoController return ['errors' => 'Alfresco mapping file does not exist']; } + $body = ['name' => str_replace('/', '_', $document['alt_identifier']), 'nodeType' => 'cm:folder']; + if (!empty($alfrescoParameters['mapping']['folderCreation'])) { + $body['properties'] = $alfrescoParameters['mapping']['folderCreation']; + } $curlResponse = CurlModel::execSimple([ 'url' => "{$alfrescoUri}/alfresco/versions/1/nodes/{$args['folderId']}/children", 'basicAuth' => ['user' => $entityInformations['alfresco']['login'], 'password' => $entityInformations['alfresco']['password']], 'headers' => ['content-type:application/json', 'Accept: application/json'], 'method' => 'POST', - 'body' => json_encode(['name' => str_replace('/', '_', $document['alt_identifier']), 'nodeType' => 'cm:folder']) + 'body' => json_encode($body) ]); if ($curlResponse['code'] != 201) { return ['errors' => "Create folder {$document['alt_identifier']} failed : " . json_encode($curlResponse['response'])]; @@ -819,9 +823,9 @@ class AlfrescoController AttachmentModel::update(['set' => ['external_id' => json_encode($externalId)], 'where' => ['res_id = ?'], 'data' => [$attachment['res_id']]]); } - if (!empty($alfrescoParameters['mapping']['folder'])) { + if (!empty($alfrescoParameters['mapping']['folderModification'])) { $body = [ - 'properties' => $alfrescoParameters['mapping']['folder'], + 'properties' => $alfrescoParameters['mapping']['folderModification'], ]; $curlResponse = CurlModel::execSimple([ 'url' => "{$alfrescoUri}/alfresco/versions/1/nodes/{$resourceFolderId}",