From e139187d28b3843242010295ea808d575dc67d23 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Fri, 20 Sep 2019 17:08:38 +0100
Subject: [PATCH] FEAT #11269 TIME 0:30 data_fr indexing_model

---
 sql/data_en.sql | 23 +++++++++++++++++++----
 sql/data_fr.sql | 22 ++++++++++++++++++----
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/sql/data_en.sql b/sql/data_en.sql
index 520e835f16d..dcc59c091aa 100644
--- a/sql/data_en.sql
+++ b/sql/data_en.sql
@@ -4,16 +4,16 @@ TRUNCATE TABLE usergroups;
 TRUNCATE TABLE usergroups_services;
 DELETE FROM usergroups WHERE group_id = 'COURRIER';
 DELETE FROM usergroups_services WHERE group_id = 'COURRIER';
-INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('COURRIER', 'Scanning operator', TRUE, , '{"actions":["21"], "entities":[], "keywords":[]}');
+INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('COURRIER', 'Scanning operator', TRUE, , '{"actions":["21"], "entities":[], "keywords":["ALL_ENTITIES"]}');
 DELETE FROM usergroups WHERE group_id = 'AGENT';
 DELETE FROM usergroups_services WHERE group_id = 'AGENT';
-INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('AGENT', 'Agent', TRUE, '{"actions":["21"], "entities":[], "keywords":[]}');
+INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('AGENT', 'Agent', TRUE, '{"actions":["21"], "entities":[], "keywords":["ALL_ENTITIES"]}');
 DELETE FROM usergroups WHERE group_id = 'RESP_COURRIER';
 DELETE FROM usergroups_services WHERE group_id = 'RESP_COURRIER';
-INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('RESP_COURRIER', 'Supervisor', TRUE, '{"actions":["21"], "entities":[], "keywords":[]}');
+INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('RESP_COURRIER', 'Supervisor', TRUE, '{"actions":["21"], "entities":[], "keywords":["ALL_ENTITIES"]}');
 DELETE FROM usergroups WHERE group_id = 'RESPONSABLE';
 DELETE FROM usergroups_services WHERE group_id = 'RESPONSABLE';
-INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('RESPONSABLE', 'Manager', TRUE, '{"actions":["21"], "entities":[], "keywords":[]}');
+INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('RESPONSABLE', 'Manager', TRUE, '{"actions":["21"], "entities":[], "keywords":["ALL_ENTITIES"]}');
 DELETE FROM usergroups WHERE group_id = 'ADMINISTRATEUR_N1';
 DELETE FROM usergroups_services WHERE group_id = 'ADMINISTRATEUR_N1';
 INSERT INTO usergroups (group_id,group_desc) VALUES ('ADMINISTRATEUR_N1', 'Func. Admin n1');
@@ -1592,6 +1592,21 @@ TRUNCATE TABLE folders;
 INSERT INTO folders (label, public, user_id, parent_id, level) VALUES ('HR', FALSE, 1, 0, 0);
 INSERT INTO folders (label, public, user_id, parent_id, level) VALUES ('BUSINESS', FALSE, 1, 0, 0);
 
+TRUNCATE TABLE indexing_models;
+INSERT INTO indexing_models (id, label, "default", owner, private) VALUES (1, 'Courrier arrivée', TRUE, 23, FALSE);
+Select setval('indexing_models_id_seq', (select max(id)+1 from shipping_templates), false);
+
+TRUNCATE TABLE indexing_models_fields;
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'select', 'category_id', TRUE, '"incoming"', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'select', 'doctype', TRUE, '""', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'date', 'docDate', TRUE, '""', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'date', 'arrivalDate', TRUE, '""', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'string', 'subject', TRUE, '""', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'string', 'contact', TRUE, '""', 'contact');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'select', 'destination', TRUE, '""', 'process');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'string', 'folder', TRUE, '""', 'classement');
+
+
 --Inscrire ici les clauses de conversion spécifiques en cas de reprise
 --Update res_letterbox set status='VAL' where res_id=108;
 --Update res_letterbox set status='INIT', subject='', destination='COU', type_id=001;
diff --git a/sql/data_fr.sql b/sql/data_fr.sql
index 3e0d4993b76..7a39d5b0d00 100755
--- a/sql/data_fr.sql
+++ b/sql/data_fr.sql
@@ -4,16 +4,16 @@ TRUNCATE TABLE usergroups;
 TRUNCATE TABLE usergroups_services;
 DELETE FROM usergroups WHERE group_id = 'COURRIER';
 DELETE FROM usergroups_services WHERE group_id = 'COURRIER';
-INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('COURRIER', 'Opérateur de numérisation', TRUE, '{"actions":["21"], "entities":[], "keywords":[]}');
+INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('COURRIER', 'Opérateur de numérisation', TRUE, '{"actions":["21"], "entities":[], "keywords":["ALL_ENTITIES"]}');
 DELETE FROM usergroups WHERE group_id = 'AGENT';
 DELETE FROM usergroups_services WHERE group_id = 'AGENT';
-INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('AGENT', 'Utilisateur', TRUE, '{"actions":["21"], "entities":[], "keywords":[]}');
+INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('AGENT', 'Utilisateur', TRUE, '{"actions":["21"], "entities":[], "keywords":["ALL_ENTITIES"]}');
 DELETE FROM usergroups WHERE group_id = 'RESP_COURRIER';
 DELETE FROM usergroups_services WHERE group_id = 'RESP_COURRIER';
-INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('RESP_COURRIER', 'Superviseur Courrier', TRUE, '{"actions":["21"], "entities":[], "keywords":[]}');
+INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('RESP_COURRIER', 'Superviseur Courrier', TRUE, '{"actions":["21"], "entities":[], "keywords":["ALL_ENTITIES"]}');
 DELETE FROM usergroups WHERE group_id = 'RESPONSABLE';
 DELETE FROM usergroups_services WHERE group_id = 'RESPONSABLE';
-INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('RESPONSABLE', 'Manager', TRUE, '{"actions":["21"], "entities":[], "keywords":[]}');
+INSERT INTO usergroups (group_id,group_desc, can_index, indexation_parameters) VALUES ('RESPONSABLE', 'Manager', TRUE, '{"actions":["21"], "entities":[], "keywords":["ALL_ENTITIES"]}');
 DELETE FROM usergroups WHERE group_id = 'ADMINISTRATEUR_N1';
 DELETE FROM usergroups_services WHERE group_id = 'ADMINISTRATEUR_N1';
 INSERT INTO usergroups (group_id,group_desc) VALUES ('ADMINISTRATEUR_N1', 'Admin. Fonctionnel N1');
@@ -1807,3 +1807,17 @@ TRUNCATE TABLE folders;
 INSERT INTO folders (label, public, user_id, parent_id, level) VALUES ('RH', FALSE, 1, 0, 0);
 INSERT INTO folders (label, public, user_id, parent_id, level) VALUES ('COMMERCE', FALSE, 1, 0, 0);
 INSERT INTO folders (label, public, user_id, parent_id, level) VALUES ('CLIENTS', FALSE, 1, 2, 1);
+
+TRUNCATE TABLE indexing_models;
+INSERT INTO indexing_models (id, label, "default", owner, private) VALUES (1, 'Courrier arrivée', TRUE, 23, FALSE);
+Select setval('indexing_models_id_seq', (select max(id)+1 from shipping_templates), false);
+
+TRUNCATE TABLE indexing_models_fields;
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'select', 'category_id', TRUE, '"incoming"', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'select', 'doctype', TRUE, '""', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'date', 'docDate', TRUE, '""', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'date', 'arrivalDate', TRUE, '""', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'string', 'subject', TRUE, '""', 'mail');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'string', 'contact', TRUE, '""', 'contact');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'select', 'destination', TRUE, '""', 'process');
+INSERT INTO indexing_models_fields (model_id, type, identifier, mandatory, default_value, unit) VALUES (1, 'string', 'folder', TRUE, '""', 'classement');
-- 
GitLab