Exemplo n.º 1
0
    def folderitems(self):
        self.filter_indexes = None

        items = BaseView.folderitems(self)
        pm = getToolByName(self.context, "portal_membership")
        member = pm.getAuthenticatedMember()
        roles = member.getRoles()
        hidepatientinfo = 'Manager' not in roles \
            and 'LabManager' not in roles \
            and 'LabClerk' not in roles
        hideclientlink = 'RegulatoryInspector' in roles \
            and 'Manager' not in roles \
            and 'LabManager' not in roles \
            and 'LabClerk' not in roles

        if hidepatientinfo:
            # Remove patient fields. Must be done here because in __init__
            # method, member.getRoles() returns empty
            del self.columns['getPatientID']
            del self.columns['Patient']
            del self.columns['getClientPatientID']
            for rs in self.review_states:
                del rs['columns'][rs['columns'].index('getClientPatientID')]
                del rs['columns'][rs['columns'].index('Patient')]
                del rs['columns'][rs['columns'].index('getPatientID')]

        for x in range(len(items)):
            if 'obj' not in items[x]:
                continue
            obj = items[x]['obj']

            bid = obj.getBatchID()
            items[x]['BatchID'] = bid

            client = obj.Schema()['Client'].get(obj)
            doctor = obj.Schema()['Doctor'].get(obj)

            items[x]['Doctor'] = doctor and doctor.Title() or ''
            items[x]['replace']['Doctor'] = doctor \
                and "<a href='%s'>%s</a>" % \
                (doctor.absolute_url(),
                 doctor.Title()) or ''

            items[x]['Client'] = client and client.Title() or ''
            if hideclientlink == False:
                items[x]['replace']['Client'] = client \
                    and "<a href='%s'>%s</a>" % \
                    (client.absolute_url(),
                     client.Title()) or ''

            OnsetDate = obj.Schema()['OnsetDate'].get(obj)
            items[x]['replace']['OnsetDate'] = OnsetDate \
                and self.ulocalized_time(OnsetDate) or ''

            if hidepatientinfo == False:
                patient = obj.Schema()['Patient'].get(obj)
                items[x]['Patient'] = patient and patient or ''
                items[x]['replace']['Patient'] = patient \
                                and "<a href='%s'>%s</a>" % \
                                (patient.absolute_url(),
                                 patient.Title()) or ''
                items[x]['getClientPatientID'] = patient \
                                and patient.getClientPatientID() \
                                or ''
                items[x]['replace']['getClientPatientID'] = patient \
                                and "<a href='%s'>%s</a>" % \
                                    (patient.absolute_url(),
                                     items[x]['getClientPatientID']) \
                                or ''
                items[x]['getPatientID'] = patient and patient.id or ''
                items[x]['replace']['getPatientID'] = patient \
                                and "<a href='%s'>%s</a>" % \
                                    (patient.absolute_url(),
                                     items[x]['getPatientID']) \
                                or ''
        return items
Exemplo n.º 2
0
 def __call__(self):
     self.contentFilter['getClientUID'] = self.context.UID()
     return BatchFolderContentsView.__call__(self)
Exemplo n.º 3
0
 def __call__(self):
     # self.context_actions[_('Add')] = \
     #         {'url': '../../batches/createObject?type_name=Batch',
     #          'icon': self.portal.absolute_url() + '/++resource++bika.lims.images/add.png'}
     return BatchFolderContentsView.__call__(self)
Exemplo n.º 4
0
 def __call__(self):
     return BatchFolderContentsView.__call__(self)
Exemplo n.º 5
0
 def __call__(self):
     # self.context_actions[_('Add')] = \
     #         {'url': '../../batches/createObject?type_name=Batch',
     #          'icon': self.portal.absolute_url() + '/++resource++bika.lims.images/add.png'}
     return BatchFolderContentsView.__call__(self)
Exemplo n.º 6
0
 def __call__(self):
     self.contentFilter['getClientTitle'] = self.context.Title()
     return BatchFolderContentsView.__call__(self)
Exemplo n.º 7
0
    def folderitems(self):
        items = BaseView.folderitems(self)
        pm = getToolByName(self.context, "portal_membership")
        member = pm.getAuthenticatedMember()
        roles = member.getRoles()
        hidepatientinfo = 'Manager' not in roles \
            and 'LabManager' not in roles \
            and 'LabClerk' not in roles
        hideclientlink = 'RegulatoryInspector' in roles \
            and 'Manager' not in roles \
            and 'LabManager' not in roles \
            and 'LabClerk' not in roles

        if hidepatientinfo:
            # Remove patient fields. Must be done here because in __init__
            # method, member.getRoles() returns empty
            del self.columns['getPatientID']
            del self.columns['Patient']
            del self.columns['getClientPatientID']
            for rs in self.review_states:
                del rs['columns'][rs['columns'].index('getClientPatientID')]
                del rs['columns'][rs['columns'].index('Patient')]
                del rs['columns'][rs['columns'].index('getPatientID')]
        for x in range(len(items)):
            if 'obj' not in items[x]:
                continue
            obj = items[x]['obj']

            bid = obj.getBatchID()
            items[x]['BatchID'] = bid

            client = obj.Schema()['Client'].get(obj)
            doctor = obj.Schema()['Doctor'].get(obj)

            items[x]['Doctor'] = doctor and doctor.Title() or ''
            items[x]['replace']['Doctor'] = doctor \
                and "<a href='%s'>%s</a>" % \
                (doctor.absolute_url(),
                 doctor.Title()) or ''

            items[x]['Client'] = client and client.Title() or ''
            if hideclientlink == False:
                items[x]['replace']['Client'] = client \
                    and "<a href='%s'>%s</a>" % \
                    (client.absolute_url(),
                     client.Title()) or ''

            OnsetDate = obj.Schema()['OnsetDate'].get(obj)
            items[x]['replace']['OnsetDate'] = OnsetDate \
                and self.ulocalized_time(OnsetDate) or ''

            if hidepatientinfo == False:
                patient = obj.Schema()['Patient'].get(obj)
                items[x]['Patient'] = patient and patient or ''
                items[x]['replace']['Patient'] = patient \
                                and "<a href='%s'>%s</a>" % \
                                (patient.absolute_url(),
                                 patient.Title()) or ''
                items[x]['getClientPatientID'] = patient \
                                and patient.getClientPatientID() \
                                or ''
                items[x]['replace']['getClientPatientID'] = patient \
                                and "<a href='%s'>%s</a>" % \
                                    (patient.absolute_url(),
                                     items[x]['getClientPatientID']) \
                                or ''
                items[x]['getPatientID'] = patient and patient.id or ''
                items[x]['replace']['getPatientID'] = patient \
                                and "<a href='%s'>%s</a>" % \
                                    (patient.absolute_url(),
                                     items[x]['getPatientID']) \
                                or ''
        return items