-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: CHANGELOG.txt
- Loading branch information
Showing
86 changed files
with
1,539 additions
and
1,252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.