From 991f73158d66c7baf7281a36a874735d9b86abee Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Fri, 10 Apr 2020 10:57:36 +0100
Subject: [PATCH] FEAT #13679 TIME 1:45 refactoring notification for bin folder

---
 install/class/Class_Install.php               | 255 +++++----------
 install/scripts/testSmtp.php                  |   4 +-
 install/view/config_view.php                  | 308 ++++++++----------
 package.json                                  |  34 +-
 .../controllers/NotificationController.php    |   9 +-
 .../NotificationScheduleController.php        |  11 +-
 .../NotificationScheduleModelAbstract.php     |  21 +-
 .../NotificationScheduleControllerTest.php    |  14 +-
 8 files changed, 278 insertions(+), 378 deletions(-)

diff --git a/install/class/Class_Install.php b/install/class/Class_Install.php
index 3f9fa0602f2..545b53c4ef3 100755
--- a/install/class/Class_Install.php
+++ b/install/class/Class_Install.php
@@ -298,16 +298,10 @@ class Install extends functions
                 mkdir($cheminCustomMaarchCourrierModules, 0755);
 
                 /** Création répertoire notification dans le custom **/
-                $cheminCustomMaarchCourrierModulesNotifications = realpath('.')."/custom/cs_$databasename/modules/notifications";
-                mkdir($cheminCustomMaarchCourrierModulesNotifications, 0755);
-
-                $cheminCustomMaarchCourrierModulesNotificationsBatch = realpath('.')."/custom/cs_$databasename/modules/notifications/batch";
-                mkdir($cheminCustomMaarchCourrierModulesNotificationsBatch, 0755);
-
-                $cheminCustomMaarchCourrierModulesNotificationsConfig = realpath('.')."/custom/cs_$databasename/modules/notifications/batch/config";
+                $cheminCustomMaarchCourrierModulesNotificationsConfig = realpath('.')."/custom/cs_$databasename/bin/notification/config";
                 mkdir($cheminCustomMaarchCourrierModulesNotificationsConfig, 0755);
 
-                $cheminCustomMaarchCourrierModulesNotificationsScripts = realpath('.')."/custom/cs_$databasename/modules/notifications/batch/scripts";
+                $cheminCustomMaarchCourrierModulesNotificationsScripts = realpath('.')."/custom/cs_$databasename/bin/notification/scripts";
                 mkdir($cheminCustomMaarchCourrierModulesNotificationsScripts, 0755);
 
                 /** Création répertoire LDAP dans le custom **/
@@ -324,20 +318,12 @@ class Install extends functions
             if (is_dir(realpath('.')."/custom/cs_$databasename/modules/")) {
 
                 /* Création répertoire notif dans le custom **/
-                if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/notifications/")) {
-                    $cheminCustomMaarchCourrierModulesNotifications = realpath('.')."/custom/cs_$databasename/modules/notifications/";
-                    mkdir($cheminCustomMaarchCourrierModulesNotifications, 0755);
-                }
-                if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/notifications/batch/")) {
-                    $cheminCustomMaarchCourrierModulesNotificationsBatch = realpath('.')."/custom/cs_$databasename/modules/notifications/batch";
-                    mkdir($cheminCustomMaarchCourrierModulesNotificationsBatch, 0755);
-                }
-                if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/notifications/batch/config/")) {
-                    $cheminCustomMaarchCourrierModulesNotificationsConfig = realpath('.')."/custom/cs_$databasename/modules/notifications/batch/config";
+                if (!is_dir(realpath('.')."/custom/cs_$databasename/bin/notification/config/")) {
+                    $cheminCustomMaarchCourrierModulesNotificationsConfig = realpath('.')."/custom/cs_$databasename/bin/notification/config";
                     mkdir($cheminCustomMaarchCourrierModulesNotificationsConfig, 0755);
                 }
-                if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/notifications/batch/scripts/")) {
-                    $cheminCustomMaarchCourrierModulesNotificationsScripts = realpath('.')."/custom/cs_$databasename/modules/notifications/batch/scripts";
+                if (!is_dir(realpath('.')."/custom/cs_$databasename/bin/notification/scripts/")) {
+                    $cheminCustomMaarchCourrierModulesNotificationsScripts = realpath('.')."/custom/cs_$databasename/bin/notification/scripts";
                     mkdir($cheminCustomMaarchCourrierModulesNotificationsScripts, 0755);
                 }
 
@@ -460,13 +446,13 @@ class Install extends functions
             $cheminCustomMaarchCourrierModulesNotifications = realpath('.')."/custom/cs_$databasename/modules/notifications";
             mkdir($cheminCustomMaarchCourrierModulesNotifications, 0755);
 
-            $cheminCustomMaarchCourrierModulesNotificationsBatch = realpath('.')."/custom/cs_$databasename/modules/notifications/batch";
+            $cheminCustomMaarchCourrierModulesNotificationsBatch = realpath('.')."/custom/cs_$databasename/bin/notification";
             mkdir($cheminCustomMaarchCourrierModulesNotificationsBatch, 0755);
 
-            $cheminCustomMaarchCourrierModulesNotificationsConfig = realpath('.')."/custom/cs_$databasename/modules/notifications/batch/config";
+            $cheminCustomMaarchCourrierModulesNotificationsConfig = realpath('.')."/custom/cs_$databasename/bin/notification/config";
             mkdir($cheminCustomMaarchCourrierModulesNotificationsConfig, 0755);
 
-            $cheminCustomMaarchCourrierModulesNotificationsScripts = realpath('.')."/custom/cs_$databasename/modules/notifications/batch/scripts";
+            $cheminCustomMaarchCourrierModulesNotificationsScripts = realpath('.')."/custom/cs_$databasename/bin/notification/scripts";
             mkdir($cheminCustomMaarchCourrierModulesNotificationsScripts, 0755);
 
             /** Création répertoire LDAP dans le custom **/
@@ -479,13 +465,9 @@ class Install extends functions
             $cheminCustomMaarchCourrierModulesLdapScript = realpath('.')."/custom/cs_$databasename/modules/ldap/script";
             mkdir($cheminCustomMaarchCourrierModulesLdapScript, 0755);
 
-            // exit;
-
-            //Création du lien symbolique sous linux
-            if (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') {
-                $cmd = 'ln -s '.realpath('.')."/ cs_$databasename";
-                exec($cmd);
-            }
+            //Création du lien symbolique
+            $cmd = 'ln -s '.realpath('.')."/ cs_$databasename";
+            exec($cmd);
         }
 
         return true;
@@ -709,18 +691,16 @@ class Install extends functions
 
 ######################notification#################################################
 
-0 10 * * *      '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/BASKETS.sh
-0 12 * * *      '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/BASKETS.sh
-0 15 * * *      '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/BASKETS.sh
+0 10 * * *      '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/BASKETS.sh
+0 12 * * *      '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/BASKETS.sh
+0 15 * * *      '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/BASKETS.sh
 
-15 10 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/nct-ncc-and-anc.sh
+15 10 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/nct-ncc-and-anc.sh
 
-30 10 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/sendmail.sh
-30 12 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/sendmail.sh
-30 15 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/sendmail.sh
+30 10 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/sendmail.sh
+30 12 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/sendmail.sh
+30 15 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/sendmail.sh
 
-10 12 * * 0        rm -Rf '.realpath('.').'/modules/notifications/batch/logs/process_event_stack/*.log
-11 12 * * 0        rm -Rf '.realpath('.').'/modules/notifications/batch/logs/process_email_stack/*.log
 ';
         fwrite($file, $cron);
         fclose($file);
@@ -787,7 +767,7 @@ class Install extends functions
 
     private function setConfig_batch_XmlNotifications()
     {
-        $xmlconfig = simplexml_load_file('modules/notifications/batch/config/config.xml.default');
+        $xmlconfig = simplexml_load_file('bin/notification/config/config.xml.default');
 
         $CONFIG = $xmlconfig->CONFIG;
 
@@ -808,7 +788,7 @@ class Install extends functions
         $CONFIG->customID     = 'cs_'.$_SESSION['config']['databasename'];
 
         $res = $xmlconfig->asXML();
-        $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml', 'w+');
+        $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml', 'w+');
         if (!$fp) {
             return false;
             exit;
@@ -887,151 +867,84 @@ class Install extends functions
 
     private function setScriptNotificationNctNccAndAncSh()
     {
-        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
-            $res = 'cd '.realpath('.')."\modules\\notifications\\";
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\notifications\batch\process_event_stack.php -c '.realpath('.')."\custom/cs_".$_SESSION['config']['databasename'].'\modules\\notifications\batch\config\config.xml\ -n NCT';
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\notifications\batch\process_event_stack.php -c '.realpath('.')."\custom/cs_".$_SESSION['config']['databasename'].'\modules\\notifications\batch\config\config.xml\ -n NCC';
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\notifications\batch\process_event_stack.php -c '.realpath('.')."\custom/cs_".$_SESSION['config']['databasename'].'\modules\\notifications\batch\config\config.xml\ -n ANC';
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\notifications\batch\process_event_stack.php -c '.realpath('.')."\custom/cs_".$_SESSION['config']['databasename'].'\modules\\notifications\batch\config\config.xml\ -n AND';
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\notifications\batch\process_event_stack.php -c '.realpath('.')."\custom/cs_".$_SESSION['config']['databasename'].'\modules\\notifications\batch\config\config.xml\ -n RED';
-
-            $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/nct-ncc-and-anc.bat', 'w+');
-            if (!$fp) {
-                return false;
-                exit;
-            }
-            $write = fwrite($fp, $res);
-            if (!$write) {
-                return false;
-                exit;
-            }
-
-            return true;
-        } elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') {
-            $res = '#!/bin/bash';
-            $res .= "\n";
-            $res .= "eventStackPath='".realpath('.')."/modules/notifications/batch/process_event_stack.php'";
-            $res .= "\n";
-            $res .= 'cd '.realpath('.').'/modules/notifications/batch/';
-            $res .= "\n";
-            $res .= '#php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml -n NCT';
-            $res .= "\n";
-            $res .= '#php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml -n NCC';
-            $res .= "\n";
-            $res .= 'php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml -n ANC';
-            $res .= "\n";
-            $res .= 'php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml -n AND';
-            $res .= "\n";
-            $res .= 'php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml -n RED';
-
-            $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/nct-ncc-and-anc.sh', 'w+');
-            if (!$fp) {
-                return false;
-                exit;
-            }
-            $write = fwrite($fp, $res);
-            if (!$write) {
-                return false;
-                exit;
-            }
+        $res = '#!/bin/bash';
+        $res .= "\n";
+        $res .= "eventStackPath='".realpath('.')."/bin/notification/process_event_stack.php'";
+        $res .= "\n";
+        $res .= 'cd '.realpath('.').'/bin/notification/';
+        $res .= "\n";
+        $res .= '#php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml -n NCT';
+        $res .= "\n";
+        $res .= '#php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml -n NCC';
+        $res .= "\n";
+        $res .= 'php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml -n ANC';
+        $res .= "\n";
+        $res .= 'php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml -n AND';
+        $res .= "\n";
+        $res .= 'php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml -n RED';
 
-            return true;
+        $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/nct-ncc-and-anc.sh', 'w+');
+        if (!$fp) {
+            return false;
+            exit;
         }
+        $write = fwrite($fp, $res);
+        if (!$write) {
+            return false;
+            exit;
+        }
+
+        return true;
     }
 
     private function setScriptNotificationBasketsSh()
     {
-        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
-            $res = 'cd '.realpath('.')."\modules\\notifications\\";
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\notifications\batch\basket_event_stack.php -c '.realpath('.')."\custom/cs_".$_SESSION['config']['databasename'].'\modules\\notifications\batch\config\config.xml\ -n BASKETS';
-            $res .= "\n";
-
-            $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/BASKETS.bat', 'w+');
-            if (!$fp) {
-                return false;
-                exit;
-            }
-            $write = fwrite($fp, $res);
-            if (!$write) {
-                return false;
-                exit;
-            }
-
-            return true;
-        } elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') {
-            $res = '#!/bin/bash';
-            $res .= "\n";
-            $res .= "eventStackPath='".realpath('.')."/modules/notifications/batch/basket_event_stack.php'";
-            $res .= "\n";
-            $res .= 'cd '.realpath('.').'/modules/notifications/batch/';
-            $res .= "\n";
-            $res .= 'php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml -n BASKETS';
-            $res .= "\n";
-
-            $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/BASKETS.sh', 'w+');
-            if (!$fp) {
-                return false;
-                exit;
-            }
-            $write = fwrite($fp, $res);
-            if (!$write) {
-                return false;
-                exit;
-            }
+        $res = '#!/bin/bash';
+        $res .= "\n";
+        $res .= "eventStackPath='".realpath('.')."/bin/notification/basket_event_stack.php'";
+        $res .= "\n";
+        $res .= 'cd '.realpath('.').'/bin/notification/';
+        $res .= "\n";
+        $res .= 'php $eventStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml -n BASKETS';
+        $res .= "\n";
 
-            return true;
+        $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/BASKETS.sh', 'w+');
+        if (!$fp) {
+            return false;
+            exit;
+        }
+        $write = fwrite($fp, $res);
+        if (!$write) {
+            return false;
+            exit;
         }
+
+        return true;
     }
 
     private function setScriptNotificationSendmailSh()
     {
-        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
-            $res = 'cd '.realpath('.')."\modules\\notifications\\";
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\notifications\batch\process_email_stack.php -c '.realpath('.')."\custom\cs_".$_SESSION['config']['databasename'].'\modules\\notifications\batch\config\config.xml';
-            $res .= "\n";
-
-            $fp = fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/sendmail.bat', 'w+');
-            if (!$fp) {
-                return false;
-                exit;
-            }
-            $write = fwrite($fp, $res);
-            if (!$write) {
-                return false;
-                exit;
-            }
+        $res = '#!/bin/bash';
+        $res .= "\n";
+        $res .= 'cd '.realpath('.').'/bin/notification/';
+        $res .= "\n";
+        $res .= "emailStackPath='".realpath('.')."/bin/notification/process_email_stack.php'";
+        $res .= "\n";
+        $res .= 'php $emailStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml';
 
-            return true;
-        } elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') {
-            $res = '#!/bin/bash';
-            $res .= "\n";
-            $res .= 'cd '.realpath('.').'/modules/notifications/batch/';
-            $res .= "\n";
-            $res .= "emailStackPath='".realpath('.')."/modules/notifications/batch/process_email_stack.php'";
-            $res .= "\n";
-            $res .= 'php $emailStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml';
-
-            $fp = fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/sendmail.sh', 'w+');
-
-            if (!$fp) {
-                return false;
-                exit;
-            }
-            $write = fwrite($fp, $res);
-            if (!$write) {
-                return false;
-                exit;
-            }
+        $fp = fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/scripts/sendmail.sh', 'w+');
 
-            return true;
+        if (!$fp) {
+            return false;
+            exit;
+        }
+        $write = fwrite($fp, $res);
+        if (!$write) {
+            return false;
+            exit;
         }
+
+        return true;
     }
 
     public function getDataList()
diff --git a/install/scripts/testSmtp.php b/install/scripts/testSmtp.php
index 30100510d2e..3b0e2eada39 100755
--- a/install/scripts/testSmtp.php
+++ b/install/scripts/testSmtp.php
@@ -26,7 +26,7 @@
 
  function setConfigNotification_batch_config_Xml($from, $to, $host, $user, $pass, $type, $port, $auth, $charset, $smtpSecure, $mailfrom, $smtpDomains)
  {
-     $xmlconfig = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml');
+     $xmlconfig = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml');
 
      $CONFIG = $xmlconfig->CONFIG;
         
@@ -42,7 +42,7 @@
      $CONFIG->MaarchUrl = $maarchUrl;
 
      $res = $xmlconfig->asXML();
-     $fp = @fopen(realpath('.')."/custom/cs_".$_SESSION['config']['databasename']."/modules/notifications/batch/config/config.xml", "w+");
+     $fp = @fopen(realpath('.')."/custom/cs_".$_SESSION['config']['databasename']."/bin/notification/config/config.xml", "w+");
      if (!$fp) {
          return false;
          exit;
diff --git a/install/view/config_view.php b/install/view/config_view.php
index d1d67c4a85e..dede19d4f47 100755
--- a/install/view/config_view.php
+++ b/install/view/config_view.php
@@ -30,7 +30,6 @@
 
 $filename = realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/config.xml';
 if (file_exists($filename)) {
-
     $xmlconfig = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/config.xml');
 
     $CONFIG = $xmlconfig->CONFIG;
@@ -43,10 +42,8 @@ if (file_exists($filename)) {
     $nblinetoshow = (string) $CONFIG->nblinetoshow;
     $debug = (string) $CONFIG->debug;
     $applicationname = $CONFIG->applicationname;
-    // var_dump((string) $CONFIG->applicationname);
-    // var_dump($applicationname);
 
-    $xmlconfigSMTP = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml');
+    $xmlconfigSMTP = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml');
 
     $MAILER = $xmlconfigSMTP->MAILER;
 
@@ -55,46 +52,37 @@ if (file_exists($filename)) {
     $smtp_port = (string) $MAILER->smtp_port;
     $smtp_user = (string) $MAILER->smtp_user;
     $smtp_auth = (string) $MAILER->smtp_auth;
-    $smtp_secure = (string) $MAILER->smtp_secure;
-
-?>
+    $smtp_secure = (string) $MAILER->smtp_secure; ?>
 <script>
-   
-    function setconfig(url,applicationname)
-    {
-        // alert(url);
-        // alert(applicationname);
+    function setconfig(url, applicationname) {
 
         $(document).ready(function() {
             var oneIsEmpty = false;
             if (applicationname.length < 1) {
                 var oneIsEmpty = true;
             }
-            
 
             if (oneIsEmpty) {
-                $('#ajaxReturn_testConnect_ko').html('<?php echo _ONE_FIELD_EMPTY;?>');
+                $('#ajaxReturn_testConnect_ko').html('<?php echo _ONE_FIELD_EMPTY; ?>');
                 return;
-             }
-             $('.wait').css('display','block');
-             $('#ajaxReturn_testConnect_ko').html('');
-            //alert("ok");
+            }
+            $('.wait').css('display', 'block');
+            $('#ajaxReturn_testConnect_ko').html('');
             ajaxDB(
                 'setConfig',
-                  'applicationname|'+applicationname,
+                'applicationname|' + applicationname,
                 'ajaxReturn_testConnect',
                 'false'
             );
 
             if (oneIsEmpty) {
-                $('#ajaxReturn_testConnect_ok').html('<?php echo "connexion ok";?>');
+                $('#ajaxReturn_testConnect_ok').html('<?php echo "connexion ok"; ?>');
                 return;
-             }
+            }
         });
     }
 
-    function uploadImg(loginpicture)
-    {
+    function uploadImg(loginpicture) {
         var file_data = loginpicture.prop('files')[0];
         var form_data = new FormData();
         form_data.append('file', file_data);
@@ -107,13 +95,11 @@ if (file_exists($filename)) {
             data: form_data,
             type: 'post',
             success: function(php_script_response) {
-                //console.log(php_script_response);
-                //console.log(php_script_response.indexOf('error'));
-                if(php_script_response.indexOf('error')==-1) {
+                if (php_script_response.indexOf('error') == -1) {
                     var theImg = document.getElementById("imageDiv");
                     theImg.src = php_script_response;
-                    theImg.innerHTML='<img src="'+php_script_response+'?'+new Date().getTime()
-                        +'" width="30%" height="30%" />';
+                    theImg.innerHTML = '<img src="' + php_script_response + '?' + new Date().getTime() +
+                        '" width="30%" height="30%" />';
                     $('#ajaxReturn_upload_ko').html('Image chargée');
                 } else {
                     $('#ajaxReturn_upload_ko').html(php_script_response);
@@ -122,22 +108,21 @@ if (file_exists($filename)) {
         });
     }
 
-    function uploadFromImagePicker()
-    {
+    function uploadFromImagePicker() {
         selectImgPicker = document.getElementById("selectImgPicker");
         console.log(selectImgPicker.value);
         $.ajax({
             url: 'scripts/uploadFromImagePicker.php',
             dataType: 'html',
-            data: 'imgSelected='+selectImgPicker.value,
+            data: 'imgSelected=' + selectImgPicker.value,
             type: 'post',
             success: function(php_script_response) {
                 console.log(php_script_response);
-                if(php_script_response.indexOf('error')==-1) {
+                if (php_script_response.indexOf('error') == -1) {
                     var theImg = document.getElementById("imageDiv");
                     theImg.src = php_script_response;
-                    theImg.innerHTML='<img src="'+php_script_response+'?'+new Date().getTime()
-                        +'" width="30%" height="30%" />';
+                    theImg.innerHTML = '<img src="' + php_script_response + '?' + new Date().getTime() +
+                        '" width="30%" height="30%" />';
                     $('#ajaxReturn_upload_ko').html('Image chargée');
                 } else {
                     $('#ajaxReturn_upload_ko').html(php_script_response);
@@ -149,44 +134,44 @@ if (file_exists($filename)) {
 
 <div class="blockWrapper">
     <div class="titleBlock">
-            <h2 onClick="slide('configImage');" style="cursor: pointer;">
-                <?php echo _CONFIG_IMAGE;?>
-            </h2>
+        <h2 onClick="slide('configImage');" style="cursor: pointer;">
+            <?php echo _CONFIG_IMAGE; ?>
+        </h2>
     </div>
     <div class="contentBlock" id="configImage">
         <p>
-            <h5>
-                <?php echo _CONFIG_IMG_EXP;?>
-            </h5>
-            <form>
-                <table>
-                    <tr>
-                        <td>
-                            <?php echo _LOGIN_PICTURE;?>
-                        </td>
-                        <td>
-                            :
-                        </td>
-                        <td>
-                            <input id="loginpicture" type="file" name="loginpicture" onchange="uploadImg($('#loginpicture'))" />
-                        </td>
-                    </tr>
-                </table>
-            </form>
-            <br />
-            <div id="ajaxReturn_upload_ko" style="margin-left :20px;color:red;"></div>
-            <div align="center">
-                <img src="img/wait.gif" width="100" class="wait" style="display: none; background-color: rgba(0, 0, 0, 0.2);"/>
-            </div>
-            <div id="ajaxReturn_upload_ok"></div>
-            <p>Image de la page de login :</p>
-            <div id="imageDiv">
-                <img src="../apps/maarch_entreprise/img/bodylogin.jpg" width="30%" height="30%" />
-            </div>
+        <h5>
+            <?php echo _CONFIG_IMG_EXP; ?>
+        </h5>
+        <form>
+            <table>
+                <tr>
+                    <td>
+                        <?php echo _LOGIN_PICTURE; ?>
+                    </td>
+                    <td>
+                        :
+                    </td>
+                    <td>
+                        <input id="loginpicture" type="file" name="loginpicture" onchange="uploadImg($('#loginpicture'))" />
+                    </td>
+                </tr>
+            </table>
+        </form>
+        <br />
+        <div id="ajaxReturn_upload_ko" style="margin-left :20px;color:red;"></div>
+        <div align="center">
+            <img src="img/wait.gif" width="100" class="wait" style="display: none; background-color: rgba(0, 0, 0, 0.2);" />
+        </div>
+        <div id="ajaxReturn_upload_ok"></div>
+        <p>Image de la page de login :</p>
+        <div id="imageDiv">
+            <img src="../apps/maarch_entreprise/img/bodylogin.jpg" width="30%" height="30%" />
+        </div>
         </p>
         <link href="css/image-picker.css" rel="stylesheet" type="text/css">
         <div class="container">
-            <?php echo _LOGIN_PICTURE_FROM_DATA;?>
+            <?php echo _LOGIN_PICTURE_FROM_DATA; ?>
             <select id="selectImgPicker" name="selectImgPicker" class="image-picker" onchange="uploadFromImagePicker();">
                 <optgroup label="Lettres">
                     <option data-img-src="img/background/01.jpg" value="01">Lettre 1</option>
@@ -212,76 +197,74 @@ if (file_exists($filename)) {
         </div>
         <script src="js/image-picker.js"></script>
         <script>
-        $(".image-picker").imagepicker({
-            hide_select : false
-        })
+            $(".image-picker").imagepicker({
+                hide_select: false
+            })
         </script>
 
-</div>
-<div class="blockWrapper">
-    <div class="titleBlock">
-        <h2 onClick="slide('configGeneral');" style="cursor: pointer;">
-            <?php echo _CONFIG_INFO;?>
-        </h2>
     </div>
-    <div class="contentBlock" id="configGeneral">
-        <p>
+    <div class="blockWrapper">
+        <div class="titleBlock">
+            <h2 onClick="slide('configGeneral');" style="cursor: pointer;">
+                <?php echo _CONFIG_INFO; ?>
+            </h2>
+        </div>
+        <div class="contentBlock" id="configGeneral">
+            <p>
             <h6>
-                <?php echo _CONFIG_EXP;?>
+                <?php echo _CONFIG_EXP; ?>
             </h6>
             <form>
                 <table>
                     <tr>
                         <td>
-                            <?php echo _DATABASESERVER;?>
+                            <?php echo _DATABASESERVER; ?>
                         </td>
                         <td>
                             :
                         </td>
                         <td>
-                            <input type="text" name="databaseserver" id="databaseserver" disabled="disabled" value= <?php echo $databaseserver; ?> />
+                            <input type="text" name="databaseserver" id="databaseserver" disabled="disabled" value=<?php echo $databaseserver; ?> />
                         </td>
                     </tr>
                     <tr>
-                        <td><?php echo _SMTP_PORT;?></td>
+                        <td><?php echo _SMTP_PORT; ?>
+                        </td>
                         <td>:</td>
-                        <td><input type="text" name="databasetype" id="databasetype" disabled="disabled" value= <?php echo $databasetype; ?> /></td>
+                        <td><input type="text" name="databasetype" id="databasetype" disabled="disabled" value=<?php echo $databasetype; ?> /></td>
                     </tr>
                     <tr>
-                        <td><?php echo _DATABASENAME;?></td>
+                        <td><?php echo _DATABASENAME; ?>
+                        </td>
                         <td>:</td>
                         <td><input type="text" name="databasename" id="databasename" disabled="disabled" value=<?php echo $databasename; ?> /></td>
                     </tr>
                     <tr>
-                        <td><?php echo _USER_BDD;?></td>
+                        <td><?php echo _USER_BDD; ?>
+                        </td>
                         <td>:</td>
                         <td><input type="text" name="databaseuser" id="databaseuser" disabled="disabled" value=<?php echo $databaseuser; ?> /></td>
                     </tr>
                     <tr>
-                        <td><?php echo _LANG;?></td>
-                        <td>:</td>
-                        <td><input type="text" name="lang" id="lang" disabled="disabled" value=<?php if($lang == 'fr'){echo 'Français';}elseif($lang == 'en'){echo 'English';} ?> /></td>
-                    </tr>
-                    <!--tr>
-                        <td><?php echo _NBLINETOSHOW;?></td>
+                        <td><?php echo _LANG; ?>
+                        </td>
                         <td>:</td>
-                        <td><input type="text" name="nblinetoshow" id="nblinetoshow" disabled="disabled" value=<?php echo $nblinetoshow; ?> /></td>
+                        <td><input type="text" name="lang" id="lang" disabled="disabled" value=<?php if ($lang == 'fr') {
+        echo 'Français';
+    } elseif ($lang == 'en') {
+        echo 'English';
+    } ?> /></td>
                     </tr>
                     <tr>
-                        <td><?php echo _MODEDEBUG;?></td>
-                        <td>:</td>
-                        <td><input type="text" name="debug" id="debug" disabled="disabled" value=<?php echo $debug; ?> /></td>
-                    </tr-->
-                    <tr>
-                        <td><b style="color:red"><?php echo _APPLICATIONNAME;?></b></td>
+                        <td><b style="color:red"><?php echo _APPLICATIONNAME; ?></b></td>
                         <td>:</td>
-                        <td><input type="text" name="applicationname" id="applicationname" value="<?php echo (string) $_SESSION['config']['databasename']; ?> "/></td>
+                        <td><input type="text" name="applicationname" id="applicationname" value="<?php echo (string) $_SESSION['config']['databasename']; ?> " /></td>
                     </tr>
                     <tr>
                         <td></td>
                         <td></td>
                         <td>
-                            <input type="button" id="ajaxReturn_testConnect_button" onClick="setconfig('setConfig', $('#applicationname').val())"; value="<?php echo _SET_CONFIG;?>"/>
+                            <input type="button" id="ajaxReturn_testConnect_button" onClick="setconfig('setConfig', $('#applicationname').val())" ; value="<?php echo _SET_CONFIG; ?>" />
                         </td>
                     </tr>
                 </table>
@@ -289,55 +272,59 @@ if (file_exists($filename)) {
             <br />
             <div id="ajaxReturn_testConnect_ko"></div>
             <div align="center">
-                <img src="img/wait.gif" width="100" class="wait" style="display: none; background-color: rgba(0, 0, 0, 0.2);"/>
+                <img src="img/wait.gif" width="100" class="wait" style="display: none; background-color: rgba(0, 0, 0, 0.2);" />
             </div>
             <div id="ajaxReturn_testConnect_ok"></div>
-        </p>
+            </p>
+        </div>
     </div>
-</div>
-<br />
+    <br />
 
-<div class="blockWrapper">
-    <div class="titleBlock">
+    <div class="blockWrapper">
+        <div class="titleBlock">
             <h2 onClick="slide('configNotificationSendmail');" style="cursor: pointer;">
-                <?php echo _SMTP_INFO;?>
+                <?php echo _SMTP_INFO; ?>
             </h2>
-    </div>
-    <div class="contentBlock" id="configNotificationSendmail">
-        <p>
+        </div>
+        <div class="contentBlock" id="configNotificationSendmail">
+            <p>
             <h6>
-                <?php echo _CONFIG_SMTP_EXP;?>
+                <?php echo _CONFIG_SMTP_EXP; ?>
             </h6>
             <form>
                 <table>
                     <tr>
                         <td>
-                            <?php echo _TYPE;?>
+                            <?php echo _TYPE; ?>
                         </td>
                         <td>
                             :
                         </td>
                         <td>
-                            <input type="text" name="smtptype" id="smtptype" disabled="disabled" value= <?php echo $type; ?> />
+                            <input type="text" name="smtptype" id="smtptype" disabled="disabled" value=<?php echo $type; ?> />
                         </td>
                     </tr>
                     <tr>
-                        <td><?php echo _SMTP_HOST;?></td>
+                        <td><?php echo _SMTP_HOST; ?>
+                        </td>
                         <td>:</td>
-                        <td><input type="text" name="smtphost" id="smtphost" disabled="disabled" value= <?php echo $smtp_host; ?> /></td>
+                        <td><input type="text" name="smtphost" id="smtphost" disabled="disabled" value=<?php echo $smtp_host; ?> /></td>
                     </tr>
                     <tr>
-                        <td><?php echo _SMTP_PORT;?></td>
+                        <td><?php echo _SMTP_PORT; ?>
+                        </td>
                         <td>:</td>
                         <td><input type="text" name="smtpport" id="smtpport" disabled="disabled" value=<?php echo $smtp_port; ?> /></td>
                     </tr>
                     <tr>
-                        <td><?php echo _SMTP_USER;?></td>
+                        <td><?php echo _SMTP_USER; ?>
+                        </td>
                         <td>:</td>
                         <td><input type="text" name="smtpuser" id="smtpuser" disabled="disabled" value=<?php echo $smtp_user; ?> /></td>
                     </tr>
                     <tr>
-                        <td><?php echo _SMTP_AUTH;?></td>
+                        <td><?php echo _SMTP_AUTH; ?>
+                        </td>
                         <td>:</td>
                         <td><input type="text" name="smtpauth" id="smtpauth" disabled="disabled" value=<?php echo $smtp_auth; ?> /></td>
                     </tr>
@@ -345,70 +332,53 @@ if (file_exists($filename)) {
                     <tr>
                         <td></td>
                         <td></td>
-                        
+
                     </tr>
                 </table>
             </form>
             <br />
             <div id="ajaxReturn_testConnect_ko"></div>
             <div align="center">
-                    <img src="img/wait.gif" width="100" class="wait" style="display: none; background-color: rgba(0, 0, 0, 0.2);"/>
+                <img src="img/wait.gif" width="100" class="wait" style="display: none; background-color: rgba(0, 0, 0, 0.2);" />
             </div>
             <div id="ajaxReturn_testConnect_ok"></div>
-        </p>
-</div>
-<div class="blockWrapper">
-    <div class="contentBlock" id="docservers">
-        <p>
-            <div id="buttons">
-                <div style="float: right;" class="nextButton" id="next">
-                    <a href="#" onClick="goTo('index.php?step=resume');">
-                        <?php echo _NEXT_INSTALL;?>
-                    </a>
+            </p>
+        </div>
+        <div class="blockWrapper">
+            <div class="contentBlock" id="docservers">
+                <p>
+                <div id="buttons">
+                    <div style="float: right;" class="nextButton" id="next">
+                        <a href="#" onClick="goTo('index.php?step=resume');">
+                            <?php echo _NEXT_INSTALL; ?>
+                        </a>
+                    </div>
+
                 </div>
-                
+                <br />
+                <br />
+                </p>
             </div>
-            <br />
-            <br />
-        </p>
-    </div>
-</div>
+        </div>
 
-<?php
+        <?php
 } else {
-    echo "fichier de configuration non trouvé : vérifier votre custom";
-?>
-<div class="blockWrapper">
-    <div class="contentBlock" id="docservers">
-        <p>
-            <div id="buttons">
-                <div style="float: left;" class="previousButton" id="previous">
-                    <a href="#" onClick="goTo('index.php?step=database');" style="display:block;">
-                        <?php echo _PREVIOUS;?>
-                    </a>
+        echo "fichier de configuration non trouvé : vérifier votre custom"; ?>
+        <div class="blockWrapper">
+            <div class="contentBlock" id="docservers">
+                <p>
+                <div id="buttons">
+                    <div style="float: left;" class="previousButton" id="previous">
+                        <a href="#" onClick="goTo('index.php?step=database');" style="display:block;">
+                            <?php echo _PREVIOUS; ?>
+                        </a>
+                    </div>
                 </div>
-                <!--div style="float: left;" class="previousButton" id="next">
-                    <a href="#" onClick="goTo('index.php?step=password');" id="ajaxReturn_testConnect" >
-                        <?php echo "Sauter étape";?>
-                    </a>
-                </div-->
-                <!--div style="float: right;" class="nextButton" id="next">
-                    <a href="#" onClick="goTo('index.php?step=password');" id="ajaxReturn_testConnect">
-                        <?php echo _NEXT;?>
-                    </a>
-                </div-->
-                <!--div style="float: right;" class="nextButton" id="next">
-                    <a href="#" onClick="goTo('index.php?step=resume');">
-                        <?php echo _NEXT_INSTALL;?>
-                    </a>
-                </div-->
-                
+                <br />
+                <br />
+                </p>
             </div>
-            <br />
-            <br />
-        </p>
-    </div>
-</div>
+        </div>
 
-<?php
-}
+        <?php
+    }
diff --git a/package.json b/package.json
index 4b95a831deb..14b9b20c457 100755
--- a/package.json
+++ b/package.json
@@ -21,27 +21,27 @@
   "author": "Maarch",
   "license": "GPL-3.0",
   "dependencies": {
-    "core-js": "^3.6.4",
+    "core-js": "^3.6.5",
     "zone.js": "~0.10.2"
   },
   "devDependencies": {
-    "@angular-devkit/build-angular": "~0.901.0",
-    "@angular/animations": "^9.1.0",
+    "@angular-devkit/build-angular": "^0.901.1",
+    "@angular/animations": "^9.1.1",
     "@angular/cdk": "^9.2.0",
-    "@angular/cli": "^9.1.0",
-    "@angular/common": "^9.1.0",
-    "@angular/compiler": "^9.1.0",
-    "@angular/compiler-cli": "^9.1.0",
-    "@angular/core": "^9.1.0",
-    "@angular/forms": "^9.1.0",
+    "@angular/cli": "^9.1.1",
+    "@angular/common": "^9.1.1",
+    "@angular/compiler": "^9.1.1",
+    "@angular/compiler-cli": "^9.1.1",
+    "@angular/core": "^9.1.1",
+    "@angular/forms": "^9.1.1",
     "@angular/material": "^9.2.0",
-    "@angular/platform-browser": "^9.1.0",
-    "@angular/platform-browser-dynamic": "^9.1.0",
-    "@angular/platform-server": "^9.1.0",
-    "@angular/router": "^9.1.0",
+    "@angular/platform-browser": "^9.1.1",
+    "@angular/platform-browser-dynamic": "^9.1.1",
+    "@angular/platform-server": "^9.1.1",
+    "@angular/router": "^9.1.1",
     "@fortawesome/fontawesome-free": "^5.13.0",
     "@swimlane/ngx-charts": "^13.0.2",
-    "@types/datatables.net": "^1.10.18",
+    "@types/datatables.net": "^1.10.19",
     "@types/jquery": "^3.3.34",
     "@types/jquery.nicescroll": "^3.7.1",
     "@types/jstree": "^3.3.39",
@@ -61,8 +61,8 @@
     "ngx-cookie-service": "^3.0.4",
     "ngx-pipes": "^2.7.3",
     "node-sass": "^4.13.1",
-    "nodemon": "^2.0.2",
-    "npm-check-updates": "^4.1.1",
+    "nodemon": "^2.0.3",
+    "npm-check-updates": "^4.1.2",
     "pdfjs-dist": "2.3.200",
     "photoswipe": "^4.1.3",
     "protractor": "^5.4.3",
@@ -75,7 +75,7 @@
     "typescript": "3.8.3",
     "uglify-es": "3.3.9",
     "uglifyjs-webpack-plugin": "2.2.0",
-    "url-loader": "^4.0.0",
+    "url-loader": "^4.1.0",
     "webpack": "^4.42.1"
   },
   "repository": {}
diff --git a/src/app/notification/controllers/NotificationController.php b/src/app/notification/controllers/NotificationController.php
index 31afcae8f42..6ea0e5a1283 100755
--- a/src/app/notification/controllers/NotificationController.php
+++ b/src/app/notification/controllers/NotificationController.php
@@ -89,7 +89,7 @@ class NotificationController
 
         $notification['scriptcreated'] = false;
 
-        if (file_exists($pathToFolow.'modules/notifications/batch/scripts/'.$filename)) {
+        if (file_exists($pathToFolow.'modules/notifications/batch/scripts/'.$filename) || file_exists($pathToFolow.'bin/notification/scripts/'.$filename)) {
             $notification['scriptcreated'] = true;
         }
 
@@ -232,7 +232,7 @@ class NotificationController
             }
 
             foreach ($cronTab as $key => $value) {
-                if ($value['cmd'] == $pathToFolow.'modules/notifications/batch/scripts/'.$filename) {
+                if (in_array($value['cmd'], [$pathToFolow.'modules/notifications/batch/scripts/'.$filename, $pathToFolow.'bin/notification/scripts/'.$filename])) {
                     $cronTab[$key]['state'] = 'deleted';
                     $flagCron = true;
                     break;
@@ -246,6 +246,11 @@ class NotificationController
             $filePath = $pathToFolow.'modules/notifications/batch/scripts/'.$filename;
             if (file_exists($filePath)) {
                 unlink($filePath);
+            } else {
+                $filePath = $pathToFolow.'bin/notification/scripts/'.$filename;
+                if (file_exists($filePath)) {
+                    unlink($filePath);
+                }
             }
         }
 
diff --git a/src/app/notification/controllers/NotificationScheduleController.php b/src/app/notification/controllers/NotificationScheduleController.php
index d94ae8a4329..31c3d229ed6 100755
--- a/src/app/notification/controllers/NotificationScheduleController.php
+++ b/src/app/notification/controllers/NotificationScheduleController.php
@@ -54,7 +54,7 @@ class NotificationScheduleController
                     $errors[] = $key.' is empty';
                 }
 
-                if ($key != 'cmd' && $key != 'state' && $key != 'description' && !preg_match('#^[0-9\/*][0-9]?[,\/-]?([0-9]?){2}#', $value) ) {
+                if ($key != 'cmd' && $key != 'state' && $key != 'description' && !preg_match('#^[0-9\/*][0-9]?[,\/-]?([0-9]?){2}#', $value)) {
                     $errors[] = 'wrong format for '.$key;
                 }
             }
@@ -90,9 +90,13 @@ class NotificationScheduleController
             }
 
             $path = $pathToFolow.'modules/notifications/batch/scripts/'.$filename;
-
             if (file_exists($path)) {
                 $notificationsArray[] = ['description' => $result['description'], 'path' => $path];
+            } else {
+                $path = $pathToFolow.'bin/notification/scripts/'.$filename;
+                if (file_exists($path)) {
+                    $notificationsArray[] = ['description' => $result['description'], 'path' => $path];
+                }
             }
         }
 
@@ -121,7 +125,8 @@ class NotificationScheduleController
                     $pathToFolow = $corePath;
                 }
                 $returnValue = true;
-                if (strpos($crontabToSave[$id]['cmd'], $pathToFolow.'modules/notifications/batch/scripts/') !== 0) {
+                if (strpos($crontabToSave[$id]['cmd'], $pathToFolow.'modules/notifications/batch/scripts/') !== 0
+                    && strpos($crontabToSave[$id]['cmd'], $pathToFolow.'bin/notification/scripts/') !== 0) {
                     $returnValue = false;
                     break;
                 }
diff --git a/src/app/notification/models/NotificationScheduleModelAbstract.php b/src/app/notification/models/NotificationScheduleModelAbstract.php
index 876211706db..6e1912324af 100755
--- a/src/app/notification/models/NotificationScheduleModelAbstract.php
+++ b/src/app/notification/models/NotificationScheduleModelAbstract.php
@@ -107,7 +107,8 @@ abstract class NotificationScheduleModelAbstract
             }
 
             $state = 'normal';
-            if (strpos($cmd, $pathToFolow.'modules/notifications/batch/scripts/') !== 0 && $aArgs['setHiddenValue']) {
+            if (strpos($cmd, $pathToFolow.'bin/notification/scripts/') !== 0 && strpos($cmd, $pathToFolow.'modules/notifications/batch/scripts/') !== 0
+                    && $aArgs['setHiddenValue']) {
                 $cmd = 'hidden';
                 $state = 'hidden';
             }
@@ -153,24 +154,30 @@ abstract class NotificationScheduleModelAbstract
             $ConfigNotif = $corePath.'custom/'.$customId.'/modules/notifications/batch/config/config_'.$customId.'.xml';
         } elseif (file_exists($corePath.'modules/notifications/batch/config/config_'.$customId.'.xml')) {
             $ConfigNotif = $corePath.'modules/notifications/batch/config/config_'.$customId.'.xml';
+        } elseif (file_exists($corePath.'custom/'.$customId.'/bin/notification/config/config.xml')) {
+            $ConfigNotif = $corePath.'custom/'.$customId.'/bin/notification/config/config.xml';
+        } elseif (file_exists($corePath.'custom/'.$customId.'/bin/notification/config/config_'.$customId.'.xml')) {
+            $ConfigNotif = $corePath.'custom/'.$customId.'/bin/notification/config/config_'.$customId.'.xml';
+        } elseif (file_exists($corePath.'bin/notification/config/config_'.$customId.'.xml')) {
+            $ConfigNotif = $corePath.'bin/notification/config/config_'.$customId.'.xml';
         } else {
             $ConfigNotif = $corePath.'modules/notifications/batch/config/config.xml';
         }
 
         if ($customId != '') {
             $pathToFolow = $corePath.'custom/'.$customId.'/';
-            if (!file_exists($pathToFolow.'modules/notifications/batch/scripts/')) {
-                mkdir($pathToFolow.'modules/notifications/batch/scripts/', 0777, true);
+            if (!file_exists($pathToFolow.'bin/notification/scripts/')) {
+                mkdir($pathToFolow.'bin/notification/scripts/', 0777, true);
             }
-            $file_open = fopen($pathToFolow.'modules/notifications/batch/scripts/'.$filename, 'w+');
+            $file_open = fopen($pathToFolow.'bin/notification/scripts/'.$filename, 'w+');
         } else {
             $pathToFolow = $corePath;
-            $file_open = fopen($pathToFolow.'modules/notifications/batch/scripts/'.$filename, 'w+');
+            $file_open = fopen($pathToFolow.'bin/notification/scripts/'.$filename, 'w+');
         }
 
         fwrite($file_open, '#!/bin/sh');
         fwrite($file_open, "\n");
-        fwrite($file_open, 'path=\''.$corePath.'modules/notifications/batch/\'');
+        fwrite($file_open, 'path=\''.$corePath.'bin/notification/\'');
         fwrite($file_open, "\n");
         fwrite($file_open, 'cd $path');
         fwrite($file_open, "\n");
@@ -189,7 +196,7 @@ abstract class NotificationScheduleModelAbstract
         fwrite($file_open, 'php \'process_email_stack.php\' -c '.$ConfigNotif);
         fwrite($file_open, "\n");
         fclose($file_open);
-        shell_exec('chmod +x '.escapeshellarg($pathToFolow.'modules/notifications/batch/scripts/'.$filename));
+        shell_exec('chmod +x '.escapeshellarg($pathToFolow.'bin/notification/scripts/'.$filename));
 
         HistoryController::add([
             'tableName' => 'notifications',
diff --git a/test/unitTests/app/notification/NotificationScheduleControllerTest.php b/test/unitTests/app/notification/NotificationScheduleControllerTest.php
index 2cd548ce74a..00561b6fca1 100755
--- a/test/unitTests/app/notification/NotificationScheduleControllerTest.php
+++ b/test/unitTests/app/notification/NotificationScheduleControllerTest.php
@@ -72,7 +72,7 @@ class NotificationScheduleControllerTest extends TestCase
             'dom' => '',
             'mon' => '*',
             'dow' => '*',
-            'cmd' => $corePath.'modules/notifications/batch/scripts/notification_testtu.sh',
+            'cmd' => $corePath.'bin/notification/scripts/notification_testtu.sh',
             'state' => 'normal',
         ];
 
@@ -81,7 +81,7 @@ class NotificationScheduleControllerTest extends TestCase
         $response = $NotificationScheduleController->create($fullRequest, new \Slim\Http\Response());
         $responseBodyFail = json_decode((string) $response->getBody());
 
-        $this->assertSame( 'wrong format for dom', $responseBodyFail->errors[ count($responseBodyFail->errors) - 1 ] );
+        $this->assertSame('wrong format for dom', $responseBodyFail->errors[ count($responseBodyFail->errors) - 1 ]);
 
         // CREATE
         $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'POST']);
@@ -96,7 +96,7 @@ class NotificationScheduleControllerTest extends TestCase
             'dom' => '*',
             'mon' => '*',
             'dow' => '*',
-            'cmd' => $corePath.'modules/notifications/batch/scripts/notification_testtu.sh',
+            'cmd' => $corePath.'bin/notification/scripts/notification_testtu.sh',
             'state' => 'normal',
         ];
 
@@ -146,7 +146,7 @@ class NotificationScheduleControllerTest extends TestCase
             'dom' => '*',
             'mon' => '*',
             'dow' => '*',
-            'cmd' => $corePath.'modules/notifications/batch/scripts/notification_testtu.sh',
+            'cmd' => $corePath.'bin/notification/scripts/notification_testtu.sh',
             'state' => 'normal',
         ];
 
@@ -181,7 +181,7 @@ class NotificationScheduleControllerTest extends TestCase
         $aArgs = $responseBody->crontab;
 
         foreach ($aArgs as $id => $value) {
-            if ($value->cmd == dirname(__FILE__, 5).'/'.'modules/notifications/batch/scripts/notification_testtu.sh') {
+            if ($value->cmd == dirname(__FILE__, 5).'/'.'bin/notification/scripts/notification_testtu.sh') {
                 $aArgs[$id]->state = 'hidden';
             }
         }
@@ -199,7 +199,7 @@ class NotificationScheduleControllerTest extends TestCase
         $aArgs = $responseBody->crontab;
 
         foreach ($aArgs as $id => $value) {
-            if ($value->cmd == dirname(__FILE__, 5).'/'.'modules/notifications/batch/scripts/notification_testtu.sh') {
+            if ($value->cmd == dirname(__FILE__, 5).'/'.'bin/notification/scripts/notification_testtu.sh') {
                 $aArgs[$id]->state = 'deleted';
             }
         }
@@ -211,6 +211,6 @@ class NotificationScheduleControllerTest extends TestCase
 
         $this->assertSame(true, $responseBody);
 
-        unlink('modules/notifications/batch/scripts/notification_USERS.sh');
+        unlink('bin/notification/scripts/notification_USERS.sh');
     }
 }
-- 
GitLab