diff --git a/lib/Activity/Provider.php b/lib/Activity/Provider.php index 1d5c2dfb877ead627760b947b16f4c357ddd5534..787e5be213a709b31610fb9f2a7bdf86d4b5b7f6 100644 --- a/lib/Activity/Provider.php +++ b/lib/Activity/Provider.php @@ -38,7 +38,7 @@ class Provider implements IProvider { /** @var string */ protected $lastType = ''; - const SUBJECT_ARCHIVES_PROCESSED = 'job_processed'; + const SUBJECT_ARCHIVES_PROCESSED_ACTIVITY = 'job_processed_activity'; /** * @param IFactory $languageFactory @@ -116,7 +116,7 @@ class Provider implements IProvider { $parameters = $event->getSubjectParameters(); switch ($subject) { - case self::SUBJECT_ARCHIVES_PROCESSED: + case self::SUBJECT_ARCHIVES_PROCESSED_ACTIVITY: return [ 'nb_success' => $parameters[0], 'nb_total' => $parameters[1], diff --git a/lib/BackgroundJob/ArchiveProcess.php b/lib/BackgroundJob/ArchiveProcess.php index c330a0c1d8d8950ec340784a96571d867dfe9788..f44c6eba4a61774a25af6d0e56581f30cf92c392 100644 --- a/lib/BackgroundJob/ArchiveProcess.php +++ b/lib/BackgroundJob/ArchiveProcess.php @@ -19,6 +19,8 @@ use Exception; use OCA\Dematpayslip\Db\DematpayslipArchive; use OCA\Dematpayslip\Db\DematpayslipArchiveMapper; use OCA\Dematpayslip\Db\DematpayslipUserMapper; +use OCA\Dematpayslip\Activity\Provider; +use OCA\Dematpayslip\Notification\Notifier; /** @@ -283,7 +285,7 @@ class ArchiveProcess extends TimedJob { ->setType('job_processed') ->setAffectedUser($userId) ->setTimestamp($dateTimeNow->getTimestamp()) - ->setSubject('job_processed', [$nbSuccess, $nbTotal]); + ->setSubject(Provider::SUBJECT_ARCHIVES_PROCESSED_ACTIVITY, [$nbSuccess, $nbTotal]); //->setLink($folderLink) //->setObject('folder', $folder->getId(), $folder->getUuid()); $this->_activityManager->publish($event); @@ -292,7 +294,7 @@ class ArchiveProcess extends TimedJob { $this->_log('Notification add : archives processed'); $notification = $this->_notificationManager->createNotification(); $notification->setApp($this->_appName) - ->setSubject('job_processed', ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal]) + ->setSubject(Notifier::SUBJECT_JOB_PROCESSED_NOTIFY, ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal]) ->setObject('dematpayslip_process', $dateTimeNow->getTimestamp()) ->setUser($userId); //->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png'))) diff --git a/lib/BackgroundJob/IndexationProcess.php b/lib/BackgroundJob/IndexationProcess.php index 23870c8693c8f3199bd9a364c84457b656c33fc8..b7c1c2c2b91ef155fcee32bb407352495003f980 100644 --- a/lib/BackgroundJob/IndexationProcess.php +++ b/lib/BackgroundJob/IndexationProcess.php @@ -22,9 +22,11 @@ use OCA\Dematpayslip\Db\DematpayslipArchiveMapper; use OCA\Dematpayslip\Db\DematpayslipProcessMapper; use OCA\Dematpayslip\Db\DematpayslipProcessSkipMapper; use OCA\Dematpayslip\Db\DematpayslipUserMapper; +use OCA\Dematpayslip\Activity\Provider; +use OCA\Dematpayslip\Notification\Notifier; -/** + /** * Clean up all file locks that are expired for the DB file locking provider */ class IndexationProcess extends TimedJob { @@ -296,7 +298,7 @@ class IndexationProcess extends TimedJob { ->setType('job_processed') ->setAffectedUser($userId) ->setTimestamp($dateTimeNow->getTimestamp()) - ->setSubject('job_processed', [$nbSuccess, $nbTotal]); + ->setSubject(Provider::SUBJECT_ARCHIVES_PROCESSED_ACTIVITY, [$nbSuccess, $nbTotal]); //->setLink($folderLink) //->setObject('folder', $folder->getId(), $folder->getUuid()); $this->_activityManager->publish($event); @@ -305,7 +307,7 @@ class IndexationProcess extends TimedJob { $this->_log('Notification add : indexation processed'); $notification = $this->_notificationManager->createNotification(); $notification->setApp($this->_appName) - ->setSubject('job_processed', ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal]) + ->setSubject(Notifier::SUBJECT_JOB_PROCESSED_NOTIFY, ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal]) ->setObject('dematpayslip_process', $dateTimeNow->getTimestamp()) ->setUser($userId); //->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png'))) diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index b63258bb84e026a109cdb11cc5fb61d0cd149671..bbc8e819bfdc444e7e91fdf7cf2413f5fbc76086 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -43,7 +43,7 @@ class Notifier implements INotifier { /** @var IURLGenerator */ protected $url; - const SUBJECT_ARCHIVES_PROCESSED = 'job_processed'; + const SUBJECT_JOB_PROCESSED_NOTIFY = 'job_processed_notify'; /** * @param IFactory $factory @@ -93,7 +93,7 @@ class Notifier implements INotifier { } switch ($notification->getSubject()) { - case self::SUBJECT_ARCHIVES_PROCESSED: + case self::SUBJECT_JOB_PROCESSED_NOTIFY: $subject = $this->getSubject($notification, $languageCode); if ($subject === '') { // Everything done, mark the notification as processed...