Commit c49e5417 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 b3ff78f0
......@@ -51,20 +51,17 @@
<item>
<key> <string>_body</string> </key>
<value> <string>event = state_change[\'object\']\n
portal = event.getPortalObject()\n
\n
# FIXME: we should always call send here, and the type based method must\n
# decide what to do.\n
\n
if event.getPortalType() in (\'Mail Message\', ):\n
if event.getSource():\n
event.send()\n
else:\n
# FIXME: this "email only" logic must be moved to MailMessage_send\n
sender_email = portal.portal_preferences.getPreferredEventSenderEmail()\n
if not sender_email:\n
raise NotImplementedError(\'Preferred Event Sender Email not configured\')\n
event.send(from_url=portal.portal_preferences.getPreferredEventSenderEmail())\n
# Manually turn the SafeMapping from kwargs into a dict.\n
kwargs = dict()\n
# XXX maybe at least we could introspect the arguments ?\n
for key in (\'from_url\', \'to_url\', \'reply_url\', \'subject\', \n
\'body\', \'attachment_format\', \'attachment_list\', \'download\'):\n
state_change_arg = state_change[\'kwargs\'].get(key)\n
if state_change_arg:\n
kwargs[key] = state_change_arg\n
\n
event.send(**kwargs) # will call type based method\n
</string> </value>
</item>
<item>
......
680
\ No newline at end of file
684
\ 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