Commit 547f71bb authored by Guillaume Heurtier's avatar Guillaume Heurtier

FEAT #12981 TIME 0:20 return mode in ar preprocess

parent 942f5078
......@@ -402,7 +402,7 @@ $app->get('/resourcesList/summarySheets', \Resource\controllers\SummarySheetCont
$app->put('/resourcesList/integrations', \Resource\controllers\ResController::class . ':setInIntegrations');
//PreProcess
$app->post('/resourcesList/users/{userId}/groups/{groupId}/baskets/{basketId}/checkAcknowledgementReceipt', \Action\controllers\PreProcessActionController::class . ':checkAcknowledgementReceipt');
$app->post('/resourcesList/users/{userId}/groups/{groupId}/baskets/{basketId}/actions/{actionId}/checkAcknowledgementReceipt', \Action\controllers\PreProcessActionController::class . ':checkAcknowledgementReceipt');
$app->post('/resourcesList/users/{userId}/groups/{groupId}/baskets/{basketId}/checkExternalSignatoryBook', \Action\controllers\PreProcessActionController::class . ':checkExternalSignatoryBook');
$app->post('/resourcesList/users/{userId}/groups/{groupId}/baskets/{basketId}/checkExternalNoteBook', \Action\controllers\PreProcessActionController::class . ':checkExternalNoteBook');
$app->post('/resourcesList/users/{userId}/groups/{groupId}/baskets/{basketId}/checkInitiatorEntity', \Action\controllers\PreProcessActionController::class . ':checkInitiatorEntity');
......
......@@ -43,7 +43,7 @@ trait AcknowledgementReceiptTrait
$subjectResource = $resource['subject'] ?? '';
if (!empty($args['parameters']['canEdit'])) {
if (!empty($args['parameters']['mode']) && ($args['parameters']['mode'] == 'both' || $args['parameters']['mode'] == 'manual')) {
$contentToSend = $args['data']['content'] ?? null;
$subjectToSend = !empty($args['data']['subject']) ? $args['data']['subject'] : $subjectResource;
} else {
......
......@@ -159,6 +159,13 @@ class PreProcessActionController
public function checkAcknowledgementReceipt(Request $request, Response $response, array $args)
{
$action = ActionModel::getById(['id' => $args['actionId'], 'select' => ['parameters']]);
if (empty($action)) {
return $response->withStatus(400)->withJson(['errors' => 'Action does not exist']);
}
$parameters = json_decode($action['parameters'], true);
$mode = $parameters['mode'] ?? 'auto';
$currentUser = UserModel::getByLogin(['login' => $GLOBALS['userId'], 'select' => ['id']]);
$errors = ResourceListController::listControl(['groupId' => $args['groupId'], 'userId' => $args['userId'], 'basketId' => $args['basketId'], 'currentUserId' => $currentUser['id']]);
......@@ -355,7 +362,7 @@ class PreProcessActionController
}
}
return $response->withJson(['sendEmail' => $sendEmail, 'sendPaper' => $sendPaper, 'sendList' => $sendList, 'noSendAR' => $noSendAR, 'alreadySend' => $alreadySend, 'alreadyGenerated' => $alreadyGenerated]);
return $response->withJson(['sendEmail' => $sendEmail, 'sendPaper' => $sendPaper, 'sendList' => $sendList, 'noSendAR' => $noSendAR, 'alreadySend' => $alreadySend, 'alreadyGenerated' => $alreadyGenerated, 'mode' => $mode]);
}
public function checkExternalSignatoryBook(Request $request, Response $response, array $aArgs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment