make sure indirectly called reports (like CSV export) use the correct report name
This commit is contained in:
parent
428c772ea9
commit
85dfd815dc
3 changed files with 16 additions and 3 deletions
|
@ -56,6 +56,10 @@
|
|||
tal:condition="sortinfo"
|
||||
tal:attributes="name string:sortinfo_results;
|
||||
value sortinfo" />
|
||||
<input type="hidden" name="report_name"
|
||||
tal:define="reportName item/reportName"
|
||||
tal:condition="reportName"
|
||||
tal:attributes="value reportName" />
|
||||
</tal:hidden>
|
||||
<div metal:use-macro="item/report_macros/params" />
|
||||
<div metal:define-macro="buttons">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,6 +20,7 @@
|
|||
View classes for reporting.
|
||||
"""
|
||||
|
||||
from logging import getLogger
|
||||
from urllib import urlencode
|
||||
from zope import interface, component
|
||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
|
@ -158,6 +159,8 @@ class ResultsConceptView(ConceptView):
|
|||
""" View on a concept using the results of a report.
|
||||
"""
|
||||
|
||||
logger = getLogger ('ResultsConceptView')
|
||||
|
||||
reportName = None # define in subclass if applicable
|
||||
reportDownload = None
|
||||
reportType = None # set for using special report instance adapter
|
||||
|
@ -188,6 +191,9 @@ class ResultsConceptView(ConceptView):
|
|||
|
||||
@Lazy
|
||||
def reportName(self):
|
||||
rn = self.request.form.get('report_name')
|
||||
if rn is not None:
|
||||
return rn
|
||||
return (self.getOptions('report_name') or [None])[0]
|
||||
|
||||
@Lazy
|
||||
|
@ -198,7 +204,10 @@ class ResultsConceptView(ConceptView):
|
|||
@Lazy
|
||||
def report(self):
|
||||
if self.reportName:
|
||||
return adapted(self.conceptManager[self.reportName])
|
||||
report = adapted(self.conceptManager.get(self.reportName))
|
||||
if report is None:
|
||||
self.logger.warn("Report '%s' not found." % self.reportName)
|
||||
return report
|
||||
reports = self.context.getParents([self.hasReportPredicate])
|
||||
if not reports:
|
||||
type = self.context.conceptType
|
||||
|
|
|
@ -346,7 +346,7 @@ class WorkReportInstance(ReportInstance):
|
|||
if checked is None:
|
||||
checked = set()
|
||||
for c in concept.getChildren([self.view.defaultPredicate]):
|
||||
if c.conceptType in self.taskTypes:
|
||||
if c.conceptType in self.taskTypes and c not in checked:
|
||||
result.append(c)
|
||||
if c not in checked:
|
||||
checked.add(c)
|
||||
|
|
Loading…
Add table
Reference in a new issue