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

FEAT #13596 TIME 1:00 get informations by chrono

parent c0b6a43b
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,7 @@ $app->put('/attachments/{id}/inSignatureBook', \Attachment\controllers\Attachmen ...@@ -83,6 +83,7 @@ $app->put('/attachments/{id}/inSignatureBook', \Attachment\controllers\Attachmen
$app->put('/attachments/{id}/sign', \SignatureBook\controllers\SignatureBookController::class . ':signAttachment'); $app->put('/attachments/{id}/sign', \SignatureBook\controllers\SignatureBookController::class . ':signAttachment');
$app->put('/attachments/{id}/unsign', \SignatureBook\controllers\SignatureBookController::class . ':unsignAttachment'); $app->put('/attachments/{id}/unsign', \SignatureBook\controllers\SignatureBookController::class . ':unsignAttachment');
$app->post('/attachments/{id}/mailing', \Attachment\controllers\AttachmentController::class . ':getMailingById'); $app->post('/attachments/{id}/mailing', \Attachment\controllers\AttachmentController::class . ':getMailingById');
$app->get('/attachmentsInformations', \Attachment\controllers\AttachmentController::class . ':getByChrono');
$app->get('/attachmentsTypes', \Attachment\controllers\AttachmentController::class . ':getAttachmentsTypes'); $app->get('/attachmentsTypes', \Attachment\controllers\AttachmentController::class . ':getAttachmentsTypes');
//AutoComplete //AutoComplete
......
...@@ -563,6 +563,30 @@ class AttachmentController ...@@ -563,6 +563,30 @@ class AttachmentController
return $response->withHeader('Content-Type', $mimeType); return $response->withHeader('Content-Type', $mimeType);
} }
public function getByChrono(Request $request, Response $response, array $args)
{
$queryParams = $request->getQueryParams();
if (empty($queryParams['chrono'])) {
return $response->withStatus(403)->withJson(['errors' => 'Query chrono is not set']);
}
$attachment = AttachmentModel::get([
'select' => ['res_id as "resId"', 'res_id_master as "resIdMaster"', 'status', 'title'],
'where' => ['identifier = ?'],
'data' => [$queryParams['chrono']]
]);
if (empty($attachment) || in_array($attachment[0]['status'], ['DEL', 'OBS'])) {
return $response->withStatus(400)->withJson(['errors' => 'Attachment does not exist']);
}
$attachment = $attachment[0];
if (!ResController::hasRightByResId(['resId' => [$attachment['resIdMaster']], 'userId' => $GLOBALS['id']])) {
return $response->withStatus(400)->withJson(['errors' => 'Attachment out of perimeter']);
}
return $response->withJson($attachment);
}
public function getAttachmentsTypes(Request $request, Response $response) public function getAttachmentsTypes(Request $request, Response $response)
{ {
$attachmentsTypes = AttachmentModel::getAttachmentsTypesByXML(); $attachmentsTypes = AttachmentModel::getAttachmentsTypesByXML();
......
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