From 10982699d0ca09728a7ea8ac7bc8c6981f154052 Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Fri, 31 Jan 2020 12:05:24 +0100 Subject: [PATCH] FEAT #12091 TIME 0:15 Fix actions when errors --- src/app/action/controllers/ActionMethodController.php | 2 ++ src/app/resource/controllers/ResourceListController.php | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/action/controllers/ActionMethodController.php b/src/app/action/controllers/ActionMethodController.php index bbfdaf74460..87bc560107b 100644 --- a/src/app/action/controllers/ActionMethodController.php +++ b/src/app/action/controllers/ActionMethodController.php @@ -377,6 +377,7 @@ class ActionMethodController $loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/visa/xml/remoteSignatoryBooks.xml']); $config = []; + $historyInfo = ''; if (!empty($loadedXml)) { $config['id'] = 'maarchParapheur'; foreach ($loadedXml->signatoryBook as $value) { @@ -697,6 +698,7 @@ class ActionMethodController if ($message == null) { return true; } + return ['history' => $message]; } diff --git a/src/app/resource/controllers/ResourceListController.php b/src/app/resource/controllers/ResourceListController.php index 253b176aa3d..c80fe021113 100644 --- a/src/app/resource/controllers/ResourceListController.php +++ b/src/app/resource/controllers/ResourceListController.php @@ -437,7 +437,7 @@ class ResourceListController $method = ActionMethodController::COMPONENTS_ACTIONS[$action['component']]; $methodResponses = []; - foreach ($resourcesForAction as $resId) { + foreach ($resourcesForAction as $key => $resId) { if (!empty($method)) { $methodResponse = ActionMethodController::$method(['resId' => $resId, 'data' => $body['data'], 'note' => $body['note']]); @@ -446,6 +446,7 @@ class ResourceListController $methodResponses['errors'] = []; } $methodResponses['errors'] = array_merge($methodResponses['errors'], $methodResponse['errors']); + unset($resourcesForAction[$key]); } if (!empty($methodResponse['data'])) { if (empty($methodResponses['data'])) { @@ -458,9 +459,6 @@ class ResourceListController $historic = empty($methodResponse['history']) ? '' : $methodResponse['history']; ActionMethodController::terminateAction(['id' => $aArgs['actionId'], 'resources' => $resourcesForAction, 'basketName' => $basket['basket_name'], 'note' => $body['note'], 'history' => $historic]); - if (!empty($methodResponses['errors'])) { - return $response->withStatus(403)->withJson($methodResponses); - } if (!empty($methodResponses)) { return $response->withJson($methodResponses); } -- GitLab