Skip to content
Snippets Groups Projects
Commit 41462aef authored by Jean-Laurent DUZANT's avatar Jean-Laurent DUZANT
Browse files

FEAT #17671 TIME 0:10 fix physicalPurge bool check && updated history message

parent c41a0794
No related branches found
No related tags found
No related merge requests found
......@@ -300,9 +300,10 @@ class DocumentController
$queryParams['physicalPurge'] = filter_var($queryParams['physicalPurge'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
if (!Validator::boolType()->validate($queryParams['physicalPurge'])) {
return $response->withStatus(400)->withJson(['errors' => 'physicalPurge is empty or not a boolean']);
return $response->withStatus(400)->withJson(['errors' => 'physicalPurge is not a boolean']);
}
$historyInfo = '';
if($queryParams['physicalPurge']) {
$docServers = DocserverModel::get(['select' => ['type', 'path']]);
if (empty($docServers)) {
......@@ -364,12 +365,14 @@ class DocumentController
'where' => ['id = ?'],
'data' => [$args['id']]
]);
$historyInfo = "{documentDeleted} : {$document['title']}";
} else {
DocumentModel::update([
'set' => ['status' => 'SOFT_DEL'],
'where' => ['id = ?'],
'data' => [$args['id']]
]);
$historyInfo = "{softDeleted} : {$document['title']}";
}
HistoryController::add([
......@@ -377,7 +380,7 @@ class DocumentController
'objectType' => 'main_documents',
'objectId' => $args['id'],
'type' => 'SUPPRESSION',
'message' => "{documentDeleted} : {$document['title']}"
'message' => $historyInfo
]);
return $response->withStatus(204);
......
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