From 7287854cc05fc6ab32a4e1727da94c366bfa2eab Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 3 Nov 2015 15:43:44 +0200 Subject: [PATCH] silent and noStream --- application/Espo/Hooks/Common/Notifications.php | 4 ++-- application/Espo/Hooks/Common/Stream.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/Espo/Hooks/Common/Notifications.php b/application/Espo/Hooks/Common/Notifications.php index 6105bc8d34..c8da1c4924 100644 --- a/application/Espo/Hooks/Common/Notifications.php +++ b/application/Espo/Hooks/Common/Notifications.php @@ -95,7 +95,7 @@ class Notifications extends \Espo\Core\Hooks\Base public function afterSave(Entity $entity, array $options = array()) { - if (!empty($options['silent']) && !empty($options['noNotifications'])) { + if (!empty($options['silent']) || !empty($options['noNotifications'])) { return; } @@ -111,7 +111,7 @@ class Notifications extends \Espo\Core\Hooks\Base public function beforeRemove(Entity $entity, array $options = array()) { - if (!empty($options['silent']) && !empty($options['noNotifications'])) { + if (!empty($options['silent']) || !empty($options['noNotifications'])) { return; } diff --git a/application/Espo/Hooks/Common/Stream.php b/application/Espo/Hooks/Common/Stream.php index d337990ad2..05057c29cb 100644 --- a/application/Espo/Hooks/Common/Stream.php +++ b/application/Espo/Hooks/Common/Stream.php @@ -180,7 +180,7 @@ class Stream extends \Espo\Core\Hooks\Base $this->getStreamService()->followEntityMass($entity, $userIdList); } - if (empty($options['noStream'])) { + if (empty($options['noStream']) && empty($options['silent'])) { $this->getStreamService()->noteCreate($entity); } @@ -211,7 +211,7 @@ class Stream extends \Espo\Core\Hooks\Base } } else { - if (empty($options['noStream'])) { + if (empty($options['noStream']) && empty($options['silent'])) { if ($entity->isFieldChanged('assignedUserId')) { $assignedUserId = $entity->get('assignedUserId'); if (!empty($assignedUserId)) { @@ -239,7 +239,7 @@ class Stream extends \Espo\Core\Hooks\Base } - if ($entity->isNew() && empty($options['noStream']) && $this->getMetadata()->get("scopes.{$entityName}.tab")) { + if ($entity->isNew() && empty($options['noStream']) && empty($options['silent']) && $this->getMetadata()->get("scopes.{$entityName}.tab")) { $this->handleCreateRelated($entity); } }