Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix date range filter for "Data entry day book" report #840

Merged
merged 2 commits into from
May 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Changelog

**Fixed**

- #840 Fix date range filter for "Data entry day book" report
- #828 Traceback when removing a retracted analysis through Manage Analyses view
- #832 Set new calculation Interims to dependant services
- #833 Fix sort order of interims in Calculations and Analysis Services
Expand Down
9 changes: 7 additions & 2 deletions bika/lims/browser/reports/productivity_dataentrydaybook.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from zope.interface import implements
from bika.lims.catalog import CATALOG_ANALYSIS_REQUEST_LISTING
from Products.CMFCore.utils import getToolByName
from bika.lims import logger


class Report(BrowserView):
Expand All @@ -35,16 +36,20 @@ def __call__(self):
# Apply filters
self.contentFilter = {'portal_type': 'AnalysisRequest'}
val = self.selection_macros.parse_daterange(self.request,
'created',
'getDateCreated',
_('Date Created'))
if val:
self.contentFilter[val['contentFilter'][0]] = val['contentFilter'][1]
self.contentFilter["created"] = val['contentFilter'][1]
parms.append(val['parms'])
titles.append(val['titles'])

# Query the catalog and store results in a dictionary
catalog = getToolByName(self.context, CATALOG_ANALYSIS_REQUEST_LISTING)
ars = catalog(self.contentFilter)

logger.info("Catalog Query '{}' returned {} results".format(
self.contentFilter, len(ars)))

if not ars:
message = _("No Analysis Requests matched your query")
self.context.plone_utils.addPortalMessage(message, "error")
Expand Down