Skip to content

Commit

Permalink
Merge branch 'hotfix/next' v3.1.5
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGELOG.txt
  • Loading branch information
xispa committed Oct 10, 2014
2 parents aa59fb4 + 60ca1ba commit 005361a
Show file tree
Hide file tree
Showing 86 changed files with 1,539 additions and 1,252 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
3.2
3.1.5 (2014-10-10)
------------------

HEALTH-176: Cannot choose a drug from the dropdown list on Patient->allergies
HEALTH-174: Unable to add an AR to a Case (missing Client)
HEALTH-163: Cannot be chosen Immunisation items from dropdown list.
HEALTH-162: Cannot choose Drug Prohibition Explanation
HEALTH-169: Analyst can't see Samples site, Admin can.
HEALTH-168: Diagnosis ICD widget does not complete from Code, Description
HEALTH-161: In Add Patient, after introducing the Birth Date, the patient's age don't get filled automatically.
HEALTH-157: Patient field is missing in AR add views
HEALTH-150: Compatibility with the new JS loader machinery
HEALTH-164: Editing a patient, location not have to be important on Travel History field
HEALTH-166: "Patient Age at Case Onset Date" in Add Case cannot be filled
HEALTH-172: Anything is displayed on drugs list
HEALTH-173: ImmunizationHistory cannot save data
HEALTH-149: Compatibility with the new Bika LIMS reporting subsystem
HEALTH-152: Upgrade the test data worksheet
HEALTH-145: Health icons not used. And 1 more
HEALTH-152: Upgrade the test data worksheet

- Plus Bika-LIMS 3.1.5: http://git.io/ogjDuQ


3.1.2.1 (2014-08-05)
------------------

HEALTH-144: Set up data: Identifier Types NameError: global name '_id' is not defined
HEALTH-143: Can not create site


3.1.2 (2014-07-25)
Expand Down
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
Bika Health 3.1.2 (Naringenin)
================
Bika Health 3.1.5 (Naringenin)
==============================

Bika Laboratory Information Management System customised for use in Health laboratories.

[Naringenin](http://en.wikipedia.org/wiki/Naringenin) is a flavanone, a typeof flavonoid, that is considered to have a bioactive effect on human health as antioxidant, free radical scavenger, anti-inflammatory, carbohydrate metabolism promoter, and immune system modulator. It is the predominant flavanone in grapefruit.

Installation instructions:
Installation and upgrades
-------------------------
Bika Health can be installed on Windows, Mac OS X, Linux, BSD and other platforms:
https://github.com/bikalabs/bika.health/wiki/Installing-Bika-Health-Extension

1. Read https://plone.org/documentation/manual/installing-plone
2. Read https://plone.org/documentation/kb/installing-add-ons-quick-how-to
3. Install Plone and the "bika.health" package
You might also find useful the following recipes:
- Installing Bika LIMS: https://github.com/bikalabs/Bika-LIMS/wiki/Bika-LIMS-Installation
- Installing Plone: https://plone.org/documentation/manual/installing-plone
- Installing Plone add-ons: https://plone.org/documentation/kb/installing-add-ons-quick-how-to

Documentation
-------------
- Bika LIMS User Manual: http://demo.bikalabs.com/knowledge-centre/manual/bika-3-user-manual
- Bika LIMS Wiki: http://github.com/bikalabs/Bika-LIMS/wiki

Feedback and support
--------------------
If you have questions, please post to one of our mailing lists:

* Bika Health Users: http://groups.google.com/forum/?hl=en#!forum/bika-health
Expand All @@ -19,13 +30,3 @@ If you have questions, please post to one of our mailing lists:
* Developers: http://lists.sourceforge.net/lists/listinfo/bika-developers

Please log issues, feature requests, or bug reports in the [issue tracker](http://jira.bikalabs.com/)



Bika Lab Systems
info@bikalabs.com
http://www.bikalabs.com

Naralabs
info@naralabs.com
http://www.naralabs.com
Empty file.
14 changes: 14 additions & 0 deletions bika/health/adapters/configure.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="bika">

<adapter
factory=".widgetvisibility.PatientFieldsWidgetVisibility"
provides="bika.lims.interfaces.IATWidgetVisibility"
for="bika.lims.interfaces.IAnalysisRequest"
name="PatientFieldsWidgetVisibility"
/>

</configure>
53 changes: 53 additions & 0 deletions bika/health/adapters/widgetvisibility.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# -*- coding:utf-8 -*-
from Products.CMFCore.WorkflowCore import WorkflowException
from bika.lims.utils import getHiddenAttributesForClass
from types import DictType
from Products.CMFCore.utils import getToolByName
from bika.lims.interfaces import IATWidgetVisibility
from zope.interface import implements
from bika.health.permissions import ViewPatients

_marker = []


class PatientFieldsWidgetVisibility(object):
"""This will force readonly fields to be uneditable, and viewable only by
those with ViewPatients permission.
"""
implements(IATWidgetVisibility)

def __init__(self, context):
self.context = context
# self.sort = 100

def __call__(self, context, mode, field, default):
state = default if default else 'invisible'

header_table_fields = ['Patient',
'PatientID',
'ClientPatientID']
readonly_fields = ['Batch',
'Patient',
'PatientID',
'ClientPatientID']

mtool = getToolByName(self.context, 'portal_membership')
has_perm = mtool.checkPermission(ViewPatients, self.context)

fieldName = field.getName()
if fieldName not in header_table_fields and fieldName not in readonly_fields:
return state

#from bika.lims import logger
#oldstate = state
if has_perm:
if mode == 'header_table' and fieldName in header_table_fields:
state = 'visible'
if mode == 'view' and fieldName in readonly_fields:
state = 'visible'
if mode == 'edit' and fieldName in readonly_fields:
state = 'invisible'
#if state != oldstate:
# logger.info("PatientFieldsWidgetVisibility %s %s %s %s->%s"%(self.context, has_perm, fieldName, oldstate, state))

return state
26 changes: 18 additions & 8 deletions bika/health/browser/analysisrequest/overrides.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:five="http://namespaces.zope.org/five">

<adapter
factory="bika.health.browser.analysisrequest.widgets.WidgetVisibility"
provides="bika.lims.interfaces.IWidgetVisibility"
for="bika.lims.interfaces.IAnalysisRequest"
name="getWidgetVisibility"
/>

<browser:page
for="bika.lims.interfaces.IAnalysisRequest"
name="workflow_action"
class="bika.health.browser.analysisrequest.workflow.WorkflowAction"
class="bika.health.browser.analysisrequest.workflow.AnalysisRequestWorkflowAction"
permission="zope.Public"
layer="bika.lims.interfaces.IBikaLIMS"
/>
Expand Down Expand Up @@ -43,4 +36,21 @@
layer="bika.lims.interfaces.IBikaLIMS"
/>

<browser:page
for="bika.lims.interfaces.IAnalysisRequest"
name="publish"
class="bika.health.browser.analysisrequest.publish.AnalysisRequestPublishView"
permission="bika.lims.ManageAnalysisRequests"
layer="bika.lims.interfaces.IBikaLIMS"
/>

<!-- Multiple analysis requests results preview -->
<browser:page
for="bika.lims.interfaces.IAnalysisRequestsFolder"
name="publish"
class="bika.health.browser.analysisrequest.publish.AnalysisRequestPublishView"
permission="bika.lims.ManageAnalysisRequests"
layer="bika.lims.interfaces.IBikaLIMS"
/>

</configure>
86 changes: 77 additions & 9 deletions bika/health/browser/analysisrequest/publish.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,83 @@
from bika.lims.browser.publish import doPublish
from bika.lims.browser.analysisrequest.publish import \
AnalysisRequestPublishView as _AnalysisRequestPublishView
from bika.health import bikaMessageFactory as _h
from bika.lims import bikaMessageFactory as _
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
import glob, os, sys, traceback


class AnalysisRequestPublish(doPublish):

template = ViewPageTemplateFile("report_results.pt")
class AnalysisRequestPublishView(_AnalysisRequestPublishView):

def __call__(self):
return super(AnalysisRequestPublish, self).__call__()
return super(AnalysisRequestPublishView, self).__call__()

def getAvailableFormats(self):
""" Overrides
Looks for templates inside bika.health's templates/reports
folder, as well as bika.lims's templates/reports directory
"""
# bika.lims templates
btempl = _AnalysisRequestPublishView.getAvailableFormats(self)
for tmpl in btempl:
tmpl['title'] = '%s: %s' % ('bika.lims', tmpl['title']);
tmpl['id'] = '%s:%s' % ('bika.lims', tmpl['id']);

# bika.health templates
tempath = self._getTemplatesResourcePath('*.pt')
templates = [t.split('/')[-1] for t in glob.glob(tempath)]
out = []
for template in templates:
out.append({
'id': '%s:%s' % ('bika.health', template),
'title': '%s: %s' % ('bika.health', template[:-3])})

out.extend(btempl)
return out

def getReportTemplate(self):
""" Overrides
Returns the template for the current ar and moves to the
next ar to be processed. Uses the selected template
specified in the request ('template' parameter)
"""
embedt = self.request.get('template', self._DEFAULT_TEMPLATE)
path = self._getTemplatesResourcePath(embedt)
embed = ViewPageTemplateFile(path)
reptemplate = ""
try:
reptemplate = embed(self)
except:
tbex = traceback.format_exc()
arid = self._ars[self._current_ar_index].id
reptemplate = "<div class='error-report'>%s - %s '%s':<pre>%s</pre></div>" % (arid, _("Unable to load the template"), embedt, tbex)
self.logger.error(tbex);
self._nextAnalysisRequest()
return reptemplate

def getReportStyle(self):
""" Overrides
Returns the CSS to be used in the current template
"""
embedt = self.request.get('template', self._DEFAULT_TEMPLATE)
path = "%s.css" % self._getTemplatesResourcePath(embedt)[:-3]
content = ''
with open(path, 'r') as content_file:
content = content_file.read()
return content

def _getTemplatesResourcePath(self, resource):
""" Returns the full path from any resource located inside
/templates/reports, either from inside bika.lims project
or bika.health project
"""
this_dir = os.path.dirname(os.path.abspath(__file__))
res = resource
if 'bika.lims:' in resource:
this_dir = str.replace(this_dir, "bika.health/bika/health", "bika.lims/bika/lims")
res = str.replace(resource, 'bika.lims:', '')
res = str.replace(res, 'bika.health:', '')
path = os.path.join(this_dir, 'templates/reports')
path = '%s/%s' % (path, res)
return path

def get_patient(self, ar):
return ar.Schema().getField('Patient').get(ar) \
Expand Down Expand Up @@ -46,9 +114,9 @@ def get_formatted_lab_address(self):
addr = self.get_formatted_address(client_address)
return addr

def get_formatted_client_address(self):
client = self.ar['obj'].getClient()
contact = self.ar['obj'].getContact();
def get_formatted_client_address(self, ar):
client = ar.getClient()
contact = ar.getContact();
client_address = client.getPostalAddress() \
or contact.getBillingAddress() \
or contact.getPhysicalAddress()
Expand Down
Loading

0 comments on commit 005361a

Please sign in to comment.