From 200806effde43a92c69dc7f78f2bef9caa119782 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 31 Aug 2021 10:27:20 +0200 Subject: [PATCH] use new methods to inform approvers/reviewers about deleting/adding a review/approval --- op/op.SetReviewersApprovers.php | 76 +++++++++++---------------------- 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/op/op.SetReviewersApprovers.php b/op/op.SetReviewersApprovers.php index 1abc8ed3d..07a1a9536 100644 --- a/op/op.SetReviewersApprovers.php +++ b/op/op.SetReviewersApprovers.php @@ -132,19 +132,7 @@ foreach ($pIndRev as $p) { // Send an email notification to the new reviewer. if($settings->_enableNotificationAppRev) { if ($notifier) { - $subject = "review_request_email_subject"; - $message = "review_request_email_body"; - $params = array(); - $params['name'] = $document->getName(); - $params['folder_path'] = $folder->getFolderPathPlain(); - $params['version'] = $content->getVersion(); - $params['comment'] = $content->getComment(); - $params['username'] = $user->getFullName(); - $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $params['sitename'] = $settings->_siteName; - $params['http_root'] = $settings->_httpRoot; - - $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$p]], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); + $notifier->sendAddReviewMail($content, $user, $docAccess["users"][$accessIndex["i"][$p]]); } } break; @@ -198,6 +186,8 @@ if (count($reviewIndex["i"]) > 0) { // Send an email notification to the reviewer. if($settings->_enableNotificationAppRev) { if ($notifier) { + $notifier->sendDeleteReviewMail($content, $user, $docAccess["users"][$accessIndex["i"][$rx]]); + /* $subject = "review_deletion_email_subject"; $message = "review_deletion_email_body"; $params = array(); @@ -211,6 +201,7 @@ if (count($reviewIndex["i"]) > 0) { $params['http_root'] = $settings->_httpRoot; $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$rx]], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); + */ } } break; @@ -244,19 +235,7 @@ foreach ($pGrpRev as $p) { // Send an email notification to the new reviewer. if($settings->_enableNotificationAppRev) { if ($notifier) { - $subject = "review_request_email_subject"; - $message = "review_request_email_body"; - $params = array(); - $params['name'] = $document->getName(); - $params['folder_path'] = $folder->getFolderPathPlain(); - $params['version'] = $content->getVersion(); - $params['comment'] = $content->getComment(); - $params['username'] = $user->getFullName(); - $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $params['sitename'] = $settings->_siteName; - $params['http_root'] = $settings->_httpRoot; - - $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$p]], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); + $notifier->sendAddReviewMail($content, $user, $docAccess["groups"][$accessIndex["g"][$p]]); } } break; @@ -302,6 +281,8 @@ if (count($reviewIndex["g"]) > 0) { // Send an email notification to the review group. if($settings->_enableNotificationAppRev) { if ($notifier) { + $notifier->sendDeleteReviewMail($content, $user, $docAccess["groups"][$accessIndex["g"][$rx]]); + /* $subject = "review_deletion_email_subject"; $message = "review_deletion_email_body"; $params = array(); @@ -315,6 +296,7 @@ if (count($reviewIndex["g"]) > 0) { $params['http_root'] = $settings->_httpRoot; $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$rx]], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); + */ } } break; @@ -363,20 +345,12 @@ foreach ($pIndApp as $p) { case 0: // Send an email notification to the new approver. if($settings->_enableNotificationAppRev) { + /* Send notification only if document is currently not in review state, + * because then the approvers will be informed anyway when review state + * is left and approval state is entered. + */ if ($overallStatus["status"]!=0 && $notifier) { - $subject = "approval_request_email_subject"; - $message = "approval_request_email_body"; - $params = array(); - $params['name'] = $document->getName(); - $params['folder_path'] = $folder->getFolderPathPlain(); - $params['version'] = $content->getVersion(); - $params['comment'] = $content->getComment(); - $params['username'] = $user->getFullName(); - $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $params['sitename'] = $settings->_siteName; - $params['http_root'] = $settings->_httpRoot; - - $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$p]], $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); + $notifier->sendAddApprovalMail($content, $user, $docAccess["users"][$accessIndex["i"][$p]]); } } break; @@ -422,6 +396,8 @@ if (count($approvalIndex["i"]) > 0) { // Send an email notification to the approver. if($settings->_enableNotificationAppRev) { if ($notifier) { + $notifier->sendDeleteApprovalMail($content, $user, $docAccess["users"][$accessIndex["i"][$rx]]); + /* $subject = "approval_deletion_email_subject"; $message = "approval_deletion_email_body"; $params = array(); @@ -435,6 +411,7 @@ if (count($approvalIndex["i"]) > 0) { $params['http_root'] = $settings->_httpRoot; $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$rx]], $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); + */ } } break; @@ -467,20 +444,12 @@ foreach ($pGrpApp as $p) { case 0: // Send an email notification to the new approver. if($settings->_enableNotificationAppRev) { + /* Send notification only if document is currently not in review state, + * because then the approvers will be informed anyway when review state + * is left and approval state is entered. + */ if ($overallStatus["status"]!=0 && $notifier) { - $subject = "approval_request_email_subject"; - $message = "approval_request_email_body"; - $params = array(); - $params['name'] = $document->getName(); - $params['folder_path'] = $folder->getFolderPathPlain(); - $params['version'] = $content->getVersion(); - $params['comment'] = $content->getComment(); - $params['username'] = $user->getFullName(); - $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $params['sitename'] = $settings->_siteName; - $params['http_root'] = $settings->_httpRoot; - - $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$p]], $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); + $notifier->sendAddApprovalMail($content, $user, $docAccess["groups"][$accessIndex["g"][$p]]); } } break; @@ -526,6 +495,8 @@ if (count($approvalIndex["g"]) > 0) { // Send an email notification to the approval group. if($settings->_enableNotificationAppRev) { if ($notifier) { + $notifier->sendDeleteApprovalMail($content, $user, $docAccess["groups"][$accessIndex["g"][$rx]]); + /* $subject = "approval_deletion_email_subject"; $message = "approval_deletion_email_body"; $params = array(); @@ -539,6 +510,7 @@ if (count($approvalIndex["g"]) > 0) { $params['http_root'] = $settings->_httpRoot; $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$rx]], $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); + */ } } break;