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 @@
<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
send_method = event.getTypeBasedMethod(\'send\')\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
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
# Turn the SafeMapping from keyword arguments into a dict.\n
kwargs = dict()\n
for key in parameter_list:\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
685
\ 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