From 797b66c7c16dd3ed65bd9eeef690d678bc26d49b Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Fri, 15 Mar 2019 10:13:05 +0100 Subject: [PATCH] FEAT #9685 Redirect KeepIn --- .../class/class_business_app_tools_Abstract.php | 2 -- apps/maarch_entreprise/xml/features.xml | 2 +- modules/entities/redirect.php | 9 ++++++--- sql/data_en.sql | 2 +- sql/data_fr.sql | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php index c1df9085178..5e336f95835 100755 --- a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php +++ b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php @@ -627,7 +627,6 @@ abstract class business_app_tools_Abstract extends Database $_SESSION['features'] = array(); //Defines all features by default at 'false' $_SESSION['features']['search_notes'] = "false"; - $_SESSION['features']['dest_to_copy_during_redirection'] = "false"; $_SESSION['features']['show_types_tree'] = "false"; $_SESSION['features']['watermark'] = array(); $_SESSION['features']['watermark']['enabled'] = "false"; @@ -648,7 +647,6 @@ abstract class business_app_tools_Abstract extends Database if ($xmlfeatures) { $feats = $xmlfeatures->FEATURES; $_SESSION['features']['search_notes'] = (string) $feats->search_notes; - $_SESSION['features']['dest_to_copy_during_redirection'] = (string) $feats->dest_to_copy_during_redirection; $_SESSION['features']['show_types_tree'] = (string) $feats->show_types_tree; $watermark = $feats->watermark; $_SESSION['features']['watermark']['enabled'] = (string) $watermark->enabled; diff --git a/apps/maarch_entreprise/xml/features.xml b/apps/maarch_entreprise/xml/features.xml index 7bceb52db72..bb62a03e827 100755 --- a/apps/maarch_entreprise/xml/features.xml +++ b/apps/maarch_entreprise/xml/features.xml @@ -2,7 +2,7 @@ <ROOT> <FEATURES> <search_notes>true</search_notes> <!-- If true, activates the search on notes (warning : join in the query, must be desactivated if the search takes too much time) --> - <dest_to_copy_during_redirection>false</dest_to_copy_during_redirection> <!-- If true, the dest of the mail is automatically put in copy during redirection to another user or entity --> + <dest_to_copy_during_redirection>false</dest_to_copy_during_redirection> <!-- Deprecated : Sera supprimé dans la prochaine version. Remplacé par le paramètre keepDestForRedirection dans l'administration des paramètres --> <show_types_tree>true</show_types_tree> <!-- If true, types are displayed with their classification scheme --> <watermark> <enabled>true</enabled> <!-- If true, a watermark is applied on the document --> diff --git a/modules/entities/redirect.php b/modules/entities/redirect.php index e4505f6277d..aa852a29e39 100755 --- a/modules/entities/redirect.php +++ b/modules/entities/redirect.php @@ -424,7 +424,8 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col $new_difflist = $diffList->list_difflist_roles_to_keep($res_id, $coll_id, $new_difflist['difflist_type'], $new_difflist); // If feature activated, put old dest in copy - if ($_SESSION['features']['dest_to_copy_during_redirection'] == 'true') { + $parameter = \Parameter\models\ParameterModel::getById(['select' => ['param_value_int'], 'id' => 'keepDestForRedirection']); + if (!empty($parameter['param_value_int'])) { // Get old dest $stmt = $db->query( "select * " @@ -532,7 +533,8 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col $_SESSION['redirect']['diff_list']['dest']['users'][0]['viewed'] = $res->viewed; $newDestViewed = $res->viewed; } - if ($_SESSION['features']['dest_to_copy_during_redirection'] == 'true') { + $parameter = \Parameter\models\ParameterModel::getById(['select' => ['param_value_int'], 'id' => 'keepDestForRedirection']); + if (!empty($parameter['param_value_int'])) { $lastDestViewed = 0; // Récupère le nombre de fois où l'ancien destinataire principal a vu le document $stmt = $db->query("select viewed from ".$_SESSION['tablename']['ent_listinstance']." where coll_id = ? and res_id = ? and item_type = 'user_id' and item_mode = 'dest'", array($coll_id,$arr_id[$i])); @@ -584,7 +586,8 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col // Update dest_user in res table $stmt = $db->query("update ".$table." set dest_user = ? where res_id = ?", array($values_form[$j]['VALUE'],$arr_id[$i])); $list->set_main_dest($values_form[$j]['VALUE'], $coll_id, $arr_id[$i], 'DOC', 'user_id', $newDestViewed); - if ($_SESSION['features']['dest_to_copy_during_redirection'] == 'true') { + $parameter = \Parameter\models\ParameterModel::getById(['select' => ['param_value_int'], 'id' => 'keepDestForRedirection']); + if (!empty($parameter['param_value_int'])) { array_push($difflist['copy']['users'], array('user_id' => $_SESSION['user']['UserId'], 'lastname' => $_SESSION['user']['LastName'], 'firstname' => $_SESSION['user']['FirstName'], 'entity_id' => $_SESSION['user']['primaryentity']['id'], 'viewed' => $lastDestViewed)); } $params = array('mode'=> 'listinstance', 'table' => $_SESSION['tablename']['ent_listinstance'], 'coll_id' => $coll_id, 'res_id' => $arr_id[$i], 'user_id' => $_SESSION['user']['UserId'], 'concat_list' => true); diff --git a/sql/data_en.sql b/sql/data_en.sql index 2548b3543a7..26b63013f59 100644 --- a/sql/data_en.sql +++ b/sql/data_en.sql @@ -1033,7 +1033,7 @@ INSERT INTO parameters (id, param_value_string, param_value_int, param_value_dat INSERT INTO parameters (id, description, param_value_string, param_value_int, param_value_date) VALUES ('defaultDepartment', 'Département par défaut sélectionné dans le formulaire des adresses', NULL, 75, NULL); INSERT INTO parameters (id, description, param_value_string) VALUES ('homepage_message', 'Texte apparaissant dans la bannière sur la page d''accueil, mettre un espace pour supprimer la bannière.', 'Bienvenue dans votre <b>G</b>estion <b>E</b>lectronique du <b>C</b>ourrier.'); INSERT INTO parameters (id, description, param_value_string) VALUES ('thumbnailsSize', 'Taille des imagettes', '750x900'); -INSERT INTO parameters (id, description, param_value_int) VALUES ('keepDestForRedirection', 'If actived (1), put recipient in copy for diffusion list when redirecting', 1); +INSERT INTO parameters (id, description, param_value_int) VALUES ('keepDestForRedirection', 'If actived (1), put recipient in copy for diffusion list when redirecting', 0); ------------ --DIFFLIST_TYPES diff --git a/sql/data_fr.sql b/sql/data_fr.sql index f7951fee3b0..c26fc047c3f 100755 --- a/sql/data_fr.sql +++ b/sql/data_fr.sql @@ -1166,7 +1166,7 @@ INSERT INTO parameters (id, param_value_string, param_value_int, param_value_dat INSERT INTO parameters (id, description, param_value_string, param_value_int, param_value_date) VALUES ('defaultDepartment', 'Département par défaut sélectionné dans le formulaire des adresses', NULL, 75, NULL); INSERT INTO parameters (id, description, param_value_string) VALUES ('homepage_message', 'Texte apparaissant dans la bannière sur la page d''accueil, mettre un espace pour supprimer la bannière.', 'Bienvenue dans votre <b>G</b>estion <b>E</b>lectronique du <b>C</b>ourrier.'); INSERT INTO parameters (id, description, param_value_string) VALUES ('thumbnailsSize', 'Taille des imagettes', '750x900'); -INSERT INTO parameters (id, description, param_value_int) VALUES ('keepDestForRedirection', 'Si activé (1), mets le destinataire en copie de la liste de diffusion lors d''une action de redirection', 1); +INSERT INTO parameters (id, description, param_value_int) VALUES ('keepDestForRedirection', 'Si activé (1), mets le destinataire en copie de la liste de diffusion lors d''une action de redirection', 0); ------------ --DIFFLIST_TYPES ------------ -- GitLab