do not send email twice to a user, do not send email if expiration

hasn't changed
This commit is contained in:
Uwe Steinmann 2015-03-17 17:45:53 +01:00
parent 3f46cbad5b
commit 78cb252e9d

View File

@ -106,13 +106,16 @@ if (($oldname = $document->getName()) != $name) {
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
// if user is not owner send notification to owner
if ($user->getID() != $document->getOwner()->getID() &&
!SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
$notifyList['users'][] = $document->getOwner();
}
$notifier->toList($user, $notifyList["users"], $subject, $message, $params);
foreach ($notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
}
// if user is not owner send notification to owner
if ($user->getID() != $document->getOwner()->getID())
$notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params);
}
}
@ -157,14 +160,16 @@ if (($oldcomment = $document->getComment()) != $comment) {
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
// if user is not owner send notification to owner
if ($user->getID() != $document->getOwner()->getID() &&
!SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
$notifyList['users'][] = $document->getOwner();
}
$notifier->toList($user, $notifyList["users"], $subject, $message, $params);
foreach ($notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
}
// if user is not owner send notification to owner
if ($user->getID() != $document->getOwner()->getID())
$notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params);
}
}
else {
@ -182,7 +187,7 @@ if ($_POST["expires"] != "false") {
}
}
//if ($expires) {
if ($expires != $document->getExpires()) {
if($document->setExpires($expires)) {
if($notifier) {
$notifyList = $document->getNotifyList();
@ -197,6 +202,12 @@ if ($_POST["expires"] != "false") {
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
// if user is not owner send notification to owner
if ($user->getID() != $document->getOwner()->getID() &&
!SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
$notifyList['users'][] = $document->getOwner();
}
$notifier->toList($user, $notifyList["users"], $subject, $message, $params);
foreach ($notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
@ -205,7 +216,7 @@ if ($_POST["expires"] != "false") {
} else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
//}
}
if (($oldkeywords = $document->getKeywords()) != $keywords) {
if($document->setKeywords($keywords)) {