From 28f7015adadfa07af67c80406f5f6f0d278ca190 Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Thu, 11 Apr 2019 11:26:10 +0200
Subject: [PATCH] prepare notif and sendmail config

---
 .../batch/config/config.xml.default           | 28 +++++------
 .../notifications/batch/scripts/BASKETS.sh    |  4 ++
 .../batch/scripts/nct-ncc-and-anc.sh          | 12 ++---
 .../notifications/batch/scripts/ret1-ret2.sh  | 12 ++---
 .../notifications/batch/scripts/sendmail.sh   |  6 +--
 sql/data_fr.sql                               | 50 ++++++++++---------
 6 files changed, 59 insertions(+), 53 deletions(-)
 create mode 100644 modules/notifications/batch/scripts/BASKETS.sh

diff --git a/modules/notifications/batch/config/config.xml.default b/modules/notifications/batch/config/config.xml.default
index f2539eb5790..1903a779d39 100755
--- a/modules/notifications/batch/config/config.xml.default
+++ b/modules/notifications/batch/config/config.xml.default
@@ -3,11 +3,11 @@
 <!-- le nom du fichier doit etre config.xml ou config_{custom_id}.xml -->
     <CONFIG>
         <Lang>fr</Lang> <!-- fr, en-->
-        <MaarchDirectory>/var/www/MaarchCourrier/</MaarchDirectory>
+        <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory>
         <customID></customID>
-        <MaarchUrl>http://localhost/maarch/</MaarchUrl>
+        <MaarchUrl>http://preview.maarchcourrier.com</MaarchUrl>
         <MaarchApps>maarch_entreprise</MaarchApps>
-        <TmpDirectory>/var/www/MaarchCourrier/modules/notifications/batch/tmp/</TmpDirectory>
+        <TmpDirectory>/var/www/html/MaarchCourrier/modules/notifications/batch/tmp/</TmpDirectory>
         <debugmode>
             <dontflag_mail>true</dontflag_mail>
             <verbose_mode>false</verbose_mode>
@@ -21,14 +21,14 @@
         <Table>res_letterbox</Table>
         <View>res_view_letterbox</View>
         <Adr>adr_letterbox</Adr>
-		<DoctypeExt>mlb_doctype_ext</DoctypeExt>
-		<Extension>mlb_coll_ext</Extension>
+        <DoctypeExt>mlb_doctype_ext</DoctypeExt>
+        <Extension>mlb_coll_ext</Extension>
     </COLLECTION>
     <CONFIG_BASE>
         <databaseserver>127.0.0.1</databaseserver>
         <databaseserverport>5432</databaseserverport>
         <databasetype>POSTGRESQL</databasetype>
-        <databasename>maarchcourrier</databasename>
+        <databasename>MaarchCourrier</databasename>
         <databaseuser>maarch</databaseuser>
         <databasepassword>maarch</databasepassword>
     </CONFIG_BASE>
@@ -36,21 +36,21 @@
         <path_to_mailer>/apps/maarch_entreprise/tools/mails/htmlMimeMail.php</path_to_mailer>
         <path_to_phpmailer>PHPMailer_v5.1</path_to_phpmailer>
         <type>smtp</type><!-- mail (default), smtp, sendmail, qmail -->
-        <smtp_host>smtp.yourdomain.com</smtp_host><!-- smtp1.example.com:25;smtp2.example.com -->
-        <smtp_port>25</smtp_port><!-- smtp1.example.com:25;smtp2.example.com -->
-        <smtp_user>notif@yourdomain.com</smtp_user>
-        <smtp_password></smtp_password>
-		<smtp_auth>true</smtp_auth>
-        <smtp_secure>tls</smtp_secure><!-- tls ou ssl -->
+        <smtp_host>smtp.gmail.com</smtp_host><!-- smtp1.example.com:25;smtp2.example.com -->
+        <smtp_port>465</smtp_port><!-- smtp1.example.com:25;smtp2.example.com -->
+        <smtp_user>notifications.maarch@gmail.com</smtp_user>
+        <smtp_password>$Maarch1234*</smtp_password>
+        <smtp_auth>true</smtp_auth>
+        <smtp_secure>ssl</smtp_secure><!-- tls ou ssl -->
         <charset>utf-8</charset><!-- Default : iso-8859-1 -->
         <domains></domains><!-- Rewrite Recipient with config->adminmail if mailfrom and mailto is out of the domains -->
         <x-mailer></x-mailer><!-- Rewrite X-Mailer header,  default : PHP/[phpversion] -->
-        <mailfrom>notifications@maarch.fr</mailfrom>
+        <mailfrom>notifications.maarch@gmail.com</mailfrom>
     </MAILER>
     <LOG4PHP>
         <enabled>true</enabled>
         <Log4PhpLogger>loggerTechnique</Log4PhpLogger>
         <Log4PhpBusinessCode>notifications</Log4PhpBusinessCode>
-        <Log4PhpConfigPath>/var/www/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath>
+        <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath>
     </LOG4PHP>
 </ROOT>
diff --git a/modules/notifications/batch/scripts/BASKETS.sh b/modules/notifications/batch/scripts/BASKETS.sh
new file mode 100644
index 00000000000..606287e7330
--- /dev/null
+++ b/modules/notifications/batch/scripts/BASKETS.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+eventStackPath='/var/www/html/MaarchCourrier/modules/notifications/batch/basket_event_stack.php'
+cd /var/www/html/MaarchCourrier/modules/notifications/batch/
+php $eventStackPath -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml -n BASKETS
\ No newline at end of file
diff --git a/modules/notifications/batch/scripts/nct-ncc-and-anc.sh b/modules/notifications/batch/scripts/nct-ncc-and-anc.sh
index 3f0cd1af9b6..b9e0702a06d 100755
--- a/modules/notifications/batch/scripts/nct-ncc-and-anc.sh
+++ b/modules/notifications/batch/scripts/nct-ncc-and-anc.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
-eventStackPath='/var/www/MaarchCourrier/modules/notifications/batch/process_event_stack.php'
-cd /var/www/MaarchCourrier/modules/notifications/batch/
-php $eventStackPath -c /var/www/MaarchCourrier/modules/notifications/batch/config/config.xml -n NCC
-php $eventStackPath -c /var/www/MaarchCourrier/modules/notifications/batch/config/config.xml -n ANC
-php $eventStackPath -c /var/www/MaarchCourrier/modules/notifications/batch/config/config.xml -n AND
-php $eventStackPath -c /var/www/MaarchCourrier/modules/notifications/batch/config/config.xml -n RED
+eventStackPath='/var/www/html/MaarchCourrier/modules/notifications/batch/process_event_stack.php'
+cd /var/www/html/MaarchCourrier/modules/notifications/batch/
+php $eventStackPath -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml -n NCC
+php $eventStackPath -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml -n ANC
+php $eventStackPath -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml -n AND
+php $eventStackPath -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml -n RED
diff --git a/modules/notifications/batch/scripts/ret1-ret2.sh b/modules/notifications/batch/scripts/ret1-ret2.sh
index 23190c2fb20..f9bc42ffcd0 100755
--- a/modules/notifications/batch/scripts/ret1-ret2.sh
+++ b/modules/notifications/batch/scripts/ret1-ret2.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
-mlbStackPath='/var/www/MaarchCourrier/modules/notifications/batch/stack_letterbox_alerts.php'
-eventStackPath='/var/www/MaarchCourrier/modules/notifications/batch/process_event_stack.php'
-cd  /var/www/MaarchCourrier/modules/notifications/batch/
-php $mlbStackPath   -c /var/www/MaarchCourrier/modules/notifications/batch/config/config.xml 
-php $eventStackPath -c /var/www/MaarchCourrier/modules/notifications/batch/config/config.xml -n RET1
-php $eventStackPath -c /var/www/MaarchCourrier/modules/notifications/batch/config/config.xml -n RET2
+mlbStackPath='/var/www/html/MaarchCourrier/modules/notifications/batch/stack_letterbox_alerts.php'
+eventStackPath='/var/www/html/MaarchCourrier/modules/notifications/batch/process_event_stack.php'
+cd  /var/www/html/MaarchCourrier/modules/notifications/batch/
+php $mlbStackPath   -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml 
+php $eventStackPath -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml -n RET1
+php $eventStackPath -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml -n RET2
diff --git a/modules/notifications/batch/scripts/sendmail.sh b/modules/notifications/batch/scripts/sendmail.sh
index b5500e3b29b..d3771b1f0bc 100755
--- a/modules/notifications/batch/scripts/sendmail.sh
+++ b/modules/notifications/batch/scripts/sendmail.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
-cd /var/www/MaarchCourrier/modules/notifications/batch/
-emailStackPath='/var/www/MaarchCourrier/modules/notifications/batch/process_email_stack.php'
-php $emailStackPath -c /var/www/MaarchCourrier/modules/notifications/batch/config/config.xml
+cd /var/www/html/MaarchCourrier/modules/notifications/batch/
+emailStackPath='/var/www/html/MaarchCourrier/modules/notifications/batch/process_email_stack.php'
+php $emailStackPath -c /var/www/html/MaarchCourrier/modules/notifications/batch/config/config.xml
 
diff --git a/sql/data_fr.sql b/sql/data_fr.sql
index c68225c9e38..b96d99e3fbb 100755
--- a/sql/data_fr.sql
+++ b/sql/data_fr.sql
@@ -812,95 +812,95 @@ ALTER SEQUENCE baskets_id_seq RESTART WITH 1;
 DELETE FROM baskets WHERE basket_id = 'QualificationBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'QualificationBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'QualificationBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('QualificationBasket', 'Courriers à qualifier', 'Bannette de qualification', 'status=''INIT''', 'letterbox_coll', 'Y', 'Y',10);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('QualificationBasket', 'Courriers à qualifier', 'Bannette de qualification', 'status=''INIT''', 'letterbox_coll', 'Y', 'N', 'Y',10);
 DELETE FROM baskets WHERE basket_id = 'IndexingBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'IndexingBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'IndexingBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('IndexingBasket', 'Courriers à indexer', 'Bannette d''indexation', ' ', 'letterbox_coll', 'Y', 'Y',20);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('IndexingBasket', 'Courriers à indexer', 'Bannette d''indexation', ' ', 'letterbox_coll', 'Y', 'N', 'Y',20);
 DELETE FROM baskets WHERE basket_id = 'CopyMailBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'CopyMailBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'CopyMailBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('CopyMailBasket', 'Courriers en copie', 'Courriers en copie non clos ou sans suite', '(res_id in (select res_id from listinstance WHERE coll_id = ''letterbox_coll'' and item_type = ''user_id'' and item_id = @user and item_mode = ''cc'') or res_id in (select res_id from listinstance WHERE coll_id = ''letterbox_coll'' and item_type = ''entity_id'' and item_mode = ''cc'' and item_id in (@my_entities))) and status not in ( ''DEL'', ''END'', ''SSUITE'') and res_id not in (select res_id from res_mark_as_read WHERE user_id = @user)', 'letterbox_coll', 'Y', 'Y',30);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('CopyMailBasket', 'Courriers en copie', 'Courriers en copie non clos ou sans suite', '(res_id in (select res_id from listinstance WHERE coll_id = ''letterbox_coll'' and item_type = ''user_id'' and item_id = @user and item_mode = ''cc'') or res_id in (select res_id from listinstance WHERE coll_id = ''letterbox_coll'' and item_type = ''entity_id'' and item_mode = ''cc'' and item_id in (@my_entities))) and status not in ( ''DEL'', ''END'', ''SSUITE'') and res_id not in (select res_id from res_mark_as_read WHERE user_id = @user)', 'letterbox_coll', 'Y', 'N', 'Y',30);
 DELETE FROM baskets WHERE basket_id = 'RetourCourrier';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'RetourCourrier';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'RetourCourrier';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('RetourCourrier', 'Retours Courrier', 'Courriers retournés au service Courrier', 'STATUS=''RET''', 'letterbox_coll', 'Y', 'Y',40);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('RetourCourrier', 'Retours Courrier', 'Courriers retournés au service Courrier', 'STATUS=''RET''', 'letterbox_coll', 'Y', 'N', 'Y',40);
 DELETE FROM baskets WHERE basket_id = 'DdeAvisBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'DdeAvisBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'DdeAvisBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('DdeAvisBasket', 'Avis : Avis à émettre', 'Courriers nécessitant un avis', 'status = ''EAVIS'' AND res_id IN (SELECT res_id FROM listinstance WHERE coll_id = ''letterbox_coll'' AND item_type = ''user_id'' AND item_id = @user AND item_mode = ''avis'' and process_date is NULL)', 'letterbox_coll', 'Y', 'Y',50);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('DdeAvisBasket', 'Avis : Avis à émettre', 'Courriers nécessitant un avis', 'status = ''EAVIS'' AND res_id IN (SELECT res_id FROM listinstance WHERE coll_id = ''letterbox_coll'' AND item_type = ''user_id'' AND item_id = @user AND item_mode = ''avis'' and process_date is NULL)', 'letterbox_coll', 'Y', 'N', 'Y',50);
 DELETE FROM baskets WHERE basket_id = 'SupAvisBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'SupAvisBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'SupAvisBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('SupAvisBasket', 'Avis : En attente de réponse', 'Courriers en attente d''avis', 'status=''EAVIS'' and ((DEST_USER = @user) OR (DEST_USER IN (select user_id from users_entities WHERE entity_id IN( @my_entities)) or DESTINATION in (@subentities[@my_entities]))) and res_id NOT IN (SELECT res_id FROM listinstance WHERE item_mode = ''avis'' and difflist_type = ''entity_id'' and process_date is not NULL and res_view_letterbox.res_id = res_id group by res_id) AND res_id IN (SELECT res_id FROM listinstance WHERE item_mode = ''avis'' and difflist_type = ''entity_id'' and process_date is NULL and res_view_letterbox.res_id = res_id group by res_id)', 'letterbox_coll', 'Y', 'Y',60);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('SupAvisBasket', 'Avis : En attente de réponse', 'Courriers en attente d''avis', 'status=''EAVIS'' and ((DEST_USER = @user) OR (DEST_USER IN (select user_id from users_entities WHERE entity_id IN( @my_entities)) or DESTINATION in (@subentities[@my_entities]))) and res_id NOT IN (SELECT res_id FROM listinstance WHERE item_mode = ''avis'' and difflist_type = ''entity_id'' and process_date is not NULL and res_view_letterbox.res_id = res_id group by res_id) AND res_id IN (SELECT res_id FROM listinstance WHERE item_mode = ''avis'' and difflist_type = ''entity_id'' and process_date is NULL and res_view_letterbox.res_id = res_id group by res_id)', 'letterbox_coll', 'Y', 'N', 'Y',60);
 DELETE FROM baskets WHERE basket_id = 'RetAvisBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'RetAvisBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'RetAvisBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('RetAvisBasket', 'Avis : Retours partiels', 'Courriers avec avis reçus', 'status=''EAVIS'' and ((DEST_USER = @user) OR (DEST_USER IN (select user_id from users_entities WHERE entity_id IN( @my_entities)) or DESTINATION in (@subentities[@my_entities]))) and res_id IN (SELECT res_id FROM listinstance WHERE item_mode = ''avis'' and difflist_type = ''entity_id'' and process_date is not NULL and res_view_letterbox.res_id = res_id group by res_id)', 'letterbox_coll', 'Y', 'Y',70);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('RetAvisBasket', 'Avis : Retours partiels', 'Courriers avec avis reçus', 'status=''EAVIS'' and ((DEST_USER = @user) OR (DEST_USER IN (select user_id from users_entities WHERE entity_id IN( @my_entities)) or DESTINATION in (@subentities[@my_entities]))) and res_id IN (SELECT res_id FROM listinstance WHERE item_mode = ''avis'' and difflist_type = ''entity_id'' and process_date is not NULL and res_view_letterbox.res_id = res_id group by res_id)', 'letterbox_coll', 'Y', 'N', 'Y',70);
 DELETE FROM baskets WHERE basket_id = 'ValidationBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'ValidationBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'ValidationBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('ValidationBasket', 'Attributions à vérifier', 'Courriers signalés en attente d''instruction pour les services', 'status=''VAL''', 'letterbox_coll', 'Y', 'Y',80);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('ValidationBasket', 'Attributions à vérifier', 'Courriers signalés en attente d''instruction pour les services', 'status=''VAL''', 'letterbox_coll', 'Y', 'N', 'Y',80);
 DELETE FROM baskets WHERE basket_id = 'InValidationBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'InValidationBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'InValidationBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('InValidationBasket', 'Courriers signalés en attente d''instruction', 'Courriers signalés en attente d''instruction par le responsable', 'destination in (@my_entities, @subentities[@my_entities]) and status=''VAL''', 'letterbox_coll', 'Y', 'Y',90);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('InValidationBasket', 'Courriers signalés en attente d''instruction', 'Courriers signalés en attente d''instruction par le responsable', 'destination in (@my_entities, @subentities[@my_entities]) and status=''VAL''', 'letterbox_coll', 'Y', 'N', 'Y',90);
 DELETE FROM baskets WHERE basket_id = 'MyBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'MyBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'MyBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('MyBasket', 'Courriers à traiter', 'Bannette de traitement', 'status in (''NEW'', ''COU'', ''STDBY'', ''ENVDONE'') and dest_user = @user', 'letterbox_coll', 'Y', 'Y',100);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('MyBasket', 'Courriers à traiter', 'Bannette de traitement', 'status in (''NEW'', ''COU'', ''STDBY'', ''ENVDONE'') and dest_user = @user', 'letterbox_coll', 'Y', 'Y', 'Y',100);
 DELETE FROM baskets WHERE basket_id = 'LateMailBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'LateMailBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'LateMailBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('LateMailBasket', 'Courriers en retard', 'Courriers en retard', 'destination in (@my_entities, @subentities[@my_primary_entity]) and (status <> ''DEL'' AND status <> ''REP'') and (now() > process_limit_date)', 'letterbox_coll', 'Y', 'Y',110);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('LateMailBasket', 'Courriers en retard', 'Courriers en retard', 'destination in (@my_entities, @subentities[@my_primary_entity]) and (status <> ''DEL'' AND status <> ''REP'') and (now() > process_limit_date)', 'letterbox_coll', 'Y', 'N', 'Y',110);
 DELETE FROM baskets WHERE basket_id = 'DepartmentBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'DepartmentBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'DepartmentBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('DepartmentBasket', 'Courriers de ma direction', 'Bannette de supervision', 'destination in (@my_entities, @subentities[@my_primary_entity]) and (status <> ''DEL'' AND status <> ''REP'' and status <> ''VAL'')', 'letterbox_coll', 'Y', 'Y',120);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('DepartmentBasket', 'Courriers de ma direction', 'Bannette de supervision', 'destination in (@my_entities, @subentities[@my_primary_entity]) and (status <> ''DEL'' AND status <> ''REP'' and status <> ''VAL'')', 'letterbox_coll', 'Y', 'N', 'Y',120);
 DELETE FROM baskets WHERE basket_id = 'ParafBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'ParafBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'ParafBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('ParafBasket', 'Parapheur électronique', 'Courriers à viser ou signer dans mon parapheur', 'status in (''ESIG'', ''EVIS'') AND ((res_id, @user) IN (SELECT res_id, item_id FROM listinstance WHERE difflist_type = ''VISA_CIRCUIT'' and process_date ISNULL and res_view_letterbox.res_id = res_id order by listinstance_id asc limit 1))', 'letterbox_coll', 'Y', 'Y',130);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('ParafBasket', 'Parapheur électronique', 'Courriers à viser ou signer dans mon parapheur', 'status in (''ESIG'', ''EVIS'') AND ((res_id, @user) IN (SELECT res_id, item_id FROM listinstance WHERE difflist_type = ''VISA_CIRCUIT'' and process_date ISNULL and res_view_letterbox.res_id = res_id order by listinstance_id asc limit 1))', 'letterbox_coll', 'Y', 'N', 'Y',130);
 DELETE FROM baskets WHERE basket_id = 'SuiviParafBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'SuiviParafBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'SuiviParafBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('SuiviParafBasket', 'Courriers en circuit de visa/signature', 'Courriers en circulation dans les parapheurs électroniques', 'status in (''ESIG'', ''EVIS'') AND dest_user = @user', 'letterbox_coll', 'Y', 'Y',140);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('SuiviParafBasket', 'Courriers en circuit de visa/signature', 'Courriers en circulation dans les parapheurs électroniques', 'status in (''ESIG'', ''EVIS'') AND dest_user = @user', 'letterbox_coll', 'Y', 'N', 'Y',140);
 DELETE FROM baskets WHERE basket_id = 'EsigARBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'EsigARBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'EsigARBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('EsigARBasket', 'AR à e-signer', 'AR à e-signer', 'status=''ESIGAR'' and (res_id,@user) IN (SELECT res_id, item_id FROM listinstance WHERE item_mode = ''sign'' and process_date ISNULL and res_view_letterbox.res_id = res_id order by listinstance_id asc limit 1)', 'letterbox_coll', 'Y', 'Y',150);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('EsigARBasket', 'AR à e-signer', 'AR à e-signer', 'status=''ESIGAR'' and (res_id,@user) IN (SELECT res_id, item_id FROM listinstance WHERE item_mode = ''sign'' and process_date ISNULL and res_view_letterbox.res_id = res_id order by listinstance_id asc limit 1)', 'letterbox_coll', 'Y', 'N', 'Y',150);
 DELETE FROM baskets WHERE basket_id = 'EenvBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'EenvBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'EenvBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('EenvBasket', 'Courriers à envoyer', 'Courriers visés/signés prêts à être envoyés', 'status=''EENV'' and dest_user = @user', 'letterbox_coll', 'Y', 'Y',160);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('EenvBasket', 'Courriers à envoyer', 'Courriers visés/signés prêts à être envoyés', 'status=''EENV'' and dest_user = @user', 'letterbox_coll', 'Y', 'N', 'Y',160);
 DELETE FROM baskets WHERE basket_id = 'EenvARBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'EenvARBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'EenvARBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('EenvARBasket', 'AR à e-envoyer', 'AR à e-envoyer', 'status=''EENVAR'' and dest_user = @user', 'letterbox_coll', 'Y', 'Y',170);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('EenvARBasket', 'AR à e-envoyer', 'AR à e-envoyer', 'status=''EENVAR'' and dest_user = @user', 'letterbox_coll', 'Y', 'N', 'Y',170);
 DELETE FROM baskets WHERE basket_id = 'ToArcBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'ToArcBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'ToArcBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('ToArcBasket', 'Courriers à archiver', 'Courriers arrivés en fin de DUC à envoyer en archive intermédiaire', 'status = ''EXP_SEDA'' OR status = ''END'' OR status = ''SEND_SEDA''', 'letterbox_coll', 'Y', 'Y',180);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('ToArcBasket', 'Courriers à archiver', 'Courriers arrivés en fin de DUC à envoyer en archive intermédiaire', 'status = ''EXP_SEDA'' OR status = ''END'' OR status = ''SEND_SEDA''', 'letterbox_coll', 'Y', 'N', 'Y',180);
 DELETE FROM baskets WHERE basket_id = 'SentArcBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'SentArcBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'SentArcBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('SentArcBasket', 'Courriers en cours d''archivage', 'Courriers envoyés au SAE, en attente de réponse de transfert', 'status=''ACK_SEDA''', 'letterbox_coll', 'Y', 'Y',190);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('SentArcBasket', 'Courriers en cours d''archivage', 'Courriers envoyés au SAE, en attente de réponse de transfert', 'status=''ACK_SEDA''', 'letterbox_coll', 'Y', 'N', 'Y',190);
 DELETE FROM baskets WHERE basket_id = 'AckArcBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'AckArcBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'AckArcBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('AckArcBasket', 'Courriers archivés', 'Courriers archivés et acceptés dans le SAE', 'status=''REPLY_SEDA''', 'letterbox_coll', 'Y', 'Y',200);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('AckArcBasket', 'Courriers archivés', 'Courriers archivés et acceptés dans le SAE', 'status=''REPLY_SEDA''', 'letterbox_coll', 'Y', 'N', 'Y',200);
 DELETE FROM baskets WHERE basket_id = 'ReconcilBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'ReconcilBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'ReconcilBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('ReconcilBasket', 'Réponses à réconcilier', 'Réponses à réconcilier', 'status=''PJQUAL''', 'letterbox_coll', 'Y', 'Y',210);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('ReconcilBasket', 'Réponses à réconcilier', 'Réponses à réconcilier', 'status=''PJQUAL''', 'letterbox_coll', 'Y', 'N', 'Y',210);
 DELETE FROM baskets WHERE basket_id = 'NumericBasket';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'NumericBasket';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'NumericBasket';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('NumericBasket', 'Plis numériques à qualifier', 'Plis numériques à qualifier', 'status = ''NUMQUAL''', 'letterbox_coll', 'Y', 'Y',220);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('NumericBasket', 'Plis numériques à qualifier', 'Plis numériques à qualifier', 'status = ''NUMQUAL''', 'letterbox_coll', 'Y', 'N', 'Y',220);
 DELETE FROM baskets WHERE basket_id = 'SendToSignatoryBook';
 DELETE FROM actions_groupbaskets WHERE basket_id = 'SendToSignatoryBook';
 DELETE FROM groupbasket_redirect WHERE basket_id = 'SendToSignatoryBook';
-INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, enabled, basket_order) VALUES ('SendToSignatoryBook', 'Envoyé au parapheur Maarch', 'Envoyé au parapheur Maarch', 'status = ''VALDGS''', 'letterbox_coll', 'Y', 'Y',230);
+INSERT INTO baskets (basket_id, basket_name, basket_desc, basket_clause, coll_id, is_visible, flag_notif, enabled, basket_order) VALUES ('SendToSignatoryBook', 'Envoyé au parapheur Maarch', 'Envoyé au parapheur Maarch', 'status = ''VALDGS''', 'letterbox_coll', 'Y', 'Y', 'Y',230);
 
 -- Create GROUPBASKET
 TRUNCATE TABLE groupbasket;
@@ -1888,4 +1888,6 @@ INSERT INTO contacts_filling (enable, rating_columns, first_threshold, second_th
 
 /* Configurations */
 TRUNCATE TABLE configurations;
-INSERT INTO configurations (service, value) VALUES ('admin_email_server', '{"type" : "smtp", "host" : "smtp.gmail.com", "port" : 465, "user" : "", "password" : "", "auth" : true, "secure" : "ssl", "from" : "notifications@maarch.org", "charset" : "utf-8"}');
+INSERT INTO configurations (service, value) VALUES ('admin_email_server', '{"type" : "smtp", "host" : "smtp.gmail.com", "port" : 465, "user" : "notifications.maarch@gmail.com", "password" : "$Maarch1234*", "auth" : true, "secure" : "ssl", "from" : "notifications.maarch@gmail.com", "charset" : "utf-8"}');
+
+
-- 
GitLab