set mail to owner if doc status or owner changed or doc is transfered

This commit is contained in:
Uwe Steinmann 2021-12-01 13:06:33 +01:00
parent 11dabf2cb0
commit 7588fb8317

View File

@ -346,8 +346,10 @@ class SeedDMS_NotificationService {
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
/* if user is not owner send notification to owner */
if ($user->getID() != $document->getOwner()->getID())
// if user is not owner and owner not already in list of notifiers, then
// send notification to owner
if($user->getID() != $document->getOwner()->getID() &&
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
$this->sendRequestWorkflowActionMail($lc, $user);
@ -511,8 +513,10 @@ class SeedDMS_NotificationService {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
/* if user is not owner send notification to owner */
if ($user->getID() != $document->getOwner()->getID())
// if user is not owner and owner not already in list of notifiers, then
// send notification to owner
if($user->getID() != $document->getOwner()->getID() &&
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
} /* }}} */
@ -722,8 +726,10 @@ class SeedDMS_NotificationService {
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
// if user is not owner send notification to owner
if ($user->getID() != $folder->getOwner()->getID())
// if user is not owner and owner not already in list of notifiers, then
// send notification to owner
if($user->getID() != $folder->getOwner()->getID() &&
false === SeedDMS_Core_DMS::inList($folder->getOwner(), $notifyList['users']))
$this->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
}
} /* }}} */
@ -804,8 +810,10 @@ class SeedDMS_NotificationService {
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
// if user is not owner send notification to owner
if ($user->getID() != $folder->getOwner()->getID())
// if user is not owner and owner not already in list of notifiers, then
// send notification to owner
if($user->getID() != $folder->getOwner()->getID() &&
false === SeedDMS_Core_DMS::inList($folder->getOwner(), $notifyList['users']))
$this->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
}
} /* }}} */
@ -836,7 +844,8 @@ class SeedDMS_NotificationService {
foreach ($nl["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
// if user is not owner send notification to owner
// if user is not owner and owner not already in list of notifiers, then
// send notification to owner
if ($user->getID() != $document->getOwner()->getID() &&
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
@ -894,6 +903,12 @@ class SeedDMS_NotificationService {
foreach ($nl["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
// if user is not owner and owner not already in list of notifiers, then
// send notification to owner
if ($user->getID() != $document->getOwner()->getID() &&
false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users'])) {
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
}
} /* }}} */
public function sendChangedDocumentStatusMail($content, $user, $oldstatus) { /* {{{ */
@ -1173,7 +1188,11 @@ class SeedDMS_NotificationService {
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
// $this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to old owner only if the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner(), $notifyList['users']))
$this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
}
} /* }}} */
@ -1198,6 +1217,11 @@ class SeedDMS_NotificationService {
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
/* Send mail to old owner only if the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner(), $notifyList['users']))
$this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
}
} /* }}} */