Skip to content

Commit

Permalink
Merge branch 'hotfix/next'. Version 3.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
xispa committed Dec 17, 2014
2 parents 57b5bea + c058737 commit b3c8a54
Show file tree
Hide file tree
Showing 129 changed files with 32,833 additions and 5,408 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
3.1.6 (2014-12-17)
------------------

LIMS-1530: Scrambled Analysis Category order in Published Results
LIMS-1529: Error while inserting an AR with container-based partitioning is required
LIMS-1460: Additional field in AR for comments or results interpretation
LIMS-1441: An error message related to partitions unit is shown when selecting analysis during AR creation
LIMS-1470: AS Setup. File attachment field tag is missing
LIMS-1422: Results doesn't display yes/no once verified but 1 or 0
LIMS-1486: Typos in instrument messages
LIMS-1498: Published Results not Showing for Logged Clients
LIMS-1445: Scientific names should be written in italics in published reports
LIMS-1389: Units in results publishing should allow super(sub)script format, for example in cm2 or m3
LIMS-1500: Alere Pima's Instrument Interfice
LIMS-1457: Exponential notation in published AR pdf should be formatted like a×10^b instead of ae^+b
LIMS-1334: Calculate result precision from Uncertainty value
LIMS-1446: After retracting a published AR the Sample gets cancelled
LIMS-1390: More workflow for Batches
LIMS-1378: Bulking up Batches
LIMS-1479: new-version and upgrade-steps should be python viewlets
LIMS-1362: File attachment uploads to Batches
LIMS-1404: New Batch attributes (and their integration with existing ones on Batch views)
LIMS-1467: Sample Point Lookup doesn't work on AR modify
LIMS-1363: Batches per Client
LIMS-1405: New Sample and AR attributes
LIMS-1085: Allow Clients to add Attachments to ARs
LIMS-1444: In AR published report accredited analysis services are not marked as accredited
LIMS-1443: In published reports the publishing date is not shown in the pdf
LIMS-1420: Status filter is not kept after moving to next page
LIMS-1442: Sample Type is not filtred by Sample Point
LIMS-1448: Reports: when you click on "Analysis turnaround time" displays others
LIMS-1440: Error when trying to publish with analysis from different categories
LIMS-1459: Error when checking instrument validity in manage_results
LIMS-1430: Create an AR from batch allows you to introduce a non existent Client and Contacts don't work properly

- After modifying analysis Category, reindex category name and UID for all subordinate analyses
- Setup data import improvements and fixes
- Simplify installation with a custom Plone overview and add site


3.1.5 (2014-10-06)
------------------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ language of the world's first people.
Installation
------------

* `Installing Bika LIMS <https://github.com/bikalabs/Bika-LIMS/blob/13c8e4e/INSTALL.rst>`_
* `Installing Bika LIMS <https://github.com/bikalabs/Bika-LIMS/blob/0c606e0/INSTALL.rst>`_

Documentation
-------------
Expand Down
18 changes: 0 additions & 18 deletions bika/lims/browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,3 @@ def time_format(self):
if fmt == "time_format":
fmt = "%I:%M %p"
return fmt


class ajaxGetProductVersion(BrowserView):
def __call__(self):
plone.protect.CheckAuthenticator(self.request)
vers = {}
if self.context.bika_setup.getShowNewReleasesInfo() == True:
pl = self.context
qi = pl.get('portal_quickinstaller')
for key in qi.keys():
vers[key] = qi.getProductVersion(key);
return json.dumps(vers)


class ajaxHideNewReleasesInfo(BrowserView):
def __call__(self):
plone.protect.CheckAuthenticator(self.request)
return self.context.bika_setup.setShowNewReleasesInfo(False);
16 changes: 16 additions & 0 deletions bika/lims/browser/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from Products.CMFPlone.browser.admin import Overview as OverviewBase
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile



class Overview(OverviewBase):
""" Customized plone overview. """

index = ViewPageTemplateFile('templates/plone-overview.pt')

def __call__(self):
""" Redirect to bika.lims instance if single instance is found. """
sites = self.sites()
if len(sites) == 1 and not self.outdated(sites[0]):
return self.request.response.redirect(sites[0].absolute_url())
return self.index()
11 changes: 7 additions & 4 deletions bika/lims/browser/analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from AccessControl import getSecurityManager
from Products.CMFPlone.utils import safe_unicode
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t, dicts_to_dict
from bika.lims.utils import t, dicts_to_dict, format_supsub
from bika.lims.utils.analysis import format_uncertainty
from bika.lims.browser import BrowserView
from bika.lims.browser.bika_listing import BikaListingView
from bika.lims.config import QCANALYSIS_TYPES
Expand Down Expand Up @@ -332,7 +333,7 @@ def folderitems(self):
items[i]['service_uid'] = service.UID()
items[i]['Service'] = service.Title()
items[i]['Keyword'] = keyword
items[i]['Unit'] = unit and unit or ''
items[i]['Unit'] = format_supsub(unit) if unit else ''
items[i]['Result'] = ''
items[i]['formatted_result'] = ''
items[i]['interim_fields'] = interim_fields
Expand Down Expand Up @@ -605,8 +606,10 @@ def folderitems(self):
# permission, otherwise just put an icon in Result column.
if can_view_result:
items[i]['Result'] = result
items[i]['formatted_result'] = obj.getFormattedResult()
items[i]['Uncertainty'] = obj.getUncertainty(result)
scinot = self.context.bika_setup.getScientificNotationResults()
dmk = self.context.bika_setup.getResultsDecimalMark()
items[i]['formatted_result'] = obj.getFormattedResult(sciformat=int(scinot),decimalmark=dmk)
items[i]['Uncertainty'] = format_uncertainty(obj, result, decimalmark=dmk, sciformat=int(scinot))

else:
items[i]['Specification'] = ""
Expand Down
28 changes: 27 additions & 1 deletion bika/lims/browser/analysis.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# coding=utf-8
from Products.CMFCore.utils import getToolByName
from bika.lims.jsonapi import get_include_fields
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t, dicts_to_dict
from bika.lims.interfaces import IAnalysis, IResultOutOfRange
from bika.lims.interfaces import IAnalysis, IResultOutOfRange, IJSONReadExtender
from bika.lims.interfaces import IFieldIcons
from bika.lims.utils import to_utf8
from bika.lims.utils import dicts_to_dict
from zope.component import adapts, getAdapters
from zope.interface import implements

Expand Down Expand Up @@ -165,5 +167,29 @@ def isOutOfRange(self, result, Min, Max, error):
if self.isOutOfShoulderRange(result, Min, Max, error):
return True, True
return True, False

class JSONReadExtender(object):

"""- Adds the specification from Analysis Request to Analysis in JSON response
"""

implements(IJSONReadExtender)
adapts(IAnalysis)

def __init__(self, context):
self.context = context

def analysis_specification(self):
ar = self.context.aq_parent
rr = dicts_to_dict(ar.getResultsRange(),'keyword')

return rr[self.context.getService().getKeyword()]

def __call__(self, request, data):
self.request = request
self.include_fields = get_include_fields(request)
if not self.include_fields or "specification" in self.include_fields:
data['specification'] = self.analysis_specification()
return data


4 changes: 4 additions & 0 deletions bika/lims/browser/analysis.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@
for="bika.lims.interfaces.IAnalysis"
factory="bika.lims.adapters.priorityicons.PriorityIcons"
/>

<adapter
factory="bika.lims.browser.analysis.JSONReadExtender"
provides="bika.lims.interfaces.IJSONReadExtender" />

</configure>
2 changes: 1 addition & 1 deletion bika/lims/browser/analysisrequest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from bika.lims.jsonapi import get_include_fields
from bika.lims.jsonapi import load_brain_metadata
from bika.lims.jsonapi import load_field_values
from bika.lims.utils import dicts_to_dict
from bika.lims.interfaces import IAnalysisRequest
from bika.lims.interfaces import IFieldIcons
from bika.lims.interfaces import IJSONReadExtender
Expand Down Expand Up @@ -150,7 +151,6 @@ def __call__(self, request, data):
self.include_fields = get_include_fields(request)
if not self.include_fields or "Analyses" in self.include_fields:
data['Analyses'] = self.ar_analysis_values()
return data

class mailto_link_from_contacts:

Expand Down
3 changes: 2 additions & 1 deletion bika/lims/browser/analysisrequest/manage_results.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from AccessControl import getSecurityManager
from Products.CMFPlone.utils import safe_unicode
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t
from bika.lims.browser.analyses import AnalysesView
Expand Down Expand Up @@ -77,7 +78,7 @@ def checkInstrumentsValidity(self):
for an in ans:
valid = an.isInstrumentValid()
if not valid:
inv = '%s (%s)' % (an.Title(), an.getInstrument().Title())
inv = '%s (%s)' % (safe_unicode(an.Title()), safe_unicode(an.getInstrument().Title()))
if inv not in invalid:
invalid.append(inv)
if len(invalid) > 0:
Expand Down
15 changes: 10 additions & 5 deletions bika/lims/browser/analysisrequest/publish.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from smtplib import SMTPServerDisconnected, SMTPRecipientsRefused
from bika.lims import bikaMessageFactory as _, t
from bika.lims.utils import to_utf8, formatDecimalMark
from bika.lims.utils import to_utf8, formatDecimalMark, format_supsub
from bika.lims.utils.analysis import format_uncertainty
from bika.lims import logger
from bika.lims.browser import BrowserView
from bika.lims.config import POINTS_OF_CAPTURE
Expand Down Expand Up @@ -172,7 +173,7 @@ def _ar_data(self, ar, excludearuids=[]):
'remarks': ar.getRemarks(),
'member_discount': ar.getMemberDiscount(),
'date_sampled': self.ulocalized_time(ar.getDateSampled(), long_format=1),
'date_published': self.ulocalized_time(ar.getDatePublished(), long_format=1),
'date_published': self.ulocalized_time(DateTime(), long_format=1),
'invoiced': ar.getInvoiced(),
'late': ar.getLate(),
'subtotal': ar.getSubtotal(),
Expand All @@ -184,7 +185,8 @@ def _ar_data(self, ar, excludearuids=[]):
'footer': to_utf8(self.context.bika_setup.getResultFooter()),
'prepublish': False,
'child_analysisrequest': None,
'parent_analysisrequest': None}
'parent_analysisrequest': None,
'resultsinterpretation':ar.getResultsInterpretation()}

# Sub-objects
excludearuids.append(ar.UID())
Expand Down Expand Up @@ -428,11 +430,13 @@ def _analysis_data(self, analysis, decimalmark=None):
'id': analysis.id,
'title': analysis.Title(),
'keyword': keyword,
'scientific_name': service.getScientificName(),
'accredited': service.getAccredited(),
'point_of_capture': to_utf8(POINTS_OF_CAPTURE.getValue(service.getPointOfCapture())),
'category': to_utf8(service.getCategoryTitle()),
'result': analysis.getResult(),
'unit': to_utf8(service.getUnit()),
'formatted_unit': format_supsub(to_utf8(service.getUnit())),
'capture_date': analysis.getResultCaptureDate(),
'request_id': analysis.aq_parent.getId(),
'formatted_result': '',
Expand Down Expand Up @@ -480,7 +484,8 @@ def _analysis_data(self, analysis, decimalmark=None):
if specs else {}

andict['specs'] = specs
andict['formatted_result'] = analysis.getFormattedResult(specs, decimalmark)
scinot = self.context.bika_setup.getScientificNotationReport()
andict['formatted_result'] = analysis.getFormattedResult(specs=specs, sciformat=int(scinot), decimalmark=decimalmark)

fs = ''
if specs.get('min', None) and specs.get('max', None):
Expand All @@ -490,7 +495,7 @@ def _analysis_data(self, analysis, decimalmark=None):
elif specs.get('max', None):
fs = '< %s' % specs['max']
andict['formatted_specs'] = formatDecimalMark(fs, decimalmark)
andict['formatted_uncertainty'] = formatDecimalMark(str(analysis.getUncertainty()), decimalmark)
andict['formatted_uncertainty'] = format_uncertainty(analysis, analysis.getResult(), decimalmark=decimalmark, sciformat=int(scinot))

# Out of range?
if specs:
Expand Down
3 changes: 2 additions & 1 deletion bika/lims/browser/analysisrequest/published_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def folderitems(self):
member = pm.getAuthenticatedMember()
roles = member.getRoles()
if 'Manager' not in roles \
and 'LabManager' not in roles:
and 'LabManager' not in roles \
and 'Client' not in roles:
return []
for x in range(len(items)):
if 'obj' in items[x]:
Expand Down
34 changes: 19 additions & 15 deletions bika/lims/browser/analysisrequest/templates/analysisrequest_view.pt
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,25 @@
<metal:content-description fill-slot="content-description">
</metal:content-description>

<metal:content-core fill-slot="content-core" tal:define="
portal context/@@plone_portal_state/portal;
specification python:request.get('specification', view.getDefaultSpec());
sample here/getSample;
colspan python:10;
ar_attach_allowed here/bika_setup/getARAttachmentsPermitted;
review_state python:context.portal_workflow.getInfoFor(context, 'review_state');
inactive_state python:context.portal_workflow.getInfoFor(context, 'inactive_state', 'asdf');
analysis_attach_allowed here/bika_setup/getAnalysisAttachmentsPermitted;
attachments_allowed here/bika_setup/getAttachmentsPermitted;
attachments here/getAttachment | nothing;
update_attachments python:context.portal_membership.checkPermission('EditResults', context) or
context.portal_membership.checkPermission('EditFieldResults', context);
add_attachments python:context.portal_membership.checkPermission('BIKA: Add Attachment', context);
delete_attachments python:(add_attachments and not user.allowed(context, ['Client'])) or update_attachments;">
<metal:content-core fill-slot="content-core" tal:define="
portal context/@@plone_portal_state/portal;
specification python:request.get('specification', view.getDefaultSpec());
sample here/getSample;
colspan python:10;
ar_attach_allowed here/bika_setup/getARAttachmentsPermitted;
review_state python:context.portal_workflow.getInfoFor(context, 'review_state');
inactive_state python:context.portal_workflow.getInfoFor(context, 'inactive_state', 'asdf');
analysis_attach_allowed here/bika_setup/getAnalysisAttachmentsPermitted;
attachments_allowed here/bika_setup/getAttachmentsPermitted;
attachments here/getAttachment | nothing;
update_attachments python:context.portal_membership.checkPermission('EditResults', context) or
context.portal_membership.checkPermission('EditFieldResults', context);
add_attachments python:context.portal_membership.checkPermission('BIKA: Add Attachment', context);
delete_attachments python:(add_attachments and not user.allowed(context, ['Client'])) or update_attachments;">

<input type="hidden" id="bika_setup"
tal:attributes="bika_samplepoints python: context.bika_setup.bika_samplepoints.UID()">

<div
tal:condition="python:update_attachments or add_attachments"
tal:define="ar_review_state review_state">
Expand Down
10 changes: 10 additions & 0 deletions bika/lims/browser/analysisrequest/templates/reports/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ h2 {
color:#777;
font-weight:normal;
font-style:italic;
}
.units sub,
.units sup {
color:#777;
font-size:10px;
font-style:italic;
}

table tr td,
Expand Down Expand Up @@ -216,6 +221,11 @@ div#section-info table {
width: 100%;
}

img.accredited-ico {
vertical-align:bottom;
padding-right:5px;
}

@media print {
* {
font: 9pt Arial, Verdana, serif;
Expand Down
Loading

0 comments on commit b3c8a54

Please sign in to comment.