From aa798bfdd0aacf5214bed58bb042dece4899a8a7 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Thu, 25 Aug 2011 09:36:55 +0300 Subject: [PATCH] Allow to control if outgoing password reset requests are to be stored as events (i.e. Mail Message) in CRM event_module. Typo & XXX: comment added. --- product/ERP5/Tool/NotificationTool.py | 3 ++- product/ERP5/Tool/PasswordTool.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/product/ERP5/Tool/NotificationTool.py b/product/ERP5/Tool/NotificationTool.py index e16d5b4289..e9f1610aa3 100644 --- a/product/ERP5/Tool/NotificationTool.py +++ b/product/ERP5/Tool/NotificationTool.py @@ -356,8 +356,9 @@ class NotificationTool(BaseTool): event.setAggregateValueList(attachment_document_list) event_list.append(event) - portal_workflow = getToolByName(self, 'portal_workflow') for event in event_list: + # XXX: this uses too low level API, instead event_workflow should be used in case + # of persistent ERP5 objects event.send(**low_level_kw) return diff --git a/product/ERP5/Tool/PasswordTool.py b/product/ERP5/Tool/PasswordTool.py index 3e2fdaa4be..65a54cd890 100644 --- a/product/ERP5/Tool/PasswordTool.py +++ b/product/ERP5/Tool/PasswordTool.py @@ -97,7 +97,8 @@ class PasswordTool(BaseTool): return url def mailPasswordResetRequest(self, user_login=None, REQUEST=None, - notification_message=None, sender=None): + notification_message=None, sender=None, + store_as_event=False): """ Create a random string and expiration date for request Parameters: @@ -106,7 +107,10 @@ class PasswordTool(BaseTool): notification_message -- Notification Message Document used to build the email. As default, a standart text will be used. sender -- Sender (Person or Organisation) of the email. - As default, the default email address will be used""" + As default, the default email address will be used + store_as_event -- whenever CRM is available, store + notifications as events + """ if REQUEST is None: REQUEST = get_request() @@ -192,8 +196,8 @@ class PasswordTool(BaseTool): message = notification_message.asText(substitution_method_parameter_dict=message_dict) self.getPortalObject().portal_notifications.sendMessage(sender=sender, recipient=[user,], - subject=subject, message=message) - + subject=subject, message=message, + store_as_event=store_as_event) if REQUEST is not None: msg = translateString("An email has been sent to you.") parameter = urlencode(dict(portal_status_message=msg)) -- 2.30.9