From 41462aeffbabd0b3c2a7a28b39d4682574e71605 Mon Sep 17 00:00:00 2001 From: Jean-Laurent <jean-laurent.duzant@xelians.fr> Date: Thu, 18 Aug 2022 11:07:05 +0200 Subject: [PATCH] FEAT #17671 TIME 0:10 fix physicalPurge bool check && updated history message --- src/app/document/controllers/DocumentController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/document/controllers/DocumentController.php b/src/app/document/controllers/DocumentController.php index 90f71913fb..dff5497ac7 100755 --- a/src/app/document/controllers/DocumentController.php +++ b/src/app/document/controllers/DocumentController.php @@ -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); -- GitLab