Commit 646b1f94 authored by Aurel's avatar Aurel

prevent multiple conversions of report when storing as document

parent 5b6f364a
...@@ -23,9 +23,12 @@ with portal.Localizer.translationContext(localizer_language): ...@@ -23,9 +23,12 @@ with portal.Localizer.translationContext(localizer_language):
return data.decode('bz2') return data.decode('bz2')
except IOError: except IOError:
return data.decode('zlib') return data.decode('zlib')
if portal.portal_preferences.getPreferredDeferredReportStoredAsDocument():
pt_render_format = None
else:
pt_render_format = format
report_data = context.restrictedTraverse(form_path).report_view.pt_render( report_data = context.restrictedTraverse(form_path).report_view.pt_render(
extra_context=dict(options={'format': format}, extra_context=dict(options={'format': pt_render_format},
rendered_report_item_list=(decodeReportSection(r[1]) for r in report_section_list), rendered_report_item_list=(decodeReportSection(r[1]) for r in report_section_list),
report_method=dummyReportMethod, report_method=dummyReportMethod,
form=portal.restrictedTraverse(form_path))) form=portal.restrictedTraverse(form_path)))
...@@ -52,4 +55,5 @@ portal.ERP5Site_notifyReportComplete( ...@@ -52,4 +55,5 @@ portal.ERP5Site_notifyReportComplete(
user_name=user_name, user_name=user_name,
subject=title, subject=title,
message='', message='',
attachment_list=attachment_list) attachment_list=attachment_list,
format=format)
...@@ -11,15 +11,16 @@ if prefs.getPreferredDeferredReportStoredAsDocument(): ...@@ -11,15 +11,16 @@ if prefs.getPreferredDeferredReportStoredAsDocument():
publication_section=prefs.getPreferredDeferredReportPublicationSection(), publication_section=prefs.getPreferredDeferredReportPublicationSection(),
classification=prefs.getPreferredDeferredReportClassification(), classification=prefs.getPreferredDeferredReportClassification(),
filename=attachment['name'], filename=attachment['name'],
title=attachment['name'],) #title=attachment['name'],
)
document.share() document.share()
report_item_list.append( report_item_list.append(
(attachment.get('title', attachment['name']), (attachment.get('title', document.getStandardFilename(format=format)), #attachment['name']),
document.getRelativeUrl())) document.getRelativeUrl()))
url_base = portal.ERP5Site_getAbsoluteUrl() url_base = portal.ERP5Site_getAbsoluteUrl()
report_url_text = '<br/>'.join([ report_url_text = '<br/>'.join([
'''<a href="%s/%s">%s</a>''' % (url_base , report_url, report_name ) for (report_name, report_url) in report_item_list ]) '''<a href="%s/%s?format=%s">%s</a>''' % (url_base , report_url, format, report_name ) for (report_name, report_url) in report_item_list ])
message = '%s<br/>%s' % ( newline_to_br(html_quote(message)), report_url_text ) message = '%s<br/>%s' % ( newline_to_br(html_quote(message)), report_url_text )
message_text_format = "text/html" message_text_format = "text/html"
attachment_list = [] attachment_list = []
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>user_name, subject, message, attachment_list</string> </value> <value> <string>user_name, subject, message, attachment_list, format=None</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
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