Skip to content
Snippets Groups Projects
Verified Commit f6bdf4b7 authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #10633 TIME 0:15 change checkGiveParallelOpinion

parent c1ba0d76
No related branches found
No related tags found
No related merge requests found
......@@ -1062,16 +1062,21 @@ class PreProcessActionController
}
if (empty($resource['opinion_limit_date'])) {
return $response->withStatus(400)->withJson(['errors' => 'No opinion limit date for resource ' . $resource['alt_identifier']]);
$resourcesInformation['error'][] = ['alt_identifier' => $resource['alt_identifier'], 'res_id' => $resId, 'reason' => 'noOpinionLimiteDate'];
continue;
}
$opinionNote = NoteModel::get([
'where' => ['identifier = ?', "note_text like '[" . _TO_AVIS . "]%'"],
'data' => [$resId]
'select' => ['user_id', 'note_text'],
'where' => ['identifier = ?', "note_text like '[" . _TO_AVIS . "]%'"],
'data' => [$resId],
'order_by' => ['creation_date desc'],
'limit' => 1
]);
if (empty($opinionNote)) {
return $response->withStatus(400)->withJson(['errors' => 'No opinion note for resource ' . $resource['alt_identifier']]);
$resourcesInformation['error'][] = ['alt_identifier' => $resource['alt_identifier'], 'res_id' => $resId, 'reason' => 'noOpinionNote'];
continue;
}
$isInCircuit = ListInstanceModel::get([
......@@ -1082,7 +1087,8 @@ class PreProcessActionController
if (empty($isInCircuit)) {
$resourcesInformation['error'][] = ['alt_identifier' => $resource['alt_identifier'], 'res_id' => $resId, 'reason' => 'userNotInDiffusionList'];
} else {
$resourcesInformation['success'][] = ['alt_identifier' => $resource['alt_identifier'], 'res_id' => $resId];
$userInfo = UserModel::getLabelledUserById(['id' => $opinionNote[0]['user_id']]);
$resourcesInformation['success'][] = ['alt_identifier' => $resource['alt_identifier'], 'res_id' => $resId, 'avisUserAsk' => $userInfo, 'note' => $opinionNote[0]['note_text']];
}
}
......
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