From 2c591846563c03a7bdd5f1dbd506e232a9d3680a Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Wed, 15 Jan 2020 11:30:42 +0100 Subject: [PATCH] FEAT #10633 TIME 2:00 send to avis action --- core/xml/actions_pages.xml | 2 +- migration/20.03/2003.sql | 1 + .../controllers/ActionMethodController.php | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/core/xml/actions_pages.xml b/core/xml/actions_pages.xml index 96674d06bb4..ed796c23d09 100755 --- a/core/xml/actions_pages.xml +++ b/core/xml/actions_pages.xml @@ -359,7 +359,7 @@ An action page is described in a ACTIONPAGE tag : <LABEL>_SEND_TO_AVIS_WF</LABEL> <NAME>send_to_avis</NAME> <DESC>_SEND_TO_AVIS_WF_DESC</DESC> - <component>v1Action</component> + <component>sendToAvisAction</component> <ORIGIN>module</ORIGIN> <MODULE>avis</MODULE> <FLAG_CREATE>false</FLAG_CREATE> diff --git a/migration/20.03/2003.sql b/migration/20.03/2003.sql index a06ba197f68..7e1efc95541 100644 --- a/migration/20.03/2003.sql +++ b/migration/20.03/2003.sql @@ -92,6 +92,7 @@ UPDATE actions SET component = 'rejectVisaBackToRedactorAction' WHERE action_pag UPDATE actions SET component = 'interruptVisaAction' WHERE action_page = 'interrupt_visa'; UPDATE actions SET component = 'sendSignatureBookAction' WHERE action_page IN ('send_to_visa', 'send_signed_docs'); UPDATE actions SET component = 'continueVisaCircuitAction' WHERE action_page = 'visa_workflow'; +UPDATE actions SET component = 'sendToAvisAction' WHERE action_page = 'send_to_avis'; /* FOLDERS */ DO $$ BEGIN diff --git a/src/app/action/controllers/ActionMethodController.php b/src/app/action/controllers/ActionMethodController.php index f80d10fda67..3ccf1664e58 100644 --- a/src/app/action/controllers/ActionMethodController.php +++ b/src/app/action/controllers/ActionMethodController.php @@ -58,6 +58,7 @@ class ActionMethodController 'rejectVisaBackToPreviousAction' => 'rejectVisaBackToPrevious', 'rejectVisaBackToRedactorAction' => 'rejectVisaBackToRedactor', 'interruptVisaAction' => 'interruptVisa', + 'sendToAvisAction' => 'sendToAvis', 'noConfirmAction' => null ]; @@ -508,4 +509,22 @@ class ActionMethodController return true; } + + public static function sendToAvis(array $args) + { + ValidatorModel::notEmpty($args, ['resId']); + ValidatorModel::intVal($args, ['resId']); + + $listinstances = ListInstanceModel::get([ + 'select' => [1], + 'where' => ['res_id = ?', 'difflist_type = ?'], + 'data' => [$args['resId'], 'AVIS_CIRCUIT'] + ]); + + if (empty($listinstances)) { + return ['errors' => ['No available opinion workflow']]; + } + + return true; + } } -- GitLab