Skip to content
Snippets Groups Projects
Verified Commit 1161b726 authored by Damien's avatar Damien
Browse files

FEAT #15397 TIME 0:15 Alfresco folder metadata creation

parent 8d28adbf
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,10 @@
"attachment" : {
"cm:name": "title"
},
"folder" : {
"folderCreation" : {
"cm:title": "un titre"
},
"folderModification" : {
"cm:description": "une description"
}
}
......
......@@ -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}",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment