def folderitems(self):
        mtool = getToolByName(self.context, 'portal_membership')
        member = mtool.getAuthenticatedMember()
        roles = member.getRoles()
        self.allow_edit = 'LabManager' in roles or 'Manager' in roles

        items = BikaListingView.folderitems(self)
        for x in range(len(items)):
            if not items[x].has_key('obj'):
                continue
            obj = items[x]['obj']

            cat = obj.getCategoryTitle()
            # Category (upper C) is for display column value
            items[x]['Category'] = cat
            if self.do_cats:
                # category is for bika_listing to groups entries
                items[x]['category'] = cat
                if cat not in self.categories:
                    self.categories.append(cat)

            analyses = [a.UID() for a in self.field_value]
            items[x]['selected'] = items[x]['uid'] in analyses

            items[x]['class']['Title'] = 'service_title'

            calculation = obj.getCalculation()
            items[x]['Calculation'] = calculation and calculation.Title()

            locale = locales.getLocale('en')
            currency = self.context.bika_setup.getCurrency()
            symbol = locale.numbers.currencies[currency].symbol
            items[x]['Price'] = "%s %s" % (symbol, obj.getPrice())
            items[x]['class']['Price'] = 'nowrap'

            after_icons = ''
            if obj.getAccredited():
                after_icons += "<img\
                    src='%s/++resource++bika.lims.images/accredited.png'\
                    title='%s'>" % (self.context.absolute_url(),
                                    _("Accredited"))
            if obj.getReportDryMatter():
                after_icons += "<img\
                    src='%s/++resource++bika.lims.images/dry.png'\
                    title='%s'>" % (self.context.absolute_url(),
                                    _("Can be reported as dry matter"))
            if obj.getAttachmentOption() == 'r':
                after_icons += "<img\
                    src='%s/++resource++bika.lims.images/attach_reqd.png'\
                    title='%s'>" % (self.context.absolute_url(),
                                    _("Attachment required"))
            if obj.getAttachmentOption() == 'n':
                after_icons += "<img\
                    src='%s/++resource++bika.lims.images/attach_no.png'\
                    title='%s'>" % (self.context.absolute_url(),
                                    _('Attachment not permitted'))
            if after_icons:
                items[x]['after']['Title'] = after_icons

        return items
Esempio n. 2
0
    def __init__(self, context, request, uids):
        super(ProjectBiospecView, self).__init__(context, request)
        self.uids = uids
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.show_column_toggles = False
        self.context_actions = {}
        self.allow_edit = False
        self.pagesize = 999999
        self.contentFilter['UID'] = self.uids

        self.columns = {
            'Title': {
                'title': _('Name'),
                'index': 'sortable_title'
            },
            'Description': {
                'title': _('Description'),
                'index': 'description',
                'toggle': True
            },
        }

        self.review_states = [
            {
                'id': 'default',
                'title': _('All'),
                'contentFilter': {},
                'columns': ['Title', 'Description']
            },
        ]
    def folderitems(self):
        mtool = getToolByName(self.context, 'portal_membership')
        member = mtool.getAuthenticatedMember()
        roles = member.getRoles()
        self.allow_edit = 'LabManager' in roles or 'Manager' in roles

        items = BikaListingView.folderitems(self)
        for x in range(len(items)):
            if not items[x].has_key('obj'):
                continue
            obj = items[x]['obj']

            cat = obj.getCategoryTitle()
            # Category (upper C) is for display column value
            items[x]['Category'] = cat
            if self.do_cats:
                # category is for bika_listing to groups entries
                items[x]['category'] = cat
                if cat not in self.categories:
                    self.categories.append(cat)

            analyses = [a.UID() for a in self.field_value]
            items[x]['selected'] = items[x]['uid'] in analyses

            items[x]['class']['Title'] = 'service_title'

            calculation = obj.getCalculation()
            items[x]['Calculation'] = calculation and calculation.Title()

            locale = locales.getLocale('en')
            currency = self.context.bika_setup.getCurrency()
            symbol = locale.numbers.currencies[currency].symbol
            items[x]['Price'] = "%s %s" % (symbol, obj.getPrice())
            items[x]['class']['Price'] = 'nowrap'

            after_icons = ''
            if obj.getAccredited():
                after_icons += "<img\
                    src='%s/++resource++bika.lims.images/accredited.png'\
                    title='%s'>" % (self.context.absolute_url(),
                                    _("Accredited"))
            if obj.getReportDryMatter():
                after_icons += "<img\
                    src='%s/++resource++bika.lims.images/dry.png'\
                    title='%s'>" % (self.context.absolute_url(),
                                    _("Can be reported as dry matter"))
            if obj.getAttachmentOption() == 'r':
                after_icons += "<img\
                    src='%s/++resource++bika.lims.images/attach_reqd.png'\
                    title='%s'>" % (self.context.absolute_url(),
                                    _("Attachment required"))
            if obj.getAttachmentOption() == 'n':
                after_icons += "<img\
                    src='%s/++resource++bika.lims.images/attach_no.png'\
                    title='%s'>" % (self.context.absolute_url(),
                                    _('Attachment not permitted'))
            if after_icons:
                items[x]['after']['Title'] = after_icons

        return items
Esempio n. 4
0
    def __init__(self, context, request):
        super(KitTemplatesView, self).__init__(context, request)

        request.set('disable_plone.rightcolumn', 1)

        self.catalog = "bika_setup_catalog"
        self.contentFilter = {
            'portal_type': 'KitTemplate',
            'sort_on': 'created',
            'sort_order': 'reverse',
            #'path': {"query": "/", "level": 0},
            'inactive_state': 'active',
        }

        self.context_actions = {}

        if self.context.portal_type == "KitTemplates":
            self.request.set('disable_border', 1)

        if self.view_url.find("kittemplates") == -1:
            self.view_url = self.view_url + "/kittemplates"

        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.form_id = "kittemplates"

        self.icon = self.portal_url + "/++resource++bika.lims.images/samplepartition_big.png"
        self.title = self.context.translate(_("Kit Templates"))
        self.description = ""

        mtool = getToolByName(self.context, 'portal_membership')
        member = mtool.getAuthenticatedMember()

        self.columns = {
            'Title': {
                'title': _('Title')
            },
            'Description': {
                'title': _('Description'),
                'index': 'description',
                'toggle': True
            }
        }
        self.review_states = [
            {
                'id': 'default',
                'title': _('Active'),
                #'contentFilter': {'sort_on':'created', 'sort_order': 'reverse'},
                'contentFilter': {
                    'inactive_state': 'active'
                },
                'transitions': [
                    {
                        'id': 'deactivate'
                    },
                ],
                'columns': ['Title', 'Description']
            },
        ]
Esempio n. 5
0
class SampleTypeSchemaExtender(object):
    adapts(ISampleType)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Service',
            schemata='Analyses',
            multiValued=1,
            allowed_types=('AnalysisService', ),
            relationship='SampleTypeAnalysisService',
            widget=ProjectAnalysesWidget(
                label=_("Sample Analyses"),
                description=
                _("The analyses included in this sample type, grouped per category"
                  ),
            )),
    ]

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

    def getFields(self):
        return self.fields

    def getOrder(self, schematas):
        return schematas
Esempio n. 6
0
    def __call__(self, *args, **kwargs):
        """
        """
        mtool = getToolByName(self.context, 'portal_membership')
        if mtool.checkPermission("Modify portal content", self.context):
            self.context_actions[_('Add')] = {
                'url': 'createObject?type_name=KitTemplate',
                'icon': '++resource++bika.lims.images/add.png'
            }
            self.review_states.append(
                {'id':'inactive',
                 'title': _('Dormant'),
                 'contentFilter': {'inactive_state': 'inactive'},
                 'transitions': [{'id':'activate'}, ],
                 'columns': ['Title',]})
            self.review_states.append(
                {'id': 'All',
                 'title': _('All'),
                 'contentFilter': {},
                 'transitions':[{'id':'empty'}],
                 'columns': [
                     'Title',
                 ]})
            stat = self.request.get("%s_review_state"%self.form_id, 'default')
            self.show_select_column = stat != 'all'

        return super(KitTemplatesView, self).__call__()
Esempio n. 7
0
    def __init__(self, context, request, uids):
        self.uids = uids
        super(ProjectAnalysisServicesView, self).__init__(context, request)
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.show_column_toggles = False
        self.context_actions = {}
        self.allow_edit = False
        self.pagesize = 999999
        self.contentFilter['UID'] = self.uids

        self.show_categories = True
        self.expand_all_categories = True
        self.ajax_categories = False

        self.columns = {
            'Title': {
                'title': _('Service'),
                'index': 'sortable_title'
            },
            'Price': {
                'title': _('Price')
            },
        }

        self.review_states = [{
            'id': 'default',
            'title': _('All'),
            'contentFilter': {},
            'columns': ['Title', 'Price']
        }]
Esempio n. 8
0
    def __init__(self, context, request, kit_uids):
        super(ShipmentKitsView, self).__init__(context, request)
        self.context = context
        self.request = request
        self.uids = kit_uids
        self.catalog = 'bika_catalog'
        path = path = '/'.join(context.aq_parent.getPhysicalPath())
        self.contentFilter = {
            'portal_type': 'Kit',
            'UID': self.uids,
            'sort_on': 'sortable_title',
            'path': {
                'query': path,
                'depth': 1,
                'level': 0
            }
        }
        self.context_actions = {}
        self.title = ''
        self.description = ''
        self.icon = ''
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.show_column_toggles = False
        self.context_actions = {}
        self.allow_edit = False
        self.pagesize = 999999
        self.columns = {
            'Title': {
                'title': _('Kit Name'),
                'index': 'sortable_title'
            },
            'kitTemplate': {
                'title': _('Kit template'),
                'toggle': True
            },
            'state_title': {
                'title': _('State'),
                'index': 'review_state'
            },
        }

        self.review_states = [{
            'id':
            'default',
            'title':
            _('All'),
            'contentFilter': {
                'sort_on': 'created',
                'sort_order': 'ascending'
            },
            'transitions': [],
            'columns': ['Title', 'kitTemplate', 'state_title']
        }]
    def __init__(self, context, request, field_value=[], allow_edit=False):
        super(ProjectAnalysesView, self).__init__(context, request)
        self.catalog = "bika_setup_catalog"
        self.contentFilter = {'portal_type': 'AnalysisService',
                              'sort_on': 'sortable_title',
                              'inactive_state': 'active'}
        self.context_actions = {}
        self.base_url = self.context.absolute_url()
        self.view_url = self.base_url
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_all_checkbox = False
        self.show_column_toggles = False
        self.show_select_column = True
        self.allow_edit = allow_edit
        self.form_id = "analyses"
        self.profile = None

        self.categories = []
        self.do_cats = self.context.bika_setup.getCategoriseAnalysisServices()
        if self.do_cats:
            self.pagesize = 999999  # hide batching controls
            self.show_categories = True
            self.expand_all_categories = False
            self.ajax_categories = True
            self.ajax_categories_url = self.context.absolute_url() + \
                                       "/sampletype_analysesview"
            self.category_index = 'getCategoryTitle'

        self.columns = {
            'Title': {'title': _('Service'),
                      'index': 'sortable_title',
                      'sortable': False,},
            'Price': {'title': _('Price'),
                      'sortable': False,},
        }

        self.review_states = [
            {'id': 'default',
             'title': _('All'),
             'contentFilter': {},
             'columns': ['Title',
                         'Price',
                         ],
             'transitions': [{'id': 'empty'}, ],  # none
             },
        ]

        if not context.bika_setup.getShowPrices():
            self.review_states[0]['columns'].remove('Price')

        self.field_value = field_value
        self.selected = [x.UID() for x in field_value]
Esempio n. 10
0
    def __init__(self, context, request):
        super(KitTemplatesView, self).__init__(context, request)

        request.set('disable_plone.rightcolumn', 1)

        self.catalog = "bika_setup_catalog"
        self.contentFilter = {'portal_type': 'KitTemplate',
                              'sort_on': 'created',
                              'sort_order': 'reverse',
                              #'path': {"query": "/", "level": 0},
                              'inactive_state': 'active',
                              }

        self.context_actions = {}

        if self.context.portal_type == "KitTemplates":
            self.request.set('disable_border', 1)

        if self.view_url.find("kittemplates") == -1:
            self.view_url = self.view_url + "/kittemplates"

        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.form_id = "kittemplates"

        self.icon = self.portal_url + "/++resource++bika.lims.images/samplepartition_big.png"
        self.title = self.context.translate(_("Kit Templates"))
        self.description = ""

        mtool = getToolByName(self.context, 'portal_membership')
        member = mtool.getAuthenticatedMember()

        self.columns = {
            'Title': {'title': _('Title')},
            'Description': {'title': _('Description'),
                            'index': 'description',
                            'toggle': True}
        }
        self.review_states = [
            {'id': 'default',
             'title': _('Active'),
             #'contentFilter': {'sort_on':'created', 'sort_order': 'reverse'},
             'contentFilter': {'inactive_state': 'active'},
             'transitions': [{'id':'deactivate'}, ],
             'columns': [
                 'Title',
                 'Description'
             ]},
        ]
Esempio n. 11
0
class ProjectView(BrowserView):
    """
    """
    template = ViewPageTemplateFile("templates/project_view.pt")
    title = _("Project Registration")

    def __call__(self):
        context = self.context
        request = self.request
        portal = self.portal
        self.absolute_url = context.absolute_url()
        setup = portal.bika_setup

        # __Disable the add new menu item__ #
        context.setLocallyAllowedTypes(())

        # __Collect general data__ #
        self.id = context.getId()
        self.title = context.Title()
        self.client = "<a href='%s'>%s</a>" % (
            context.aq_parent.absolute_url(), context.aq_parent.Title())
        self.study_type = context.getStudyType()
        self.participants = context.getNumParticipants()
        self.age_interval = str(context.getAgeLow()) + ' - ' + str(
            context.getAgeHigh())

        biospecimen_types = ProjectBiospecView(context, request,
                                               context.getSampleType())
        self.bio_table = biospecimen_types.contents_table()

        uids = [o.UID() for o in context.getService()]
        view = ProjectAnalysisServicesView(context, request, uids)

        self.analyses_table = view.contents_table()
        return self.template()
Esempio n. 12
0
    def __init__(self, context, request, kit_uids):
        super(ShipmentKitsView, self).__init__(context, request)
        self.context = context
        self.request = request
        self.uids = kit_uids
        self.catalog = 'bika_catalog'
        path = path = '/'.join(context.aq_parent.getPhysicalPath())
        self.contentFilter = {
            'portal_type': 'Kit',
            'UID': self.uids,
            'sort_on': 'sortable_title',
            'path': {'query': path, 'depth': 1, 'level': 0}
        }
        self.context_actions = {}
        self.title = ''
        self.description = ''
        self.icon = ''
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.show_column_toggles = False
        self.context_actions = {}
        self.allow_edit = False
        self.pagesize = 999999
        self.columns = {
            'Title': {'title': _('Kit Name'),
                      'index': 'sortable_title'},
            'kitTemplate': {'title': _('Kit template'),
                            'toggle': True},
            'state_title': {'title': _('State'),
                            'index': 'review_state'},
        }

        self.review_states = [
            {
                'id': 'default',
                'title': _('All'),
                'contentFilter': {'sort_on': 'created',
                                  'sort_order': 'ascending'},
                'transitions': [],
                'columns': [
                    'Title',
                    'kitTemplate',
                    'state_title'
                ]
            }
        ]
Esempio n. 13
0
 def _getBiospecimensDisplayList(self):
     bsc = getToolByName(self, 'bika_setup_catalog')
     items = [(i.UID, i.Title) \
              for i in bsc(portal_type='SampleType',
                           inactive_state='active')]
     items.sort(lambda x, y: cmp(x[1], y[1]))
     items.insert(0, ('', _("None")))
     return DisplayList(list(items))
Esempio n. 14
0
 def _getBiospecimensDisplayList(self):
     bsc = getToolByName(self, 'bika_setup_catalog')
     items = [(i.UID, i.Title) \
              for i in bsc(portal_type='SampleType',
                           inactive_state='active')]
     items.sort(lambda x, y: cmp(x[1], y[1]))
     items.insert(0, ('', _("None")))
     return DisplayList(list(items))
Esempio n. 15
0
    def __init__(self, context, request):
        super(InvoiceCreate, self).__init__(context, request)
        self.context = context
        self.columns['service'] = {'title': _('Service')}

        # Add column 'service' to the lising table columns
        for state in self.review_states:
            state['columns'].insert(state['columns'].index('start'), 'service')
Esempio n. 16
0
 def __init__(self, context, request):
     super(StorageUnitInventoryView, self).__init__(context, request)
     self.contentFilter['getUnitID'] = context.getId()
     self.context_actions = {
         _('Add'): {
             'url': 'createObject?type_name=StorageInventory',
             'icon': '++resource++bika.lims.images/add.png'
         }
     }
Esempio n. 17
0
class AnalysisRequestSchemaExtender(object):
    adapts(IAnalysisRequest)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Project',
            vocabulary_display_path_bound=sys.maxsize,
            allowed_types=('Project',),
            referenceClass=HoldingReference,
            relationship='AnalysisRequestProject',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=bikaReferenceWidget(
                label=_("Project"),
                description=_("Select the project of the AR."),
                size=20,
                visible={'edit': 'invisible',
                         'view': 'visible',
                         'add': 'edit',
                         'header_table': 'visible',
                         'sample_due': {'view': 'visible', 'edit': 'invisible'},
                         'sample_received': {'view': 'visible', 'edit': 'invisible'},
                         'to_be_verified': {'view': 'visible', 'edit': 'invisible'},
                         'verified': {'view': 'visible', 'edit': 'invisible'},
                         'published': {'view': 'visible', 'edit': 'invisible'},
                         'invalid': {'view': 'visible', 'edit': 'invisible'},
                         'rejected': {'view': 'visible', 'edit': 'invisible'},
                         },
                catalog_name='bika_catalog',
            ),
        ),
    ]

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

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
    def __init__(self, context, request, field_value=[], allow_edit=False):
        super(ProductSuppliersView, self).__init__(context, request)
        self.catalog = "bika_setup_catalog"
        self.contentFilter = {'portal_type': 'Supplier',
                              'sort_on': 'sortable_title',
                              'inactive_state': 'active'}
        self.context_actions = {}
        self.base_url = context.absolute_url()
        self.view_url = self.base_url
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_all_checkbox = False
        self.show_column_toggles = False
        self.show_select_column = True
        self.allow_edit = allow_edit
        self.form_id = "suppliers"
        self.profile = None

        self.do_cats = False

        self.columns = {
            'Name': {'title': _('Name'),
                     'index': 'sortable_title',
                     'sortable': False,},
            'Website': {'title': _('Website'),
                        'sortable': False,},
        }

        self.review_states = [
            {'id': 'default',
             'title': _('All'),
             'contentFilter': {},
             'columns': ['Name',
                         'Website',
                         ],
             'transitions': [{'id': 'empty'}, ],
             },
        ]

        self.field_value = field_value
        self.selected = [x.UID() for x in field_value]
Esempio n. 19
0
    def __call__(self, *args, **kwargs):
        """
        """
        mtool = getToolByName(self.context, 'portal_membership')
        if mtool.checkPermission("Modify portal content", self.context):
            self.context_actions[_('Add')] = {
                'url': 'createObject?type_name=KitTemplate',
                'icon': '++resource++bika.lims.images/add.png'
            }
            self.review_states.append({
                'id': 'inactive',
                'title': _('Dormant'),
                'contentFilter': {
                    'inactive_state': 'inactive'
                },
                'transitions': [
                    {
                        'id': 'activate'
                    },
                ],
                'columns': [
                    'Title',
                ]
            })
            self.review_states.append({
                'id': 'All',
                'title': _('All'),
                'contentFilter': {},
                'transitions': [{
                    'id': 'empty'
                }],
                'columns': [
                    'Title',
                ]
            })
            stat = self.request.get("%s_review_state" % self.form_id,
                                    'default')
            self.show_select_column = stat != 'all'

        return super(KitTemplatesView, self).__call__()
Esempio n. 20
0
    def __call__(self):

        mtool = getToolByName(self.context, "portal_membership")
        if mtool.checkPermission(AddShipment, self.context) and self.context.portal_type == "Project":
            self.context_actions[_("Add")] = {
                "url": "createObject?type_name=Shipment",
                "icon": "++resource++bika.lims.images/add.png",
            }

        if mtool.checkPermission(ManageShipments, self.context):
            stat = self.request.get("%s_review_state" % self.form_id, "default")
            # self.show_select_column = stat != 'all'
        return super(ShipmentsView, self).__call__()
Esempio n. 21
0
 def __call__(self):
     mtool = getToolByName(self.context, 'portal_membership')
     addPortalMessage = self.context.plone_utils.addPortalMessage
     w_tool = getToolByName(self.context, 'portal_workflow')
     active_contacts = [c for c in self.context.objectValues('Contact') if
                        w_tool.getInfoFor(c, 'inactive_state', '') == 'active']
     if isActive(self.context):
         if self.context.portal_type == "Client":
             if not active_contacts:
                 msg = _("Client contact required before request may be submitted")
                 addPortalMessage(msg)
             else:
                 if mtool.checkPermission(AddProject, self.context):
                     self.context_actions[_('Add')] = {
                         'url': 'createObject?type_name=Project',
                         'icon': '++resource++bika.lims.images/add.png'
                     }
     if mtool.checkPermission(ManageProjects, self.context):
         self.review_states[0]['transitions'].append({'id': 'deactivate'})
         self.review_states.append(
             {'id': 'inactive',
              'title': _('Dormant'),
              'contentFilter': {'inactive_state': 'inactive'},
              'transitions': [{'id': 'activate'}, ],
              'columns': ['Title',
                          'getClient',
                          'getStudyType']})
         self.review_states.append(
             {'id': 'all',
              'title': _('All'),
              'contentFilter': {},
              'transitions': [{'id': 'empty'}],
              'columns': ['Title',
                          'getClient',
                          'getStudyType']})
         stat = self.request.get("%s_review_state" % self.form_id, 'default')
         self.show_select_column = stat != 'all'
     return super(ProjectsView, self).__call__()
Esempio n. 22
0
    def __call__(self):

        mtool = getToolByName(self.context, 'portal_membership')
        if mtool.checkPermission(AddShipment, self.context) and \
                self.context.portal_type == 'Project':
            self.context_actions[_('Add')] = {
                'url': 'createObject?type_name=Shipment',
                'icon': '++resource++bika.lims.images/add.png'
            }

        if mtool.checkPermission(ManageShipments, self.context):
            stat = self.request.get("%s_review_state" % self.form_id,
                                    'default')
            # self.show_select_column = stat != 'all'
        return super(ShipmentsView, self).__call__()
Esempio n. 23
0
    def __init__(self, context, request):
        super(ProjectsView, self).__init__(context, request)
        self.catalog = "bika_catalog"
        self.contentFilter = {'portal_type': 'Project',
                              'sort_on': 'sortable_title'}
        self.context_actions = {}
        self.title = self.context.translate(_("Projects"))
        self.icon = self.portal_url + \
                    "/++resource++bika.sanbi.images/project_big.png"
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.pagesize = 50

        if self.context.portal_type == 'Projects':
            self.request.set('disable_border', 1)

        self.columns = {
            'Title': {'title': _('Project'),
                      'index': 'sortable_title'},
            'getClient': {'title': _('Client'),
                          'toggle': True},
            'getStudyType': {'title': _('Study Type'),
                             'toggle': True},
        }

        self.review_states = [
            {'id': 'default',
             'title': _('Active'),
             'contentFilter': {'inactive_state': 'active'},
             'transitions': [],
             'columns': ['Title',
                         'getClient',
                         'getStudyType']},
        ]
Esempio n. 24
0
    def renderSTemplate(self):
        templates_dir = self._TEMPLATES_DIR
        template_name = 'sticker_kit.pt'

        embed = ViewPageTemplateFile(os.path.join(templates_dir, template_name))
        reptemplate = ""
        try:
            reptemplate = embed(self)
        except:
            tbex = traceback.format_exc()
            ktid = self.context.id
            reptemplate = "<div class='error-print'>%s - %s '%s':<pre>%s</pre></div>" % (
                ktid, _("Unable to load the template"), template_name, tbex)

        return reptemplate
Esempio n. 25
0
    def renderSTemplate(self):
        templates_dir = self._TEMPLATES_DIR
        template_name = 'sticker_kit.pt'

        embed = ViewPageTemplateFile(os.path.join(templates_dir,
                                                  template_name))
        reptemplate = ""
        try:
            reptemplate = embed(self)
        except:
            tbex = traceback.format_exc()
            ktid = self.context.id
            reptemplate = "<div class='error-print'>%s - %s '%s':<pre>%s</pre></div>" % (
                ktid, _("Unable to load the template"), template_name, tbex)

        return reptemplate
Esempio n. 26
0
    def render_shipment(self):
        templates_dir = self._TEMPLATES_DIR
        template_name = 'shipment_print.pt'
        self.header_text = "{0} : {1}".format(self.context.aq_parent,
                                              self.context.aq_parent.getId())
        embed = ViewPageTemplateFile(os.path.join(templates_dir, template_name))
        reptemplate = ""
        try:
            reptemplate = embed(self)
        except:
            tbex = traceback.format_exc()
            ktid = self.context.id
            reptemplate = "<div class='error-print'>%s - %s " \
                          "'%s':<pre>%s</pre></div>" % (
                ktid, _("Unable to load the template"), template_name, tbex)

        return reptemplate
Esempio n. 27
0
    def render_invoice(self):
        """Render template
        """
        templates_dir = self._TEMPLATES_DIR
        template_name = 'invoice.pt'

        template_file = ViewPageTemplateFile(os.path.join(templates_dir, template_name))
        embed = template_file
        try:
            rep_template = embed(self)
        except:
            tbex = traceback.format_exc()
            ktid = self.context.id
            rep_template = "<div class='error-print'>%s - %s " \
                           "'%s':<pre>%s</pre></div>" % (
                              ktid, _("Unable to load the template"), template_name, tbex)

        return rep_template
Esempio n. 28
0
    def render_shipment(self):
        templates_dir = self._TEMPLATES_DIR
        template_name = 'shipment_print.pt'
        self.header_text = "{0} : {1}".format(self.context.aq_parent,
                                              self.context.aq_parent.getId())
        embed = ViewPageTemplateFile(os.path.join(templates_dir,
                                                  template_name))
        reptemplate = ""
        try:
            reptemplate = embed(self)
        except:
            tbex = traceback.format_exc()
            ktid = self.context.id
            reptemplate = "<div class='error-print'>%s - %s " \
                          "'%s':<pre>%s</pre></div>" % (
                ktid, _("Unable to load the template"), template_name, tbex)

        return reptemplate
Esempio n. 29
0
    def __init__(self, context, request):
        super(StorageTypesView, self).__init__(context, request)
        self.catalog = 'bika_setup_catalog'
        self.contentFilter = {'portal_type': 'StorageType',
                              'sort_on': 'sortable_title'}
        self.context_actions = {_('Add'):
                                {'url': 'createObject?type_name=StorageType',
                                 'icon': '++resource++bika.lims.images/add.png'}}
        self.icon = self.portal_url + "/++resource++bika.lims.images/to_follow_big.png"
        self.title = self.context.translate(_("Storage Types"))
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25

        self.columns = {
            'Title': {'title': _('Type'),
                      'index': 'sortable_title'},
            'Description': {'title': _('Description'),
                            'index': 'description',
                            'toggle':True},
        }

        self.review_states = [
            {
                'id':'default',
                'title': _('Active'),
                'contentFilter': {'inactive_state': 'active'},
                'transitions': [{'id':'deactivate'}, ],
                'columns': ['Title', 'Description']
            },
            {
                'id':'inactive',
                'title': _('Dormant'),
                'contentFilter': {'inactive_state': 'inactive'},
                'transitions': [{'id':'activate'}, ],
                'columns': ['Title', 'Description']
            },
            {
                'id':'all',
                'title': _('All'),
                'contentFilter':{},
                'columns': ['Title', 'Description']
            },
        ]
Esempio n. 30
0
class MultimageView(BrowserView):
    template = ViewPageTemplateFile("templates/multimage_view.pt")
    title = _("Managing Storage")

    def __call__(self):
        context = self.context
        request = self.request
        portal = self.portal

        self.filename = context.getFile().filename
        self.path = context.getFile().absolute_url_path()
        self.size = context.get_size()
        self.full_screen = self.path + "/image_view_fullscreen"
        self.image_src = self.path + "/image_preview"
        self.download = self.path + "/download"
        self.search_icon = portal.absolute_url() + "/search_icon.png"
        self.download_icon = portal.absolute_url() + "/download_icon.png"

        return self.template()
Esempio n. 31
0
    def render_invoice(self):
        """Render template
        """
        templates_dir = self._TEMPLATES_DIR
        template_name = 'invoice.pt'

        template_file = ViewPageTemplateFile(
            os.path.join(templates_dir, template_name))
        embed = template_file
        try:
            rep_template = embed(self)
        except:
            tbex = traceback.format_exc()
            ktid = self.context.id
            rep_template = "<div class='error-print'>%s - %s " \
                           "'%s':<pre>%s</pre></div>" % (
                              ktid, _("Unable to load the template"), template_name, tbex)

        return rep_template
Esempio n. 32
0
class InvoiceBatchSchemaExtender(object):
    adapts(IInvoiceBatch)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Project',
            allowed_types=('Project', ),
            relationship='InvoiceProject',
            referenceClass=HoldingReference,
            widget=bika_ReferenceWidget(
                label=_("Project"),
                catalog_name='bika_catalog',
                size=30,
                showOn=True,
                description=_("Click and select project for the kit."),
            )),
        ExtStringField('Service',
                       searchable=True,
                       vocabulary=INVOICE_SERVICES,
                       widget=SelectionWidget(
                           format="select",
                           label=_("Service"),
                           description=_("Select the service to invoice."),
                       )),
        ExtLinesField(
            'Services',
            vocabulary=INVOICE_SERVICES,
            widget=MultiSelectionWidget(
                label=_("Invoice Services"),
                description=_("Select the services to invoice."),
            ),
        ),
    ]

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

    def getFields(self):
        return self.fields

    def getOrder(self, schematas):
        sch = schematas['default']
        sch.remove('Project')
        sch.remove('Services')
        sch.insert(sch.index('BatchStartDate'), 'Project')
        sch.insert(sch.index('BatchStartDate'), 'Services')
        schematas['default'] = sch
        return schematas
Esempio n. 33
0
    def __init__(self, context, request):
        super(MultimagesView, self).__init__(context, request)
        self.catalog = "bika_setup_catalog"
        self.contentFilter = {
            'portal_type': 'Multimage',
        }
        self.context_actions = {_('Add'):
                                    {'url': 'createObject?type_name=Multimage',
                                     'icon':
                                         '++resource++bika.lims.images/add.png'}}
        self.show_table_only = False
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25
        self.form_id = "multimage"
        self.icon = self.portal_url + \
                    "/++resource++bika.lims.images" \
                    "/instrumentcertification_big.png"
        self.title = self.context.translate(_("Images"))
        self.description = ""

        self.columns = {
            "DocumentID": {'title': _("Document ID"),
                           'index': 'sortable_title'},
            "SmallDesc": {'title': _("Description"),
                          'index': 'sortable_title'},
            "DatetimeCreated": {'title': _("Date Creation"),
                                'toggle': False},
            'FileDownload': {'title': _('File')}
        }

        self.review_states = [
            {'id': 'default',
             'title': _("All"),
             'contentFilter': {},
             'columns': ['DocumentID',
                         'SmallDesc',
                         'FileDownload',
                         'DatetimeCreated']},
        ]
Esempio n. 34
0
from Products.Archetypes.public import DisplayList
from bika.sanbi import bikaMessageFactory as _

PROJECTNAME = "SANBI"

GLOBALS = globals()

INVENTORY_TYPES = DisplayList((
    ('N', _('None')),
    ('g', _('Glassware')),
    ('a', _('Reagents Ambient Temperature')),
    ('t', _('Reagents Cold Temperature')),
    ('o', _('Other')),
))

DIMENSION_OPTIONS = DisplayList((
    ('N', _('None')),
    ('f', _('One Dimension\t')),
    ('s', _('Two Dimension\t')),
))

VOLUME_UNITS = [{
    'ResultValue': '1',
    'ResultText': 'ml'
}, {
    'ResultValue': '2',
    'ResultText': 'kg'
}]

PRICELIST_TYPES = DisplayList((
    ('AnalysisService', _('Analysis Services')),
Esempio n. 35
0
    def __init__(self, context, request):
        super(StorageTypesView, self).__init__(context, request)
        self.catalog = 'bika_setup_catalog'
        self.contentFilter = {
            'portal_type': 'StorageType',
            'sort_on': 'sortable_title'
        }
        self.context_actions = {
            _('Add'): {
                'url': 'createObject?type_name=StorageType',
                'icon': '++resource++bika.lims.images/add.png'
            }
        }
        self.icon = self.portal_url + "/++resource++bika.lims.images/to_follow_big.png"
        self.title = self.context.translate(_("Storage Types"))
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25

        self.columns = {
            'Title': {
                'title': _('Type'),
                'index': 'sortable_title'
            },
            'Description': {
                'title': _('Description'),
                'index': 'description',
                'toggle': True
            },
        }

        self.review_states = [
            {
                'id': 'default',
                'title': _('Active'),
                'contentFilter': {
                    'inactive_state': 'active'
                },
                'transitions': [
                    {
                        'id': 'deactivate'
                    },
                ],
                'columns': ['Title', 'Description']
            },
            {
                'id': 'inactive',
                'title': _('Dormant'),
                'contentFilter': {
                    'inactive_state': 'inactive'
                },
                'transitions': [
                    {
                        'id': 'activate'
                    },
                ],
                'columns': ['Title', 'Description']
            },
            {
                'id': 'all',
                'title': _('All'),
                'contentFilter': {},
                'columns': ['Title', 'Description']
            },
        ]
Esempio n. 36
0
    return instance.getKit().UID()

@indexer(IBiospecimen)
def get_biospecimen_project_uid(instance):
    return instance.getKit().getProject().UID()

schema = BikaFolderSchema.copy() + BikaSchema.copy() + Schema((

    ReferenceField(
        'Type',
        vocabulary_display_path_bound=sys.maxint,
        allowed_types=('BiospecType',),
        relationship='BiospecimenType',
        referenceClass=HoldingReference,
        widget=bika_ReferenceWidget(
            label=_("Biospecimen type"),
            catalog_name='bika_setup_catalog',
            size=30,
            showOn=True,
            description=_("Click and select a biospecimen type."),
            visible={'view': 'invisible', 'edit': 'visible'}
        )
    ),

    ReferenceField('Kit',
        vocabulary_display_path_bound=sys.maxint,
        allowed_types=('Kit',),
        relationship='BiospecimenKit',
        referenceClass=HoldingReference,
        widget=bika_ReferenceWidget(
            label=_("Kit"),
Esempio n. 37
0
    def __init__(self, context, request):
        super(AliquotsView, self).__init__(context, request)
        self.context = context
        self.request = request
        self.catalog = "bika_catalog"
        self.contentFilter = {
            'portal_type': 'Sample',
            'sort_on': 'sortable_title'
        }
        # self.sort_on = 'Title'
        self.context_actions = {}
        self.title = self.context.translate(_("Aliquots"))
        self.icon = self.portal_url + \
                    "/++resource++bika.sanbi.images/aliquot_big.png"
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.pagesize = 50
        request.set('disable_plone.rightcolumn', 1)
        self.allow_edit = True

        if self.context.portal_type == 'Aliquots':
            self.request.set('disable_border', 1)

        self.columns = {
            'Title': {
                'title': _('Aliquot'),
                'index': 'sortable_title'
            },
            'Biospecimen': {
                'title': _('Biospecimen'),
                'toggle': True
            },
            'AliquotType': {
                'title': _('Aliquot Type'),
                'toggle': True
            },
            'Volume': {
                'title': _('Volume'),
                'toggle': True,
                'input_width': '7'
            },
            'Unit': {
                'title': _('Unit'),
                'toggle': True,
                'input_width': '15'
            },
            'Project': {
                'title': _('Project'),
                'index': 'sortable_title'
            },
            'state_title': {
                'title': _('State'),
                'index': 'review_state'
            },
            # 'Location': {'title': _('Location'),
            #              'toggle': True},
        }

        self.review_states = [
            {
                'id':
                'default',
                'title':
                _('Active'),
                'contentFilter': {
                    'cancellation_state': 'active',
                    'sort_order': 'ascending'
                },
                'transitions': [{
                    'id': 'receive'
                }, {
                    'id': 'cancel'
                }],
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id':
                'sample_due',
                'title':
                _('Sample Due'),
                'contentFilter': {
                    'review_state': 'sample_due',
                    'sort_order': 'ascending'
                },
                'transitions': [{
                    'id': 'receive'
                }, {
                    'id': 'cancel'
                }],
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id':
                'sample_received',
                'title':
                _('Received'),
                'contentFilter': {
                    'review_state': 'sample_received'
                },
                'transitions': [
                    {
                        'id': 'cancel'
                    },
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id':
                'cancelled',
                'title':
                _('Cancelled'),
                'contentFilter': {
                    'cancellation_state': 'cancelled'
                },
                'transitions': [
                    {
                        'id': 'reinstate'
                    },
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id':
                'all',
                'title':
                _('All'),
                'contentFilter': {},
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    # 'Location'
                ]
            }
        ]
Esempio n. 38
0
    def __init__(self, context, request):
        super(BiospecimensView, self).__init__(context, request)
        self.context = context
        self.catalog = 'bika_catalog'
        request.set('disable_plone.rightcolumn', 1)
        self.contentFilter = {
            'portal_type': 'Sample',
            'sort_on': 'created',
            'sort_order': 'ascending'
        }
        self.context_actions = {}
        self.title = self.context.translate(_("Biospecimens"))
        self.icon = self.portal_url + \
                    "/++resource++bika.sanbi.images/biospecimen_big.png"
        self.description = ''
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.pagesize = 25
        self.allow_edit = True

        if self.context.portal_type == 'Biospecimens':
            self.request.set('disable_border', 1)
            
        self.columns = {
            'Title': {
                'title': _('Title'),
                'index': 'sortable_title'
            },
            'Type': {
                'title': _('Type'),
                'toggle': True,
                'type': 'choices'
            },
            'Volume': {
                'title': _('Volume'),
                'toggle': True,
                'input_width': '7'
            },
            'Unit': {
                'title': _('Unit'),
                'toggle': True
            },
            'SubjectID': {
                'title': _('Subject ID'),
                'allow_edit': True,
                'input_class': 'text',
                'input_width': '10',
                'toggle': True
            },
            'Kit': {
                'title': _('Kit'),
                'index': 'sortable_title'
            },
            'Barcode': {
                'title': _('Barcode'),
                'allow_edit': True,
                'input_class': 'text',
                'input_width': '10',
                'toggle': True
            },
            'Project': {
                'title': _('Project'),
                'index': 'sortable_title'
            },
            'state_title': {
                'title': _('State'),
                'index': 'review_state'
            },
            # 'Location': {
            #     'title': _('Location'),
            #     'toggle': True
            # },
        }

        self.review_states = [
            {
                'id': 'default',
                'title': _('Active'),
                'contentFilter': {
                    'cancellation_state': 'active',
                    'sort_on': 'created',
                    'sort_order': 'ascending'
                },
                'transitions': [
                    {'id': 'receive'},
                    {'id': 'cancel'}
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Kit',
                    'Type',
                    'SubjectID',
                    'Barcode',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id': 'sample_due',
                'title': _('Sample Due'),
                'contentFilter': {
                    'review_state': 'sample_due',
                    'cancellation_state': 'active',
                    'sort_on': 'created',
                    'sort_order': 'ascending'
                },
                'transitions': [
                    {'id': 'receive'},
                    {'id': 'cancel'}
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Kit',
                    'Type',
                    'SubjectID',
                    'Barcode',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id': 'sample_received',
                'title': _('Received'),
                'contentFilter': {
                    'review_state': 'sample_received',
                    'sort_on': 'created',
                    'sort_order': 'reverse'
                },
                'transitions': [
                    {'id': 'cancel'}
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Kit',
                    'Type',
                    'SubjectID',
                    'Barcode',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },

            {
                'id': 'cancelled',
                'title': _('Cancelled'),
                'contentFilter':{
                    'cancellation_state': 'cancelled',
                    'sort_order': 'reverse',
                    'sort_on':'created'
                },
                'transitions': [
                    {'id': 'reinstate'},
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Kit',
                    'Type',
                    'SubjectID',
                    'Barcode',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },

            {
                'id': 'all',
                'title': _('All'),
                'contentFilter': {
                    'sort_on': 'created',
                    'sort_order': 'ascending'
                },
                'columns': [
                    'Title',
                    'Project',
                    'Kit',
                    'Type',
                    'SubjectID',
                    'Barcode',
                    'Volume',
                    'Unit',
                    # 'Location'
                ]
            },
        ]
Esempio n. 39
0
from Products.Archetypes.public import DisplayList
from bika.sanbi import bikaMessageFactory as _

PROJECTNAME = "SANBI"

GLOBALS = globals()

INVENTORY_TYPES = DisplayList((
    ('N', _('None')),
    ('g', _('Glassware')),
    ('a', _('Reagents Ambient Temperature')),
    ('t', _('Reagents Cold Temperature')),
    ('o', _('Other')),
))

DIMENSION_OPTIONS = DisplayList((
    ('N', _('None')),
    ('f', _('One Dimension\t')),
    ('s', _('Two Dimension\t')),
))

VOLUME_UNITS = [
    {'ResultValue': '1', 'ResultText': 'ml'},
    {'ResultValue': '2', 'ResultText': 'kg'}
]

PRICELIST_TYPES = DisplayList((
    ('AnalysisService', _('Analysis Services')),
    ('LabProduct', _('Lab Products')),
    ('KitTemplate', _('Kits')),
    ('StorageType', _('Sample Storage')),
Esempio n. 40
0
    def __init__(self, context, request):
        BikaListingView.__init__(self, context, request)
        self.context = context
        self.request = request
        self.catalog = 'bika_catalog'
        request.set('disable_plone.rightcolumn', 1)
        self.contentFilter = {
            'portal_type': 'Kit',
            'sort_on': 'sortable_title',
            'sort_order': 'reverse'
        }
        # Todo: I add these two line to set the sort and the order of kit listing because
        # Todo: the values in self.contentFilter seems have no effect!
        self.sort_on = 'sortable_title'
        self.request.set('list_sort_order', 'reverse')

        self.context_actions = {}
        self.title = self.context.translate(_("Kits"))
        self.icon = self.portal_url + \
                    "/++resource++bika.sanbi.images/kit_big.png"
        self.description = ''

        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.pagesize = 25

        if self.context.portal_type == 'Kits':
            self.request.set('disable_border', 1)

        self.columns = {
            'Title': {'title': _('Kit Name')},
            'Project': {'title': _('Project'),
                            'toggle': True},
            'kitTemplate': {'title': _('Kit template'),
                            'toggle': True},
            'state_title': {'title': _('State'),
                            'index': 'review_state'},
            'sortable_title':{}
        }

        self.review_states = [
            {
                'id': 'default',
                'title': _('Active'),
                'contentFilter': {
                    'inactive_state': 'active',
                },
                'transitions': [
                    {'id': 'deactivate'},
                    {'id': 'receive_kit'},
                    {'id': 'process'},
                    # {'id': 'ship'}
                ],
                'columns': [
                    'Title',
                    'Project',
                    'kitTemplate',
                    'state_title'
                ]
            },
            {
                'id': 'shipped',
                'title': _('Shipped'),
                'contentFilter': {
                    'review_state': 'shipped',
                    'sort_on': 'sortable_title',
                    'sort_order': 'reverse'
                },
                'transitions': [
                    {'id': 'deactivate'},
                    {'id': 'receive_kit'}
                ],
                'columns': [
                    'Title',
                    'Project',
                    'kitTemplate',
                    'state_title'
                ]
            },
            {
                'id': 'received',
                'title': _('Received'),
                'contentFilter': {
                    'review_state': 'received',
                    'sort_on': 'sortable_title',
                    'sort_order': 'reverse'
                },
                'transitions': [
                    {'id': 'deactivate'},
                    {'id': 'process'}
                ],
                'columns': [
                    'Title',
                    'Project',
                    'kitTemplate',
                    'state_title'
                ]
            },
            {
                'id': 'processed',
                'title': _('Processed'),
                'contentFilter': {
                    'review_state': 'processed',
                    'sort_on': 'sortable_title',
                    'sort_order': 'reverse'
                },
                'transitions': [{'id': 'deactivate'}],
                'columns': [
                    'Title',
                    'Project',
                    'kitTemplate',
                    'state_title'
                ]
            },
            {
                'id': 'all',
                'title': _('All'),
                'contentFilter': {
                    'sort_on': 'sortable_title',
                    'sort_order': 'reverse'
                },
                'columns': [
                    'Title',
                    'Project',
                    'kitTemplate',
                    'state_title'
                ]
            },
        ]
Esempio n. 41
0
    def __init__(self, context, request):
        super(ShipmentsView, self).__init__(context, request)
        self.context = context
        self.request = request
        self.contentFilter = {
            'portal_type': 'Shipment',
            'sort_on': 'sortable_title'
        }
        request.set('disable_plone.rightcolumn', 1)
        self.context_actions = {}
        self.catalog = 'bika_catalog'
        self.title = self.context.translate(_("Shipments"))
        self.icon = self.portal_url + \
                    "/++resource++bika.sanbi.images/shipments_big.png"
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 50

        if self.context.portal_type == 'Shipments':
            self.request.set('disable_border', 1)

        self.columns = {
            'ShipmentID': {
                'title': _('Shipment ID'),
                'index': 'sortable_title',
                'toggle': True
            },
            'Project': {
                'title': _('Project'),
                'toggle': True
            },
            'Courier': {
                'title': _('Courier'),
                'toggle': True
            },
            'TrackingURL': {
                'title': _('Tracking URL'),
                'toggle': True
            },
            'ShippingDate': {
                'title': _('Shipping Date'),
                'toggle': True
            },
            'state_title': {
                'title': _('State'),
                'index': 'review_state'
            },
        }

        self.review_states = [
            {
                'id':
                'default',
                'title':
                _('All'),
                'contentFilter': {},
                'transitions': [{
                    'id': 'deactivate'
                }, {
                    'id': 'dispatch_shipment'
                }, {
                    'id': 'receive_shipment'
                }, {
                    'id': 'collect'
                }],
                'columns': [
                    'ShipmentID', 'Project', 'Courier', 'TrackingURL',
                    'ShippingDate', 'state_title'
                ]
            },
            {
                'id':
                'pending',
                'title':
                _('Pending'),
                'contentFilter': {
                    'review_state': 'pending'
                },
                'transitions': [{
                    'id': 'deactivate'
                }, {
                    'id': 'dispatch_shipment'
                }],
                'columns': [
                    'ShipmentID', 'Project', 'Courier', 'TrackingURL',
                    'ShippingDate', 'state_title'
                ]
            },
            {
                'id':
                'dispatched',
                'title':
                _('Dispatched'),
                'contentFilter': {
                    'review_state': 'dispatched'
                },
                'transitions': [{
                    'id': 'deactivate'
                }, {
                    'id': 'receive_shipment'
                }],
                'columns': [
                    'ShipmentID', 'Project', 'Courier', 'TrackingURL',
                    'ShippingDate', 'state_title'
                ]
            },
            {
                'id':
                'received',
                'title':
                _('Received'),
                'contentFilter': {
                    'review_state': 'received'
                },
                'transitions': [{
                    'id': 'deactivate'
                }, {
                    'id': 'collect'
                }],
                'columns': [
                    'ShipmentID', 'Project', 'Courier', 'TrackingURL',
                    'ShippingDate', 'state_title'
                ]
            },
        ]
Esempio n. 42
0
from bika.sanbi.interfaces import IKit, IKitStorage


@indexer(IKit)
def get_kit_project_uid(instance):
    return instance.getProject().UID()


Project = ReferenceField(
    'Project',
    required=1,
    allowed_types=('Project', ),
    relationship='KitProject',
    referenceClass=HoldingReference,
    widget=bika_ReferenceWidget(
        label=_("Project"),
        catalog_name='bika_catalog',
        size=30,
        showOn=True,
        description=_("Click and select project for the kit."),
    ))

KitTemplate = ReferenceField(
    'KitTemplate',
    required=1,
    allowed_types=('KitTemplate', ),
    relationship='KitAssemblyTemplate',
    referenceClass=HoldingReference,
    widget=bika_ReferenceWidget(
        label=_("Kit template"),
        size=30,
Esempio n. 43
0
from bika.lims.browser.widgets import DateTimeWidget
from bika.lims.browser.fields import DateTimeField
from bika.lims.content.bikaschema import BikaSchema
from bika.sanbi import bikaMessageFactory as _
from bika.sanbi.interfaces import IProject
from bika.sanbi import config
from bika.sanbi.browser.widgets import ProjectAnalysesWidget

schema = BikaSchema.copy() + Schema((

    StringField(
        'StudyType',
        searchable=True,
        widget=StringWidget(
            label=_('Type of study'),
            visible={'edit': 'visible', 'view': 'visible'},
        )
    ),

    IntegerField(
        'AgeHigh',
        widget=IntegerWidget(
            label=_("Age High"),
            description=_("Maximum age of the participants."),
            size=10,
            visible={'edit': 'visible', 'view': 'visible'},
        )
    ),

    IntegerField(
Esempio n. 44
0
class BikaSetupSchemaExtender(object):
    adapts(IBikaSetup)
    implements(ISchemaExtender)

    fields = [
        ExtFixedPointField(
            'LevyAmount',
            schemata='Accounting',
            default='0.00',
            widget=DecimalWidget(
                label=_("Levy Amount"),
                description=
                _("The levy percentage the university or parent organisation raises on all invoiced amounts"
                  ),
            )),
        ExtRecordsField(
            'StoragePricing',
            schemata='Storage',
            subfields=('storage_type', 'price', 'storage_type_uid'),
            subfield_hidden={'storage_type_uid': True},
            required_subfields=('storage_type', 'price', 'storage_type_uid'),
            subfield_sizes={
                'storage_type': 50,
                'price': 5
            },
            subfield_labels={
                'storage_type': _('Storage Type'),
                'price': _('Price')
            },
            widget=RecordsWidget(
                label=_("Storage Pricing"),
                description=_(
                    "Set Sample storage pricing depending on storage type."),
                allowDelete=False,
                combogrid_options={
                    'storage_type': {
                        'colModel': [{
                            'columnName': 'storage_type',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '70',
                            'label': _('Description')
                        }, {
                            'columnName': 'storage_type_uid',
                            'hidden': True
                        }],
                        'url':
                        'getstoragetypes',
                        'showOn':
                        True,
                        'width':
                        '550px'
                    },
                },
            )),
    ]

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

    def getFields(self):
        return self.fields
Esempio n. 45
0
from bika.sanbi.interfaces import IKit, IKitStorage


@indexer(IKit)
def get_kit_project_uid(instance):
    return instance.getProject().UID()


Project = ReferenceField(
    'Project',
    required=1,
    allowed_types=('Project',),
    relationship='KitProject',
    referenceClass=HoldingReference,
    widget=bika_ReferenceWidget(
        label=_("Project"),
        catalog_name='bika_catalog',
        size=30,
        showOn=True,
        description=_("Click and select project for the kit."),
    )
)

KitTemplate = ReferenceField(
    'KitTemplate',
    required=1,
    allowed_types=('KitTemplate',),
    relationship='KitAssemblyTemplate',
    referenceClass=HoldingReference,
    widget=bika_ReferenceWidget(
        label=_("Kit template"),
Esempio n. 46
0
 def __init__(self, context, request):
     super(ShipmentMultifileView, self).__init__(context, request)
     self.show_workflow_action_buttons = False
     self.title = self.context.translate(_("Shipment Files"))
     self.description = "Different interesting documents and files to be attached to the shipment"
Esempio n. 47
0
class SampleSchemaExtender(object):
    adapts(ISample)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField('Kit',
                          vocabulary_display_path_bound=sys.maxint,
                          allowed_types=('Kit', ),
                          relationship='SampleKit',
                          referenceClass=HoldingReference,
                          widget=bika_ReferenceWidget(
                              label=_("Kit"),
                              catalog_name='bika_catalog',
                              visible={
                                  'view': 'invisible',
                                  'edit': 'visible',
                                  'header_table': 'visible',
                                  'sample_registered': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_due': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sampled': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_received': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'expired': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'disposed': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                              },
                              render_own_label=True,
                          )),
        ExtReferenceField('StorageLocation',
                          allowed_types=('UnmanagedStorage',
                                         'StoragePosition'),
                          relationship='ItemStorageLocation',
                          widget=bika_ReferenceWidget(
                              label=_("Storage Location"),
                              description=_("Location where item is kept"),
                              size=40,
                              visible={
                                  'edit': 'visible',
                                  'view': 'visible',
                                  'header_table': 'visible',
                                  'sample_registered': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_due': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sampled': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_received': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'expired': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'disposed': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                              },
                              catalog_name='bika_setup_catalog',
                              showOn=True,
                              render_own_label=True,
                              base_query={
                                  'inactive_state':
                                  'active',
                                  'review_state':
                                  'available',
                                  'object_provides':
                                  IBioSpecimenStorage.__identifier__
                              },
                              colModel=[{
                                  'columnName': 'UID',
                                  'hidden': True
                              }, {
                                  'columnName': 'Title',
                                  'width': '50',
                                  'label': _('Title')
                              }, {
                                  "columnName": "Hierarchy",
                                  "align": "left",
                                  "label": "Hierarchy",
                                  "width": "50"
                              }],
                          )),
        ExtStringField(
            'SubjectID',
            searchable=True,
            widget=StringWidget(
                label=_("Subject ID"),
                description=_("Human-subject ID the specimen is taken from."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField('Barcode',
                       searchable=True,
                       widget=StringWidget(
                           label=_("Barcode"),
                           description=_("Biospecimen barcode."),
                           visible={
                               'edit': 'visible',
                               'view': 'visible',
                               'header_table': 'visible',
                               'sample_registered': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_due': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sampled': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_received': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'expired': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'disposed': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                           },
                           render_own_label=True,
                       )),
        ExtFixedPointField(
            'Volume',
            required=1,
            default="0.00",
            widget=DecimalWidget(
                label=_("Volume"),
                size=15,
                description=_(
                    "The The volume of the biospecimen taken from the subject."
                ),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField('Unit',
                       widget=StringWidget(
                           label=_("Unit"),
                           visible={
                               'edit': 'visible',
                               'view': 'visible',
                               'header_table': 'visible',
                               'sample_registered': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'sample_due': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sampled': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_received': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'expired': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'disposed': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                           },
                           render_own_label=True,
                       )),
        ExtReferenceField(
            'LinkedSample',
            vocabulary_display_path_bound=sys.maxsize,
            multiValue=1,
            allowed_types=('Sample', ),
            relationship='SampleSample',
            referenceClass=HoldingReference,
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=ReferenceWidget(
                label=_("Biospecimen"),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            ),
        ),
        ExtDateTimeField(
            'DateCreated',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=DateTimeWidget(
                label=_("Date Created"),
                description=_("Define when the sample has been created."),
                show_time=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'invisible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            ),
        ),
    ]

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

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 48
0
    def __init__(self, context, request):
        super(ShipmentsView, self).__init__(context, request)
        self.context = context
        self.request = request
        self.contentFilter = {"portal_type": "Shipment", "sort_on": "sortable_title"}
        request.set("disable_plone.rightcolumn", 1)
        self.context_actions = {}
        self.catalog = "bika_catalog"
        self.title = self.context.translate(_("Shipments"))
        self.icon = self.portal_url + "/++resource++bika.sanbi.images/shipments_big.png"
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 50

        if self.context.portal_type == "Shipments":
            self.request.set("disable_border", 1)

        self.columns = {
            "ShipmentID": {"title": _("Shipment ID"), "index": "sortable_title", "toggle": True},
            "Project": {"title": _("Project"), "toggle": True},
            "Courier": {"title": _("Courier"), "toggle": True},
            "TrackingURL": {"title": _("Tracking URL"), "toggle": True},
            "ShippingDate": {"title": _("Shipping Date"), "toggle": True},
            "state_title": {"title": _("State"), "index": "review_state"},
        }

        self.review_states = [
            {
                "id": "default",
                "title": _("All"),
                "contentFilter": {},
                "transitions": [
                    {"id": "deactivate"},
                    {"id": "dispatch_shipment"},
                    {"id": "receive_shipment"},
                    {"id": "collect"},
                ],
                "columns": ["ShipmentID", "Project", "Courier", "TrackingURL", "ShippingDate", "state_title"],
            },
            {
                "id": "pending",
                "title": _("Pending"),
                "contentFilter": {"review_state": "pending"},
                "transitions": [{"id": "deactivate"}, {"id": "dispatch_shipment"}],
                "columns": ["ShipmentID", "Project", "Courier", "TrackingURL", "ShippingDate", "state_title"],
            },
            {
                "id": "dispatched",
                "title": _("Dispatched"),
                "contentFilter": {"review_state": "dispatched"},
                "transitions": [{"id": "deactivate"}, {"id": "receive_shipment"}],
                "columns": ["ShipmentID", "Project", "Courier", "TrackingURL", "ShippingDate", "state_title"],
            },
            {
                "id": "received",
                "title": _("Received"),
                "contentFilter": {"review_state": "received"},
                "transitions": [{"id": "deactivate"}, {"id": "collect"}],
                "columns": ["ShipmentID", "Project", "Courier", "TrackingURL", "ShippingDate", "state_title"],
            },
        ]
Esempio n. 49
0
 def __init__(self, context, request):
     super(ShipmentMultifileView, self).__init__(context, request)
     self.show_workflow_action_buttons = False
     self.title = self.context.translate(_("Shipment Files"))
     self.description = "Different interesting documents and files to be attached to the shipment"
Esempio n. 50
0

schema = BikaFolderSchema.copy() + BikaSchema.copy() + Schema((

    ReferenceField(
        'FromContact',
        required=1,
        vocabulary='get_project_client_contacts',
        vocabulary_display_path_bound=sys.maxsize,
        allowed_types=('LabContact',),
        referenceClass=HoldingReference,
        relationship='ShipmentLabContact',
        mode="rw",
        read_permission=permissions.View,
        widget=bika_ReferenceWidget(
            label=_("From Contact"),
            description=_("Laboratory contact sending this shipment."),
            size=30,
            base_query={'inactive_state': 'active'},
            showOn=True,
            popup_width='400px',
            colModel=[{'columnName': 'UID', 'hidden': True},
                      {'columnName': 'Fullname', 'width': '50', 'label': _('Name')},
                      {'columnName': 'EmailAddress', 'width': '50', 'label': _('Email Address')},
                      ],
        ),
    ),
    ReferenceField(
        'ToContact',
        required=1,
        vocabulary='get_project_client_contacts',
Esempio n. 51
0
 def __init__(self, context, request):
     super(StorageUnitInventoryView, self).__init__(context, request)
     self.contentFilter['getUnitID'] = context.getId()
     self.context_actions = {_('Add'):
                             {'url': 'createObject?type_name=StorageInventory',
                              'icon': '++resource++bika.lims.images/add.png'}}
Esempio n. 52
0
    def __init__(self, context, request):
        super(AliquotsView, self).__init__(context, request)
        self.context = context
        self.request = request
        self.catalog = "bika_catalog"
        self.contentFilter = {
            'portal_type': 'Sample',
            'sort_on': 'sortable_title'
        }
        # self.sort_on = 'Title'
        self.context_actions = {}
        self.title = self.context.translate(_("Aliquots"))
        self.icon = self.portal_url + \
                    "/++resource++bika.sanbi.images/aliquot_big.png"
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.pagesize = 50
        request.set('disable_plone.rightcolumn', 1)
        self.allow_edit = True

        if self.context.portal_type == 'Aliquots':
            self.request.set('disable_border', 1)

        self.columns = {
            'Title': {
                'title': _('Aliquot'),
                'index': 'sortable_title'
            },
            'Biospecimen': {
                'title': _('Biospecimen'),
                'toggle': True
            },
            'AliquotType': {
                'title': _('Aliquot Type'),
                'toggle': True
            },
            'Volume': {
                'title': _('Volume'),
                'toggle': True,
                'input_width': '7'
            },
            'Unit': {
                'title': _('Unit'),
                'toggle': True,
                'input_width': '15'
            },
            'Project': {
                'title': _('Project'),
                'index': 'sortable_title'
            },
            'state_title': {
                'title': _('State'),
                'index': 'review_state'
            },
            # 'Location': {'title': _('Location'),
            #              'toggle': True},
        }

        self.review_states = [
            {
                'id': 'default',
                'title': _('Active'),
                'contentFilter': {
                    'cancellation_state': 'active',
                    'sort_order': 'ascending'
                },
                'transitions': [
                    {'id': 'receive'},
                    {'id': 'cancel'}
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id': 'sample_due',
                'title': _('Sample Due'),
                'contentFilter': {
                    'review_state': 'sample_due',
                    'sort_order': 'ascending'
                },
                'transitions': [
                    {'id': 'receive'},
                    {'id': 'cancel'}
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id': 'sample_received',
                'title': _('Received'),
                'contentFilter': {
                    'review_state': 'sample_received'
                },
                'transitions': [
                    {'id': 'cancel'},
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id': 'cancelled',
                'title': _('Cancelled'),
                'contentFilter': {
                    'cancellation_state': 'cancelled'
                },
                'transitions': [
                    {'id': 'reinstate'},
                ],
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    'state_title',
                    # 'Location'
                ]
            },
            {
                'id': 'all',
                'title': _('All'),
                'contentFilter': {},
                'columns': [
                    'Title',
                    'Project',
                    'Biospecimen',
                    'AliquotType',
                    'Volume',
                    'Unit',
                    # 'Location'
                ]
            }
        ]
Esempio n. 53
0
from bika.sanbi.config import PROJECTNAME
from bika.lims.content.bikaschema import BikaSchema
from bika.sanbi.interfaces import IBiospecType
from Products.Archetypes.public import *
from zope.interface import implements
from bika.sanbi.browser.widgets import ProjectAnalysesWidget
from bika.sanbi import bikaMessageFactory as _

schema = BikaSchema.copy() + Schema((
    ReferenceField('Service',
                   required=1,
                   multiValued=1,
                   allowed_types=('AnalysisService',),
                   relationship='BiospecimenAnalysisService',
                   widget=ProjectAnalysesWidget(
                       label=_("Analyse Services"),
                       description=_("Multi-checkboxes table. Use the suitable services for the current "
                                     "biospecimen-type"),
                   )),
))
schema['description'].widget.visible = True
schema['description'].schemata = 'default'


class BiospecType(BaseContent):
    implements(IBiospecType)
    security = ClassSecurityInfo()
    displayContentsTab = False
    schema = schema

    _at_rename_after_creation = True
Esempio n. 54
0
@indexer(IAliquot)
def get_aliquot_project_uid(instance):
    return instance.getBiospecimen().getKit().getProject().UID()

schema = BikaSchema.copy() + Schema((
    ReferenceField(
        'Biospecimen',
        required=1,
        allowed_types=('Biospecimen',),
        relationship='BiospecimenAliquot',
        vocabulary_display_path_bound=sys.maxsize,
        referenceClass=HoldingReference,
        widget=bika_ReferenceWidget(
           checkbox_bound=0,
           label=_("Biospecimen"),
           description=_("The biospecimen the aliquot is extracted from."),
           size=40,
           catalog_name='bika_setup_catalog',
           showOn=True,
           visible={'edit': 'visible', 'view': 'visible'},
        )
    ),

    FixedPointField(
        'Volume',
        required=1,
        default="0.00",
        widget=DecimalWidget(
            label=_("Volume"),
            size=15,