mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-30 20:51:22 +00:00 
			
		
		
		
	use methods in notification service for sending mails
This commit is contained in:
		
							parent
							
								
									d6a296c071
								
							
						
					
					
						commit
						07b8ab9706
					
				|  | @ -281,120 +281,9 @@ default: | ||||||
| 	} else { | 	} else { | ||||||
| 		// Send notification to subscribers.
 | 		// Send notification to subscribers.
 | ||||||
| 		if($notifier) { | 		if($notifier) { | ||||||
| 			$notifyList = $document->getNotifyList(); | 			$notifier->sendNewDocumentVersionMail($document, $user); | ||||||
| 			$folder = $document->getFolder(); |  | ||||||
| 
 | 
 | ||||||
| 			$subject = "document_updated_email_subject"; | 			$notifier->sendChangedExpiryMail($document, $user, $oldexpires); | ||||||
| 			$message = "document_updated_email_body"; |  | ||||||
| 			$params = array(); |  | ||||||
| 			$params['name'] = $document->getName(); |  | ||||||
| 			$params['folder_path'] = $folder->getFolderPathPlain(); |  | ||||||
| 			$params['username'] = $user->getFullName(); |  | ||||||
| 			$params['comment'] = $document->getComment(); |  | ||||||
| 			$params['version_comment'] = $content->getComment(); |  | ||||||
| 			$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); |  | ||||||
| 			$params['sitename'] = $settings->_siteName; |  | ||||||
| 			$params['http_root'] = $settings->_httpRoot; |  | ||||||
| 			$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); |  | ||||||
| 			foreach ($notifyList["groups"] as $grp) { |  | ||||||
| 				$notifier->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()) 
 |  | ||||||
| //				$notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
 |  | ||||||
| 
 |  | ||||||
| 			/* Get workflow from controller in case it was modified in a hook */ |  | ||||||
| 			$workflow = $controller->getParam('workflow'); |  | ||||||
| 			if($workflow && $settings->_enableNotificationWorkflow) { |  | ||||||
| 				$subject = "request_workflow_action_email_subject"; |  | ||||||
| 				$message = "request_workflow_action_email_body"; |  | ||||||
| 				$params = array(); |  | ||||||
| 				$params['name'] = $document->getName(); |  | ||||||
| 				$params['version'] = $content->getVersion(); |  | ||||||
| 				$params['workflow'] = $workflow->getName(); |  | ||||||
| 				$params['folder_path'] = $folder->getFolderPathPlain(); |  | ||||||
| 				$params['current_state'] = $workflow->getInitState()->getName(); |  | ||||||
| 				$params['username'] = $user->getFullName(); |  | ||||||
| 				$params['sitename'] = $settings->_siteName; |  | ||||||
| 				$params['http_root'] = $settings->_httpRoot; |  | ||||||
| 				$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); |  | ||||||
| 
 |  | ||||||
| 				foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) { |  | ||||||
| 					foreach($ntransition->getUsers() as $tuser) { |  | ||||||
| 						$notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); |  | ||||||
| 					} |  | ||||||
| 					foreach($ntransition->getGroups() as $tuser) { |  | ||||||
| 						$notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if($settings->_enableNotificationAppRev) { |  | ||||||
| 				/* Reviewers and approvers will be informed about the new document */ |  | ||||||
| 				/* Get reviewers and approvers from controller in case it was |  | ||||||
| 				 * modified in a hook |  | ||||||
| 				 */ |  | ||||||
| 				$reviewers = $controller->getParam('reviewers'); |  | ||||||
| 				$approvers = $controller->getParam('approvers'); |  | ||||||
| 				if($reviewers['i'] || $reviewers['g']) { |  | ||||||
| 					$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; |  | ||||||
| 
 |  | ||||||
| 					foreach($reviewers['i'] as $reviewerid) { |  | ||||||
| 						$notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); |  | ||||||
| 					} |  | ||||||
| 					foreach($reviewers['g'] as $reviewergrpid) { |  | ||||||
| 						$notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 
 |  | ||||||
| 				elseif($approvers['i'] || $approvers['g']) { |  | ||||||
| 					$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; |  | ||||||
| 
 |  | ||||||
| 					foreach($approvers['i'] as $approverid) { |  | ||||||
| 						$notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); |  | ||||||
| 					} |  | ||||||
| 					foreach($approvers['g'] as $approvergrpid) { |  | ||||||
| 						$notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if($oldexpires != $document->getExpires()) { |  | ||||||
| 				// Send notification to subscribers.
 |  | ||||||
| 				$subject = "expiry_changed_email_subject"; |  | ||||||
| 				$message = "expiry_changed_email_body"; |  | ||||||
| 				$params = array(); |  | ||||||
| 				$params['name'] = $document->getName(); |  | ||||||
| 				$params['folder_path'] = $folder->getFolderPathPlain(); |  | ||||||
| 				$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->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); |  | ||||||
| 				foreach ($notifyList["groups"] as $grp) { |  | ||||||
| 					$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if($settings->_removeFromDropFolder) { | 		if($settings->_removeFromDropFolder) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann