diff --git a/core/xml/actions_pages.xml b/core/xml/actions_pages.xml index 96674d06bb4feef4802e56794d900653abec4b74..ed796c23d09fc9a67d8df68446cbc0c730306141 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 a06ba197f6820c2faafdfeb77b2e9f9bc28727f3..7e1efc9554122507eaac78741ccd90d69ab9da98 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 f80d10fda67a4d3e7822e5d56853cdd6c9f9e492..3ccf1664e58f12784203049b664fc76431a0edda 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; + } }