Commit 04e47485 authored by Aurel's avatar Aurel

if no language on person, retrieve from pref & propagate it, also copy content-type from message

parent 6d434964
......@@ -120,7 +120,7 @@ event = module.newContent(**event_kw)\n
\n
if notification_message:\n
event.Event_setTextContentFromNotificationMessage(\n
reference=notification_message)\n
reference=notification_message, language=language)\n
\n
if not keep_draft:\n
if direction == \'incoming\':\n
......@@ -142,7 +142,7 @@ event.Base_redirect(keep_items={\'portal_status_message\': message})\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>title, direction, portal_type, resource, text_content=None, notification_message=None, batch_mode=False, keep_draft=False, follow_up=None, source=None, destination=None, **kw</string> </value>
<value> <string>title, direction, portal_type, resource, text_content=None, notification_message=None, batch_mode=False, keep_draft=False, follow_up=None, source=None, destination=None, language=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -60,6 +60,8 @@ resource_reference = event_path.getResourceReference()\n
source = event_path.getSource()\n
\n
language = context.getLanguage()\n
if not language:\n
language = portal.portal_preferences.getPreferredCustomerRelationLanguage()\n
notification_message = portal.notification_message_module.NotificationTool_getDocumentValue(\n
resource_reference,\n
language=language)\n
......@@ -73,6 +75,7 @@ event = context.Base_addEvent(title=\'\',\n
keep_draft=keep_draft,\n
follow_up=follow_up,\n
source=source,\n
language=language,\n
batch_mode=True)\n
</string> </value>
</item>
......
......@@ -51,8 +51,13 @@
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
if not language:\n
language = context.getLanguage()\n
if not language:\n
language = portal.portal_preferences.getPreferredCustomerRelationLanguage()\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
language=language or context.getLanguage(),\n
language=language,\n
reference=reference)\n
\n
if substitution_method_parameter_dict is None:\n
......@@ -61,16 +66,17 @@ if substitution_method_parameter_dict is None:\n
# This way notification method can return properties from recipient or follow up of the event.\n
substitution_method_parameter_dict.setdefault(\'event_value\', context)\n
\n
target_format = "txt"\n
if context.getTextFormat() == \'text/html\':\n
target_format = "html"\n
\n
if notification_message is not None:\n
context.setTextFormat(notification_message.getTextFormat())\n
target_format = "txt"\n
if context.getTextFormat() == \'text/html\':\n
target_format = "html"\n
mime, text_content = notification_message.convert(target_format,\n
substitution_method_parameter_dict=substitution_method_parameter_dict)\n
context.setTextContent(text_content)\n
context.setAggregateList(notification_message.getProperty(\'aggregate_list\', []))\n
\n
\n
if not context.hasTitle():\n
context.setTitle(notification_message.asSubjectText(\n
substitution_method_parameter_dict=substitution_method_parameter_dict))\n
......
670
\ No newline at end of file
672
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