From 69135f2a9ada973af72a989028f9c764fd41cd25 Mon Sep 17 00:00:00 2001
From: lvessiller <lvessiller@open-dsi.fr>
Date: Mon, 16 Aug 2021 16:19:16 +0200
Subject: [PATCH] NEW ajout de notification apres tache planifiee

---
 lib/BackgroundJob/ArchiveProcess.php    | 24 ++++++++++++------------
 lib/BackgroundJob/IndexationProcess.php | 24 ++++++++++++------------
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/lib/BackgroundJob/ArchiveProcess.php b/lib/BackgroundJob/ArchiveProcess.php
index f850cfe..c330a0c 100644
--- a/lib/BackgroundJob/ArchiveProcess.php
+++ b/lib/BackgroundJob/ArchiveProcess.php
@@ -289,18 +289,18 @@ class ArchiveProcess extends TimedJob {
                         $this->_activityManager->publish($event);
 
                         // notification
-//                        $this->_log('Notification add : archives processed');
-//                        $notification = $this->_notificationManager->createNotification();
-//                        $notification->setApp($this->_appName)
-//                            ->setSubject('job_processed', ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal])
-//                            ->setObject('dematpayslip_process', $dateTimeNow->getTimestamp())
-//                            ->setUser($userId);
-//                        //->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png')))
-//                        //->setLink($folderLink);
-//                        if ($this->_notificationManager->getCount($notification) === 0) {
-//                            $notification->setDateTime(new DateTime());
-//                            $this->_notificationManager->notify($notification);
-//                        }
+                        $this->_log('Notification add : archives processed');
+                        $notification = $this->_notificationManager->createNotification();
+                        $notification->setApp($this->_appName)
+                            ->setSubject('job_processed', ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal])
+                            ->setObject('dematpayslip_process', $dateTimeNow->getTimestamp())
+                            ->setUser($userId);
+                        //->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png')))
+                        //->setLink($folderLink);
+                        if ($this->_notificationManager->getCount($notification) === 0) {
+                            $notification->setDateTime(new DateTime());
+                            $this->_notificationManager->notify($notification);
+                        }
                     }
                 }
                 $this->_log('Archives process : End');
diff --git a/lib/BackgroundJob/IndexationProcess.php b/lib/BackgroundJob/IndexationProcess.php
index bb80bb4..23870c8 100644
--- a/lib/BackgroundJob/IndexationProcess.php
+++ b/lib/BackgroundJob/IndexationProcess.php
@@ -302,18 +302,18 @@ class IndexationProcess extends TimedJob {
                                 $this->_activityManager->publish($event);
 
                                 // notification
-//                                $this->_log('Notification add : indexation processed');
-//                                $notification = $this->_notificationManager->createNotification();
-//                                $notification->setApp($this->_appName)
-//                                    ->setSubject('job_processed', ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal])
-//                                    ->setObject('dematpayslip_process', $dateTimeNow->getTimestamp())
-//                                    ->setUser($userId);
-//                                //->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png')))
-//                                //->setLink($folderLink);
-//                                if ($this->_notificationManager->getCount($notification) === 0) {
-//                                    $notification->setDateTime(new DateTime());
-//                                    $this->_notificationManager->notify($notification);
-//                                }
+                                $this->_log('Notification add : indexation processed');
+                                $notification = $this->_notificationManager->createNotification();
+                                $notification->setApp($this->_appName)
+                                    ->setSubject('job_processed', ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal])
+                                    ->setObject('dematpayslip_process', $dateTimeNow->getTimestamp())
+                                    ->setUser($userId);
+                                //->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png')))
+                                //->setLink($folderLink);
+                                if ($this->_notificationManager->getCount($notification) === 0) {
+                                    $notification->setDateTime(new DateTime());
+                                    $this->_notificationManager->notify($notification);
+                                }
                             }
                         }
                     }
-- 
GitLab