Commit 78a30a14 authored by Sven Franck's avatar Sven Franck

erp5_corporate_identity: add start/stop date and source on reports

parent 894296a8
...@@ -15,6 +15,7 @@ Export WebPage as Report ...@@ -15,6 +15,7 @@ Export WebPage as Report
# document_language: use as document version # document_language: use as document version
# document_reference: use as document reference # document_reference: use as document reference
# document_title use as document title # document_title use as document title
# override_source_organisation_title organisation for report header/footer
# override_batch_mode used for tests # override_batch_mode used for tests
# #
# document_download: download file directly # document_download: download file directly
...@@ -27,6 +28,9 @@ Export WebPage as Report ...@@ -27,6 +28,9 @@ Export WebPage as Report
# display_depth level of depth to display # display_depth level of depth to display
# display_milestone show milestones where applicable # display_milestone show milestones where applicable
# #
# start_date start date of the report
# stop_date stop_date of the report
#
# report_name report to generate # report_name report to generate
# report_title report title # report_title report title
...@@ -44,8 +48,11 @@ return context.Base_viewAsReport( ...@@ -44,8 +48,11 @@ return context.Base_viewAsReport(
display_orphan=display_orphan, display_orphan=display_orphan,
display_header=display_header, display_header=display_header,
display_milestone=display_milestone, display_milestone=display_milestone,
start_date=start_date,
stop_date=stop_date,
report_name=report_name, report_name=report_name,
report_title=report_title, report_title=report_title,
batch_mode=batch_mode, batch_mode=batch_mode,
override_source_organisation_title=override_source_organisation_title,
**kw **kw
) )
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>format=None, batch_mode=None, display_orphan=None, display_milestone=None, document_save=None, document_download=None, document_language=None, document_reference=None, document_version=None, display_detail=None, display_depth=None, display_comment=None, display_header=None, report_title=None, document_title=None, report_name=None, *args,**kw</string> </value> <value> <string>format=None, batch_mode=None, override_source_organisation_title=None, display_orphan=None, display_milestone=None, document_save=None, document_download=None, document_language=None, document_reference=None, document_version=None, display_detail=None, display_depth=None, display_comment=None, display_header=None, report_title=None, document_title=None, report_name=None, start_date=None, stop_date=None, *args,**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -16,6 +16,7 @@ Export WebPage as Report ...@@ -16,6 +16,7 @@ Export WebPage as Report
# document_reference: use as document reference # document_reference: use as document reference
# document_title use as document title # document_title use as document title
# override_batch_mode used for tests # override_batch_mode used for tests
# override_source_organisation_title organisation for report header/footer
# #
# document_download: download file directly # document_download: download file directly
# document_save: save file in document module # document_save: save file in document module
...@@ -27,6 +28,9 @@ Export WebPage as Report ...@@ -27,6 +28,9 @@ Export WebPage as Report
# display_depth level of depth to display # display_depth level of depth to display
# display_milestone show milestones where applicable # display_milestone show milestones where applicable
# #
# start_date start_date of report
# stop_date stop_date of report
#
# report_name report to generate # report_name report to generate
# report_title report title # report_title report title
...@@ -46,6 +50,9 @@ return context.Base_viewAsReport( ...@@ -46,6 +50,9 @@ return context.Base_viewAsReport(
display_milestone=display_milestone, display_milestone=display_milestone,
report_name=report_name, report_name=report_name,
report_title=report_title, report_title=report_title,
start_date=start_date,
stop_date=stop_date,
batch_mode=batch_mode, batch_mode=batch_mode,
override_source_organisation_title=override_source_organisation_title,
**kw **kw
) )
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>format=\'pdf\', batch_mode=None, document_save=None, display_milestone=None, document_download=None, document_language=None, document_reference=None, document_version=None, display_header=None, display_detail=None, display_comment=None, document_title=None, display_depth=None, report_title=None, display_orphan=None, report_name=None, *args,**kw</string> </value> <value> <string>format=\'pdf\', batch_mode=None, override_source_organisation_title=None, document_save=None, display_milestone=None, document_download=None, document_language=None, document_reference=None, document_version=None, display_header=None, display_detail=None, display_comment=None, document_title=None, display_depth=None, report_title=None, display_orphan=None, report_name=None, start_date=None, stop_date=None, *args,**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -18,6 +18,7 @@ Update a book report dialog with parameters manually entered ...@@ -18,6 +18,7 @@ Update a book report dialog with parameters manually entered
# document_reference: use as document reference # document_reference: use as document reference
# document_title use as document title # document_title use as document title
# override_batch_mode used for tests # override_batch_mode used for tests
# override_source_organisation_title organisation for report header/footer
# #
# document_download: download file directly # document_download: download file directly
# document_save: save file in document module # document_save: save file in document module
...@@ -29,6 +30,9 @@ Update a book report dialog with parameters manually entered ...@@ -29,6 +30,9 @@ Update a book report dialog with parameters manually entered
# display_milestone show milestones if applicable # display_milestone show milestones if applicable
# display_orphan show requirements not covered by task # display_orphan show requirements not covered by task
# #
# start_date the start date of a report
# stop_date the stop date of a report
#
# report_name report to generate # report_name report to generate
# report_title report title # report_title report title
# requirement_relative_url XXX sale order has no direct relation to requirement # requirement_relative_url XXX sale order has no direct relation to requirement
...@@ -54,8 +58,11 @@ if dialog_id is not None: ...@@ -54,8 +58,11 @@ if dialog_id is not None:
display_comment=display_comment, display_comment=display_comment,
display_header=display_header, display_header=display_header,
display_orphan=display_orphan, display_orphan=display_orphan,
start_date=start_date,
stop_date=stop_date,
report_name=report_name, report_name=report_name,
report_title=report_title, report_title=report_title,
override_source_organisation_title=override_source_organisation_title,
requirement_relative_url=requirement_relative_url, requirement_relative_url=requirement_relative_url,
**kw **kw
) )
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>dialog_id=None, cancel_url=None, requirement_relative_url=None, report_name=None, report_title=None, portal_skin=None, display_milestone=None, format=None, display_comment=None, document_title=None, document_save=None, document_download=None, document_language=None, document_version=None, document_reference=None, display_orphan=None, display_detail=None, display_depth=None, display_header=None ,*args,**kw</string> </value> <value> <string>dialog_id=None, cancel_url=None, override_source_organisation_title=None, requirement_relative_url=None, report_name=None, report_title=None, portal_skin=None, display_milestone=None, format=None, display_comment=None, document_title=None, document_save=None, document_download=None, document_language=None, document_version=None, document_reference=None, display_orphan=None, display_detail=None, display_depth=None, display_header=None, start_date=None, stop_date=None, *args,**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -14,6 +14,8 @@ MAIN FILE: generate report (book header/footer and report content) ...@@ -14,6 +14,8 @@ MAIN FILE: generate report (book header/footer and report content)
# document_language: use as document version # document_language: use as document version
# document_reference: use as document reference # document_reference: use as document reference
# document_title use as document title # document_title use as document title
# override_source_organisation organisation for report header/footer
# override_batch_mode used for tests # override_batch_mode used for tests
# ------ # ------
# document_download: download file directly (default None) # document_download: download file directly (default None)
...@@ -27,6 +29,9 @@ MAIN FILE: generate report (book header/footer and report content) ...@@ -27,6 +29,9 @@ MAIN FILE: generate report (book header/footer and report content)
# display_milestone show associated milestones # display_milestone show associated milestones
# display_orphan show requirements not covered by task/item # display_orphan show requirements not covered by task/item
# -------- # --------
# start_date the start date of the report
# stop_date the stop date of the report
# --------
# report_name report to generate # report_name report to generate
# report_title report title # report_title report title
...@@ -55,8 +60,12 @@ override_document_title = kw.get('document_title') ...@@ -55,8 +60,12 @@ override_document_title = kw.get('document_title')
override_document_version = kw.get('document_version') override_document_version = kw.get('document_version')
override_document_reference = kw.get('document_reference') override_document_reference = kw.get('document_reference')
override_document_language = kw.get('document_language') override_document_language = kw.get('document_language')
override_source_organisation_title=kw.get('override_source_organisation', None)
override_batch_mode = kw.get('batch_mode') override_batch_mode = kw.get('batch_mode')
doc_report_start_date = DateTime(kw.get('start_date', None) or getattr(context.REQUEST.form, 'start_date', None) or DateTime(DateTime().year(), DateTime().month(), 1))
doc_report_stop_date = DateTime(kw.get('stop_date', None) or getattr(context.REQUEST.form, 'stop_date', None) or DateTime())
doc_report_name = kw.get('report_name') doc_report_name = kw.get('report_name')
doc_report_title = kw.get('report_title') doc_report_title = kw.get('report_title')
doc_format = kw.get('format') or 'html' doc_format = kw.get('format') or 'html'
...@@ -70,15 +79,13 @@ doc_aggregate_list = [] ...@@ -70,15 +79,13 @@ doc_aggregate_list = []
doc_revision = "1" doc_revision = "1"
doc_modification_date = DateTime() doc_modification_date = DateTime()
doc_language = doc.getLanguage() if getattr(doc, 'getLanguage', None) else None doc_language = doc.getLanguage() if getattr(doc, 'getLanguage', None) else None
doc_reference = html_quote(override_document_reference) if override_document_reference else doc.getReference() or blank
doc_short_title = html_quote(doc_report_title) if doc_report_title else doc.getShortTitle() or blank
doc_version = html_quote(override_document_version) if override_document_version else getattr(doc, "version", None) or "001"
doc_title = html_quote(override_document_title) if override_document_title else doc.getTitle() or blank
doc_language = html_quote(override_document_language) if override_document_language else doc_language
doc_translated_title = translateText(doc_report_title) if doc_report_title else blank doc_translated_title = translateText(doc_report_title) if doc_report_title else blank
doc_content = doc_report( # fallback in case language is still None
if doc_language is None or doc_language == "":
doc_language = doc_localiser.get_selected_language() or doc_localiser.get_default_language() or "en"
doc_content, report_override_doc_title, report_override_doc_subtitle = doc_report(
display_report=None if doc_embed else True, display_report=None if doc_embed else True,
format=doc_format, format=doc_format,
display_depth=doc_display_depth, display_depth=doc_display_depth,
...@@ -89,9 +96,18 @@ doc_content = doc_report( ...@@ -89,9 +96,18 @@ doc_content = doc_report(
display_embedded=doc_display_embedded, display_embedded=doc_display_embedded,
display_milestone=doc_display_milestone, display_milestone=doc_display_milestone,
display_orphan=doc_display_orphan, display_orphan=doc_display_orphan,
report_title=doc_translated_title start_date=doc_report_start_date,
stop_date=doc_report_stop_date,
report_title=doc_translated_title,
override_batch_mode=override_batch_mode
) )
doc_reference = html_quote(override_document_reference) if override_document_reference else doc.getReference() or blank
doc_short_title = translateText(report_override_doc_subtitle if report_override_doc_subtitle else html_quote(doc_report_title) if doc_report_title else doc.getShortTitle() or blank)
doc_version = html_quote(override_document_version) if override_document_version else getattr(doc, "version", None) or "001"
doc_title = translateText(html_quote(override_document_title) if override_document_title else report_override_doc_title if report_override_doc_title else doc.getTitle() or blank)
doc_language = html_quote(override_document_language) if override_document_language else doc_language
# test overrides # test overrides
if override_batch_mode: if override_batch_mode:
doc_modification_date = DateTime("1976-11-04") doc_modification_date = DateTime("1976-11-04")
...@@ -111,7 +127,7 @@ doc_theme = doc.Base_getThemeDict(doc_format=doc_format, css_path="template_css/ ...@@ -111,7 +127,7 @@ doc_theme = doc.Base_getThemeDict(doc_format=doc_format, css_path="template_css/
# --------------------------- Source/Destination ------------------------------- # --------------------------- Source/Destination -------------------------------
doc_source = doc.Base_getSourceDict( doc_source = doc.Base_getSourceDict(
override_source_person_title=None, override_source_person_title=None,
override_source_organisation_title=None, override_source_organisation_title=override_source_organisation_title,
theme_logo_url=doc_theme.get("theme_logo_url", None) theme_logo_url=doc_theme.get("theme_logo_url", None)
) )
......
...@@ -90,6 +90,7 @@ for link in re.findall('([^[]<a.*?</a>[^]])', doc_content): ...@@ -90,6 +90,7 @@ for link in re.findall('([^[]<a.*?</a>[^]])', doc_content):
target_caller = getattr(target_context, report_name, None) target_caller = getattr(target_context, report_name, None)
if target_caller is not None: if target_caller is not None:
substitution_content = target_caller(**link_param_dict) substitution_content = target_caller(**link_param_dict)
doc_content = doc_content.replace(link, substitution_content.encode("utf-8").strip()) # Note: switched to report returning a tuple with (content, header-title, header-subtitle)
doc_content = doc_content.replace(link, substitution_content[0].encode("utf-8").strip())
return doc_content return doc_content
...@@ -140,7 +140,14 @@ if leaflet_display_side: ...@@ -140,7 +140,14 @@ if leaflet_display_side:
leaflet_year=leaflet_year, leaflet_year=leaflet_year,
leaflet_recycle_url=leaflet_recycle_url leaflet_recycle_url=leaflet_recycle_url
) )
leaflet_content = leaflet_legalese.decode() + leaflet_content.decode() #leaflet_content = leaflet_legalese.decode() + leaflet_content.decode()
if isinstance(leaflet_legalese, unicode):
leaflet_legalese = leaflet_legalese.encode("UTF-8")
if isinstance(leaflet_content, unicode):
leaflet_content = leaflet_content.encode("UTF-8")
leaflet_content = leaflet_legalese + leaflet_content
# ========================= TRANSFORMATION: book =============================== # ========================= TRANSFORMATION: book ===============================
# XXX still dirty # XXX still dirty
......
...@@ -133,7 +133,13 @@ if release_display_about: ...@@ -133,7 +133,13 @@ if release_display_about:
release_contributor_list=release.Base_getTemplateProxyParameter(parameter="author"), release_contributor_list=release.Base_getTemplateProxyParameter(parameter="author"),
release_relative_url=release_relative_url, release_relative_url=release_relative_url,
) )
release_content = release_content.decode() + release_about.decode() #release_content = release_content.decode() + release_about.decode()
if isinstance(release_content, unicode):
release_content = release_content.encode("UTF-8")
if isinstance(release_about, unicode):
release_about = release_about.encode("UTF-8")
release_content = release_content + release_about
# ============================= Format: html =================================== # ============================= Format: html ===================================
if release_format == "html": if release_format == "html":
......
...@@ -36,6 +36,9 @@ View WebPage as Book or Report ...@@ -36,6 +36,9 @@ View WebPage as Book or Report
# #
# requirement_relative_url XXX relate sale order to requirement # requirement_relative_url XXX relate sale order to requirement
# #
# start_date start date of the report
# stop_date stop date of the report
#
# report_name name of report to call # report_name name of report to call
# report_title title of report # report_title title of report
# #
...@@ -66,6 +69,8 @@ if context.REQUEST["portal_skin"] == "Report": ...@@ -66,6 +69,8 @@ if context.REQUEST["portal_skin"] == "Report":
display_embedded=display_embedded, display_embedded=display_embedded,
display_milestone=display_milestone, display_milestone=display_milestone,
display_orphan=display_orphan, display_orphan=display_orphan,
start_date=start_date,
stop_date=stop_date,
report_name=report_name, report_name=report_name,
report_title=report_title, report_title=report_title,
requirement_relative_url=requirement_relative_url, requirement_relative_url=requirement_relative_url,
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>format="html", include_content_table=None, display_orphan=None, display_milestone=None, display_embedded=None, requirement_relative_url=None, display_depth=None, include_history_table= None, include_reference_table=None, include_linked_content=None, include_report_content=None, display_svg=None, display_detail=None, display_comment=None, display_header=None, document_download=None, override_document_reference=None, batch_mode=False, document_save=None, document_language=None, document_reference=None, document_version=None, transformation=None, report_title=None, document_title=None, report_name=None, override_document_description=None, override_document_short_title=None, override_document_title=None, override_document_version=None, override_logo_reference=None, override_source_organisation_title=None, override_source_person_title=None, display_sandbox=None, **kw</string> </value> <value> <string>format="html", include_content_table=None, display_orphan=None, display_milestone=None, display_embedded=None, requirement_relative_url=None, display_depth=None, include_history_table= None, include_reference_table=None, include_linked_content=None, include_report_content=None, display_svg=None, display_detail=None, display_comment=None, display_header=None, document_download=None, override_document_reference=None, batch_mode=False, document_save=None, document_language=None, document_reference=None, document_version=None, transformation=None, report_title=None, document_title=None, report_name=None, override_document_description=None, override_document_short_title=None, override_document_title=None, override_document_version=None, override_logo_reference=None, override_source_organisation_title=None, override_source_person_title=None, display_sandbox=None, start_date=None, stop_date=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</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