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

FEAT #10633 TIME 0:15 Action visa

parent 88bc92a4
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ use AcknowledgementReceipt\models\AcknowledgementReceiptModel; ...@@ -16,6 +16,7 @@ use AcknowledgementReceipt\models\AcknowledgementReceiptModel;
use Action\models\ActionModel; use Action\models\ActionModel;
use Action\models\BasketPersistenceModel; use Action\models\BasketPersistenceModel;
use Action\models\ResMarkAsReadModel; use Action\models\ResMarkAsReadModel;
use Attachment\models\AttachmentModel;
use Entity\controllers\ListInstanceController; use Entity\controllers\ListInstanceController;
use Entity\models\ListInstanceModel; use Entity\models\ListInstanceModel;
use ExternalSignatoryBook\controllers\MaarchParapheurController; use ExternalSignatoryBook\controllers\MaarchParapheurController;
...@@ -48,6 +49,7 @@ class ActionMethodController ...@@ -48,6 +49,7 @@ class ActionMethodController
'createAcknowledgementReceiptsAction' => 'createAcknowledgementReceipts', 'createAcknowledgementReceiptsAction' => 'createAcknowledgementReceipts',
'updateAcknowledgementSendDateAction' => 'updateAcknowledgementSendDateAction', 'updateAcknowledgementSendDateAction' => 'updateAcknowledgementSendDateAction',
'sendShippingAction' => 'createMailevaShippings', 'sendShippingAction' => 'createMailevaShippings',
'sendSignatureBookAction' => 'sendSignatureBook',
'noConfirmAction' => null 'noConfirmAction' => null
]; ];
...@@ -253,8 +255,6 @@ class ActionMethodController ...@@ -253,8 +255,6 @@ class ActionMethodController
ValidatorModel::intVal($args, ['resId']); ValidatorModel::intVal($args, ['resId']);
ValidatorModel::arrayType($args, ['data']); ValidatorModel::arrayType($args, ['data']);
$currentUser = UserModel::getByLogin(['login' => $GLOBALS['userId'], 'select' => ['id']]);
$listInstances = []; $listInstances = [];
if (!empty($args['data']['onlyRedirectDest'])) { if (!empty($args['data']['onlyRedirectDest'])) {
if (count($args['data']['listInstances']) == 1) { if (count($args['data']['listInstances']) == 1) {
...@@ -263,7 +263,7 @@ class ActionMethodController ...@@ -263,7 +263,7 @@ class ActionMethodController
} }
$listInstances = array_merge($listInstances, $args['data']['listInstances']); $listInstances = array_merge($listInstances, $args['data']['listInstances']);
$controller = ListInstanceController::updateListInstance(['data' => [['resId' => $args['resId'], 'listInstances' => $listInstances]], 'userId' => $currentUser['id']]); $controller = ListInstanceController::updateListInstance(['data' => [['resId' => $args['resId'], 'listInstances' => $listInstances]], 'userId' => $GLOBALS['id']]);
if (!empty($controller['errors'])) { if (!empty($controller['errors'])) {
return ['errors' => [$controller['errors']]]; return ['errors' => [$controller['errors']]];
} }
...@@ -271,6 +271,31 @@ class ActionMethodController ...@@ -271,6 +271,31 @@ class ActionMethodController
return true; return true;
} }
public function sendSignatureBook(array $args)
{
ValidatorModel::notEmpty($args, ['resId']);
ValidatorModel::intVal($args, ['resId']);
$signableAttachmentsTypes = [];
$attachmentsTypes = AttachmentModel::getAttachmentsTypesByXML();
foreach ($attachmentsTypes as $key => $type) {
if ($type['sign']) {
$signableAttachmentsTypes[] = $key;
}
}
$attachments = AttachmentModel::get([
'select' => [1],
'where' => ['res_id_master = ?', 'attachment_type in (?)', 'in_signature_book = ?', 'status not in (?)'],
'data' => [$args['resId'], $signableAttachmentsTypes, true, ['OBS', 'DEL', 'FRZ']]
]);
if (empty($attachments)) {
return ['errors' => ['No available attachments']];
}
return true;
}
public static function sendExternalNoteBookAction(array $args) public static function sendExternalNoteBookAction(array $args)
{ {
ValidatorModel::notEmpty($args, ['resId']); ValidatorModel::notEmpty($args, ['resId']);
......
...@@ -834,8 +834,7 @@ class PreProcessActionController ...@@ -834,8 +834,7 @@ class PreProcessActionController
$attachments = AttachmentModel::get([ $attachments = AttachmentModel::get([
'select' => [1], 'select' => [1],
'where' => ['res_id_master = ?', 'attachment_type in (?)', 'in_signature_book = ?', 'status not in (?)'], 'where' => ['res_id_master = ?', 'attachment_type in (?)', 'in_signature_book = ?', 'status not in (?)'],
'data' => [$resId, $signableAttachmentsTypes, true, ['OBS', 'DEL', 'FRZ']], 'data' => [$resId, $signableAttachmentsTypes, true, ['OBS', 'DEL', 'FRZ']]
'groupBy' => ['res_id_master']
]); ]);
if (empty($attachments)) { if (empty($attachments)) {
......
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