From e7c9e1ea01730406ece2654f98a65de424a994d4 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Fri, 14 Feb 2020 11:03:11 +0100 Subject: [PATCH] FEAT #13049 TIME 0:10 created new action --- core/xml/actions_pages.xml | 13 ++++ .../controllers/ActionMethodController.php | 62 +++++++++++-------- src/core/lang/lang-en.php | 2 + src/core/lang/lang-fr.php | 2 + src/core/lang/lang-nl.php | 2 + 5 files changed, 56 insertions(+), 25 deletions(-) diff --git a/core/xml/actions_pages.xml b/core/xml/actions_pages.xml index cfa85089cca..98867d30531 100755 --- a/core/xml/actions_pages.xml +++ b/core/xml/actions_pages.xml @@ -422,4 +422,17 @@ An action page is described in a ACTIONPAGE tag : <MODULE></MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> + <ACTIONPAGE> + <ID>close_mail_with_fields</ID> + <LABEL>_CLOSE_MAIL_WITH_FIELDS</LABEL> + <NAME>close_mail_with_fields</NAME> + <DESC>_CLOSE_MAIL_WITH_FIELDS_DESC</DESC> + <component>closeWithFieldsAction</component> + <ORIGIN>apps</ORIGIN> + <MODULE></MODULE> + <FLAG_CREATE>false</FLAG_CREATE> + <COLLECTIONS> + <COLL_ID>letterbox_coll</COLL_ID> + </COLLECTIONS> + </ACTIONPAGE> </ROOT> diff --git a/src/app/action/controllers/ActionMethodController.php b/src/app/action/controllers/ActionMethodController.php index 1af85c6bd09..28e3cf7880e 100644 --- a/src/app/action/controllers/ActionMethodController.php +++ b/src/app/action/controllers/ActionMethodController.php @@ -41,32 +41,33 @@ class ActionMethodController use ExternalSignatoryBookTrait; const COMPONENTS_ACTIONS = [ - 'confirmAction' => null, - 'closeMailAction' => 'closeMailAction', - 'closeMailWithAttachmentsOrNotesAction' => 'closeMailWithAttachmentsOrNotesAction', - 'redirectAction' => 'redirect', - 'closeAndIndexAction' => 'closeAndIndexAction', - 'updateDepartureDateAction' => 'updateDepartureDateAction', - 'enabledBasketPersistenceAction' => 'enabledBasketPersistenceAction', - 'disabledBasketPersistenceAction' => 'disabledBasketPersistenceAction', - 'resMarkAsReadAction' => 'resMarkAsReadAction', - 'sendExternalSignatoryBookAction' => 'sendExternalSignatoryBookAction', - 'sendExternalNoteBookAction' => 'sendExternalNoteBookAction', - 'createAcknowledgementReceiptsAction' => 'createAcknowledgementReceipts', - 'updateAcknowledgementSendDateAction' => 'updateAcknowledgementSendDateAction', - 'sendShippingAction' => 'createMailevaShippings', - 'sendSignatureBookAction' => 'sendSignatureBook', - 'continueVisaCircuitAction' => 'continueVisaCircuit', - 'redirectInitiatorEntityAction' => 'redirectInitiatorEntityAction', - 'rejectVisaBackToPreviousAction' => 'rejectVisaBackToPrevious', - 'resetVisaAction' => 'resetVisa', - 'interruptVisaAction' => 'interruptVisa', - 'sendToParallelOpinion' => 'sendToParallelOpinion', - 'sendToOpinionCircuitAction' => 'sendToOpinionCircuit', - 'continueOpinionCircuitAction' => 'continueOpinionCircuit', - 'giveOpinionParallelAction' => 'giveOpinionParallel', + 'confirmAction' => null, + 'closeMailAction' => 'closeMailAction', + 'closeMailWithAttachmentsOrNotesAction' => 'closeMailWithAttachmentsOrNotesAction', + 'redirectAction' => 'redirect', + 'closeAndIndexAction' => 'closeAndIndexAction', + 'updateDepartureDateAction' => 'updateDepartureDateAction', + 'enabledBasketPersistenceAction' => 'enabledBasketPersistenceAction', + 'disabledBasketPersistenceAction' => 'disabledBasketPersistenceAction', + 'resMarkAsReadAction' => 'resMarkAsReadAction', + 'sendExternalSignatoryBookAction' => 'sendExternalSignatoryBookAction', + 'sendExternalNoteBookAction' => 'sendExternalNoteBookAction', + 'createAcknowledgementReceiptsAction' => 'createAcknowledgementReceipts', + 'updateAcknowledgementSendDateAction' => 'updateAcknowledgementSendDateAction', + 'sendShippingAction' => 'createMailevaShippings', + 'sendSignatureBookAction' => 'sendSignatureBook', + 'continueVisaCircuitAction' => 'continueVisaCircuit', + 'redirectInitiatorEntityAction' => 'redirectInitiatorEntityAction', + 'rejectVisaBackToPreviousAction' => 'rejectVisaBackToPrevious', + 'resetVisaAction' => 'resetVisa', + 'interruptVisaAction' => 'interruptVisa', + 'sendToParallelOpinion' => 'sendToParallelOpinion', + 'sendToOpinionCircuitAction' => 'sendToOpinionCircuit', + 'continueOpinionCircuitAction' => 'continueOpinionCircuit', + 'giveOpinionParallelAction' => 'giveOpinionParallel', 'validateParallelOpinionDiffusionAction' => 'validateParallelOpinionDiffusion', - 'noConfirmAction' => null + 'closeWithFieldsAction' => 'closeWithFields', + 'noConfirmAction' => null ]; public static function terminateAction(array $aArgs) @@ -882,4 +883,15 @@ class ActionMethodController return true; } + + public static function closeWithFields(array $args) + { + ValidatorModel::notEmpty($args, ['resId']); + ValidatorModel::intVal($args, ['resId']); + ValidatorModel::stringType($args, ['note']); + + ResModel::update(['set' => ['closing_date' => 'CURRENT_TIMESTAMP'], 'where' => ['res_id = ?', 'closing_date is null'], 'data' => [$args['resId']]]); + + return true; + } } diff --git a/src/core/lang/lang-en.php b/src/core/lang/lang-en.php index 9de1a0492cd..cbd41168e96 100755 --- a/src/core/lang/lang-en.php +++ b/src/core/lang/lang-en.php @@ -227,6 +227,8 @@ define('_NO_CONFIRM_DESC', "Perform the action without confirmation"); define('_VIEW_DOC', 'See the mail'); define('_CLOSE_MAIL', 'Close a mail'); define('_CLOSE_MAIL_DESC', 'Allows you to update the closing date of a mail. ESSENTIAL in order to complete your document workflow.'); +define('_CLOSE_MAIL_WITH_FIELDS', 'Close a mail with custom fields'); +define('_CLOSE_MAIL_WITH_FIELDS_DESC', 'Allows you to update the closing date of a mail. ESSENTIAL in order to complete your document workflow. Chosen fields will be needed to do the action.'); define('_SET_PERSISTENT_MODE_ON', 'Activate the persistence'); define('_SET_PERSISTENT_MODE_ON_DESC', 'Keeps a mail in a basket regardless of its state. Insert data in the \'basket_persistent_mode\' table.'); define('_SET_PERSISTENT_MODE_OFF', 'Deactivate the persistence'); diff --git a/src/core/lang/lang-fr.php b/src/core/lang/lang-fr.php index da47181f8bc..edae0660412 100755 --- a/src/core/lang/lang-fr.php +++ b/src/core/lang/lang-fr.php @@ -227,6 +227,8 @@ define('_NO_CONFIRM_DESC', "Effectue l'action sans confirmation"); define('_VIEW_DOC', 'Voir le courrier'); define('_CLOSE_MAIL', 'Clôturer un courrier'); define('_CLOSE_MAIL_DESC', 'Permet de mettre à jour la date de clôture d\'un courrier. ESSENTIEL afin de terminer votre workflow de courrier.'); +define('_CLOSE_MAIL_WITH_FIELDS', 'Clôturer un courrier avec des champs personnalisés'); +define('_CLOSE_MAIL_WITH_FIELDS_DESC', 'Permet de mettre à jour la date de clôture d\'un courrier. ESSENTIEL afin de terminer votre workflow de courrier. L\'action ne pourra se faire seulement si les champs choisis sont renseignés dans le courrier'); define('_SET_PERSISTENT_MODE_ON', 'Activer la persistance'); define('_SET_PERSISTENT_MODE_ON_DESC', 'Permet de conserver un courrier dans une bannette quelque soit son état. Insère la donnée dans la table \'basket_persistent_mode\'.'); define('_SET_PERSISTENT_MODE_OFF', 'Désactiver la persistance'); diff --git a/src/core/lang/lang-nl.php b/src/core/lang/lang-nl.php index 59545a6db86..4946b686dce 100755 --- a/src/core/lang/lang-nl.php +++ b/src/core/lang/lang-nl.php @@ -228,6 +228,8 @@ define('_NO_CONFIRM_DESC', "Perform the action without confirmation"); //_TO_TRA define('_VIEW_DOC', 'Het brief bekijken'); define('_CLOSE_MAIL', 'Een brief afsluiten'); define('_CLOSE_MAIL_DESC', 'Om de afsluitingsdatum van een brief bij te werken. ESSENTIEEL om uw documentworkflow af te sluiten.'); +define('_CLOSE_MAIL_WITH_FIELDS', 'Close a mail with custom fields'); //_TO_TRANSLATE +define('_CLOSE_MAIL_WITH_FIELDS_DESC', 'Allows you to update the closing date of a mail. ESSENTIAL in order to complete your document workflow. Chosen fields will be needed to do the action.'); //_TO_TRANSLATE define('_SET_PERSISTENT_MODE_ON', 'De persistentie activeren'); define('_SET_PERSISTENT_MODE_ON_DESC', 'Om een biref in een bakje te bewaren ongeacht zijn status. Voegt het gegeven in de tabel \basket_persistent_mode\.'); define('_SET_PERSISTENT_MODE_OFF', 'De persistentie uitschakelen'); -- GitLab