Commit a1c3aaf4 authored by Vincent Pelletier's avatar Vincent Pelletier

Honor alarm_notification_mode property value.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20192 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b980fcb4
...@@ -430,14 +430,19 @@ class Alarm(XMLObject, PeriodicityMixin): ...@@ -430,14 +430,19 @@ class Alarm(XMLObject, PeriodicityMixin):
to the system address if nothing was defined or to to the system address if nothing was defined or to
notify all agents defined on the alarm if specified. notify all agents defined on the alarm if specified.
""" """
notification_tool = getToolByName(self, 'portal_notifications') notification_mode = self.getAlarmNotificationMode()
candidate_list = self.getDestinationValueList() if notification_mode == 'never':
if not candidate_list: return
candidate_list = None
if self.sense(): if self.sense():
prefix = 'ERROR' prefix = 'ERROR'
else: else:
if notification_mode != 'always'
return
prefix = 'INFO' prefix = 'INFO'
notification_tool = getToolByName(self, 'portal_notifications')
candidate_list = self.getDestinationValueList()
if not candidate_list:
candidate_list = None
notification_tool.sendMessage(recipient=candidate_list, notification_tool.sendMessage(recipient=candidate_list,
subject='[%s] ERP5 Alarm Notification: %s' % subject='[%s] ERP5 Alarm Notification: %s' %
(prefix, self.getTitle()), (prefix, self.getTitle()),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment