Commit 4dad33bd authored by Jérome Perrin's avatar Jérome Perrin

CRM: send all events (Compatibility warning below)

This rely on a change in erp5_base where Event_send does nothing and MailMessage_send sends email instead, otherwise mails will be sent for all started events.
parent ee8facd0
...@@ -51,20 +51,21 @@ ...@@ -51,20 +51,21 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>event = state_change[\'object\']\n <value> <string>event = state_change[\'object\']\n
portal = event.getPortalObject()\n
\n \n
# FIXME: we should always call send here, and the type based method must\n send_method = event.getTypeBasedMethod(\'send\')\n
# decide what to do.\n parameter_list = (\'from_url\', \'to_url\', \'reply_url\', \'subject\',\n
\'body\', \'attachment_format\', \'attachment_list\',)\n
if getattr(send_method, \'meta_type\', None) == \'Script (Python)\':\n
parameter_list = send_method.ZScriptHTML_tryParams()\n
\n \n
if event.getPortalType() in (\'Mail Message\', ):\n # Turn the SafeMapping from keyword arguments into a dict.\n
if event.getSource():\n kwargs = dict()\n
event.send()\n for key in parameter_list:\n
else:\n state_change_arg = state_change[\'kwargs\'].get(key)\n
# FIXME: this "email only" logic must be moved to MailMessage_send\n if state_change_arg:\n
sender_email = portal.portal_preferences.getPreferredEventSenderEmail()\n kwargs[key] = state_change_arg\n
if not sender_email:\n \n
raise NotImplementedError(\'Preferred Event Sender Email not configured\')\n event.send(**kwargs) # will call type based method\n
event.send(from_url=portal.portal_preferences.getPreferredEventSenderEmail())\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
680 685
\ No newline at end of file \ No newline at end of file
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