From d8c116f45e0fee3280bb4d0e017781f9da232d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 23 Dec 2013 13:12:01 +0100 Subject: [PATCH] little simplifications --- .../portal_skins/erp5_base/Entity_sendEmail.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml index 916a22e27e..99c356f614 100644 --- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml +++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml @@ -59,11 +59,11 @@ body = event.getTextContent()\n sender = event.getSourceValue()\n if kw.get("from_url") is not None:\n from_url = kw.get("from_url")\n -elif event.getSource() is not None:\n - sender = event.getSourceValue()\n +elif sender is not None:\n from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n else:\n from_url = portal.portal_preferences.getPreferredEventSenderEmail()\n +\n attachment_list = kw.pop(\'attachment_list\', [])\n \n to_url = formataddr((context.getTitle(), context.getDefaultEmailText()))\n @@ -72,7 +72,7 @@ document_type_list = list(event.getPortalEmbeddedDocumentTypeList()) + list(even embedded_file_list = event.getAggregateValueList(portal_type=document_type_list)\n \n content_type = event.getContentType()\n -mail_message = context.Base_createMailMessageAsString(from_url,\n +mail_message = portal.Base_createMailMessageAsString(from_url,\n to_url,\n subject,\n body,\n @@ -83,6 +83,9 @@ mail_message = context.Base_createMailMessageAsString(from_url,\n event.sendMailHostMessage(mail_message)\n \n if not event.hasData():\n + # Store the content of the email as data, so that we can keep a reference to\n + # the email that was actually sent.\n + # XXX this has no meaning in the case of an email with multiple recipents.\n if len(embedded_file_list):\n # do not store aggregated documents in Email document\n # to avoid duplicate data\n -- 2.30.9