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

FEAT Preprocess parapheur lock

parent 9fcf1161
No related branches found
No related tags found
No related merge requests found
......@@ -375,6 +375,33 @@ class PreProcessActionController
$data = $request->getParsedBody();
$data['resources'] = array_slice($data['resources'], 0, 500);
if (!ResController::hasRightByResId(['resId' => $data['resources'], 'userId' => $GLOBALS['userId']])) {
return $response->withStatus(403)->withJson(['errors' => 'Document out of perimeter']);
}
$resources = ResModel::get([
'select' => ['res_id', 'locker_user_id', 'locker_time'],
'where' => ['res_id in (?)'],
'data' => [$data['resources']]
]);
$resourcesForProcess = [];
foreach ($resources as $resource) {
$lock = true;
if (empty($resource['locker_user_id'] || empty($resource['locker_time']))) {
$lock = false;
} elseif ($resource['locker_user_id'] == $currentUser['id']) {
$lock = false;
} elseif (strtotime($resource['locker_time']) < time()) {
$lock = false;
}
if (!$lock) {
$resourcesForProcess[] = $resource['res_id'];
}
}
$data['resources'] = $resourcesForProcess;
$loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/visa/xml/remoteSignatoryBooks.xml']);
$errors = [];
......
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