def __init__(self, context, request): BikaListingView.__init__(self, context, request) self.show_sort_column = False self.show_select_row = False self.show_select_column = False self.show_workflow_action_buttons = False self.pagesize = 999999 self.icon = self.portal_url + "/++resource++bika.lims.images/%s_big.png" % \ context.portal_type.lower() self.title = to_utf8(self.context.Title()) + " " + t(_("Log")) self.description = "" self.columns = { 'Version': {'title': _('Version'), 'sortable': False}, 'Date': {'title': _('Date'), 'sortable': False}, 'User': {'title': _('User'), 'sortable': False}, 'Action': {'title': _('Action'), 'sortable': False}, 'Description': {'title': _('Description'), 'sortable': False}, } self.review_states = [ {'id': 'default', 'title': 'All', 'contentFilter': {}, 'columns': ['Version', 'Date', 'User', 'Action', 'Description']}, ]
def __init__(self, context, request, field): BikaListingView.__init__(self, context, request) self.selected = [o.UID() for o in getattr(field, field.accessor)()] self.context_actions = {} self.catalog = "bika_setup_catalog" self.contentFilter = {'review_state': 'impossible_state'} self.base_url = self.context.absolute_url() self.view_url = self.base_url self.show_categories = True self.show_sort_column = False self.show_select_row = False self.show_select_all_checkbox = False self.show_select_column = True self.pagesize = 999999 self.form_id = 'serviceswidget' self.columns = { 'Service': {'title': _('Service')}, 'Keyword': {'title': _('Keyword'), 'index': 'getKeyword'}, 'Method': {'title': _('Method')}, 'Calculation': {'title': _('Calculation')}, } self.review_states = [ {'id':'default', 'title': _('All'), 'contentFilter':{}, 'transitions': [], 'columns':['Service', 'Keyword', 'Method', 'Calculation', ] }, ]
def folderitems(self): mtool = getToolByName(self.context, 'portal_membership') if mtool.checkPermission(ManageBika, self.context): del self.review_states[0]['transitions'] self.show_select_column = True self.review_states.append( {'id':'active', 'title': _('Active'), 'contentFilter': {'inactive_state': 'active'}, 'transitions': [{'id':'deactivate'}, ], 'columns': ['Title', 'Description']}) self.review_states.append( {'id':'inactive', 'title': _('Dormant'), 'contentFilter': {'inactive_state': 'inactive'}, 'transitions': [{'id':'activate'}, ], 'columns': ['Title', 'Description']}) items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] itype = obj.getInstrumentType() items[x]['Type'] = itype.Title() if itype else '' ibrand = obj.getManufacturer() items[x]['Brand'] = ibrand.Title() if ibrand else '' items[x]['Model'] = obj.getModel() data = obj.getCertificateExpireDate() if data == '': items[x]['ExpiryDate'] = "No date avaliable" else: items[x]['ExpiryDate'] = data.asdatetime().strftime(self.date_format_short) if obj.isOutOfDate(): items[x]['WeeksToExpire'] = "Out of date" else: date = int(str(obj.getWeeksToExpire()).split(',')[0].split(' ')[0]) weeks,days = divmod(date,7) items[x]['WeeksToExpire'] = str(weeks)+" weeks"+" "+str(days)+" days" if obj.getMethod(): items[x]['Method'] = obj.getMethod().Title() items[x]['replace']['Method'] = "<a href='%s'>%s</a>" % \ (obj.getMethod().absolute_url(), items[x]['Method']) else: items[x]['Method'] = '' items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) return items
def __call__(self): ar = self.context workflow = getToolByName(ar, 'portal_workflow') # If is a retracted AR, show the link to child AR and show a warn msg if workflow.getInfoFor(ar, 'review_state') == 'invalid': childar = hasattr(ar, 'getChildAnalysisRequest') \ and ar.getChildAnalysisRequest() or None childid = childar and childar.getRequestID() or None message = _('This Analysis Request has been withdrawn and is ' 'shown for trace-ability purposes only. Retest: ' '${retest_child_id}.', mapping={'retest_child_id': safe_unicode(childid) or ''}) self.context.plone_utils.addPortalMessage( self.context.translate(message), 'warning') # If is an AR automatically generated due to a Retraction, show it's # parent AR information if hasattr(ar, 'getParentAnalysisRequest') \ and ar.getParentAnalysisRequest(): par = ar.getParentAnalysisRequest() message = _('This Analysis Request has been ' 'generated automatically due to ' 'the retraction of the Analysis ' 'Request ${retracted_request_id}.', mapping={'retracted_request_id': par.getRequestID()}) self.context.plone_utils.addPortalMessage( self.context.translate(message), 'info') template = BikaListingView.__call__(self) return template
def __call__(self): ar = self.context workflow = getToolByName(ar, 'portal_workflow') # If is a retracted AR, show the link to child AR and show a warn msg if workflow.getInfoFor(ar, 'review_state') == 'invalid': childar = hasattr(ar, 'getChildAnalysisRequest') \ and ar.getChildAnalysisRequest() or None childid = childar and childar.getRequestID() or None message = _( 'This Analysis Request has been withdrawn and is ' 'shown for trace-ability purposes only. Retest: ' '${retest_child_id}.', mapping={'retest_child_id': safe_unicode(childid) or ''}) self.context.plone_utils.addPortalMessage( self.context.translate(message), 'warning') # If is an AR automatically generated due to a Retraction, show it's # parent AR information if hasattr(ar, 'getParentAnalysisRequest') \ and ar.getParentAnalysisRequest(): par = ar.getParentAnalysisRequest() message = _( 'This Analysis Request has been ' 'generated automatically due to ' 'the retraction of the Analysis ' 'Request ${retracted_request_id}.', mapping={'retracted_request_id': par.getRequestID()}) self.context.plone_utils.addPortalMessage( self.context.translate(message), 'info') template = BikaListingView.__call__(self) return template
def folderitems(self): self.filter_indexes = None items = BikaListingView.folderitems(self) for x in range(len(items)): if 'obj' not in items[x]: continue obj = items[x]['obj'] bid = obj.getBatchID() items[x]['BatchID'] = bid items[x]['replace']['BatchID'] = "<a href='%s/%s'>%s</a>" % ( items[x]['url'], 'analysisrequests', bid) title = obj.Title() items[x]['Title'] = title items[x]['replace']['Title'] = "<a href='%s/%s'>%s</a>" % ( items[x]['url'], 'analysisrequests', title) date = obj.Schema().getField('BatchDate').get(obj) if callable(date): date = date() items[x]['BatchDate'] = date items[x]['replace']['BatchDate'] = self.ulocalized_time(date) return items
def folderitems(self): mtool = getToolByName(self.context, "portal_membership") if mtool.checkPermission(ManageBika, self.context): del self.review_states[0]["transitions"] self.show_select_column = True self.review_states.append( { "id": "active", "title": _("Active"), "contentFilter": {"inactive_state": "active"}, "transitions": [{"id": "deactivate"}], "columns": ["Title", "Description"], } ) self.review_states.append( { "id": "inactive", "title": _("Dormant"), "contentFilter": {"inactive_state": "inactive"}, "transitions": [{"id": "activate"}], "columns": ["Title", "Description"], } ) items = BikaListingView.folderitems(self) for x in range(len(items)): if "obj" in items[x]: items[x]["replace"]["Title"] = "<a href='%s'>%s</a>" % (items[x]["url"], items[x]["Title"]) return items
def folderitems(self): items = BikaListingView.folderitems(self) props = self.context.portal_properties.site_properties for x in range(len(items)): if 'obj' not in items[x]: continue obj = items[x]['obj'] obj_url = obj.absolute_url() file = obj.getReportFile() icon = file.getBestIcon() items[x]['Client'] = '' client = obj.getClient() if client: items[x]['replace']['Client'] = "<a href='%s'>%s</a>" % \ (client.absolute_url(), client.Title()) items[x]['FileSize'] = '%sKb' % (file.get_size() / 1024) items[x]['Created'] = self.ulocalized_time(obj.created()) items[x]['By'] = self.user_fullname(obj.Creator()) items[x]['replace']['Title'] = \ "<a href='%s/at_download/ReportFile'>%s</a>" % \ (obj_url, items[x]['Title']) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue items[x]['replace']['title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['title']) return items
def folderitems(self): items = BikaListingView.folderitems(self) for item in items: if not item.has_key('obj'): continue obj = item['obj'] title_link = "<a href='%s'>%s</a>" % (item['url'], item['title']) item['replace']['Title'] = title_link return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue items[x]['replace']['getFullname'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['obj'].getFullname()) return items
def __init__(self, context, request): BikaListingView.__init__(self, context, request) self.show_sort_column = False self.show_select_row = False self.show_select_column = False self.show_workflow_action_buttons = False self.pagesize = 999999 self.icon = self.portal_url + "/++resource++bika.lims.images/%s_big.png" % \ context.portal_type.lower() self.title = to_utf8(self.context.Title()) + " " + t(_("Log")) self.description = "" self.columns = { 'Version': { 'title': _('Version'), 'sortable': False }, 'Date': { 'title': _('Date'), 'sortable': False }, 'User': { 'title': _('User'), 'sortable': False }, 'Action': { 'title': _('Action'), 'sortable': False }, 'Description': { 'title': _('Description'), 'sortable': False }, } self.review_states = [ { 'id': 'default', 'title': 'All', 'contentFilter': {}, 'columns': ['Version', 'Date', 'User', 'Action', 'Description'] }, ]
def __init__(self, context, request, field): BikaListingView.__init__(self, context, request) self.selected = [o.UID() for o in getattr(field, field.accessor)()] self.context_actions = {} self.catalog = "bika_setup_catalog" self.contentFilter = {'review_state': 'impossible_state'} self.base_url = self.context.absolute_url() self.view_url = self.base_url self.show_categories = True self.show_sort_column = False self.show_select_row = False self.show_select_all_checkbox = False self.show_select_column = True self.pagesize = 999999 self.form_id = 'serviceswidget' self.columns = { 'Service': { 'title': _('Service') }, 'Keyword': { 'title': _('Keyword'), 'index': 'getKeyword' }, 'Method': { 'title': _('Method') }, 'Calculation': { 'title': _('Calculation') }, } self.review_states = [ { 'id': 'default', 'title': _('All'), 'contentFilter': {}, 'transitions': [], 'columns': [ 'Service', 'Keyword', 'Method', 'Calculation', ] }, ]
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Description'] = obj.Description() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) return items
def folderitems(self): items = BikaListingView.folderitems(self) valid = [c.UID() for c in self.context.getValidCertifications()] latest = self.context.getLatestValidCertification() latest = latest.UID() if latest else '' for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] # items[x]['getAgency'] = obj.getAgency() items[x]['getDate'] = self.ulocalized_time(obj.getDate(), long_format=0) items[x]['getValidFrom'] = self.ulocalized_time(obj.getValidFrom(), long_format=0) items[x]['getValidTo'] = self.ulocalized_time(obj.getValidTo(), long_format=0) items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) if obj.getInternal() == True: items[x]['replace']['getAgency'] = "" items[x]['state_class'] = '%s %s' % (items[x]['state_class'], 'internalcertificate') items[x]['getDocument'] = "" items[x]['replace']['getDocument'] = "" try: doc = obj.getDocument() if doc and doc.get_size() > 0: anchor = "<a href='%s/at_download/Document'>%s</a>" % \ (obj.absolute_url(), doc.filename) items[x]['getDocument'] = doc.filename items[x]['replace']['getDocument'] = anchor except: # POSKeyError: 'No blob file' # Show the record, but not the link title = _('Not available') items[x]['getDocument'] = _('Not available') items[x]['replace']['getDocument'] = _('Not available') uid = obj.UID() if uid in valid: # Valid calibration. items[x]['state_class'] = '%s %s' % (items[x]['state_class'], 'active') elif uid == latest: # Latest valid certificate img = "<img title='%s' src='%s/++resource++bika.lims.images/exclamation.png'/> " \ % (t(_('Out of date')), self.portal_url) items[x]['replace']['getValidTo'] = '%s %s' % ( items[x]['getValidTo'], img) items[x]['state_class'] = '%s %s' % (items[x]['state_class'], 'inactive outofdate') else: # Old and further calibrations items[x]['state_class'] = '%s %s' % (items[x]['state_class'], 'inactive') return items
def __init__(self, context, request, **kwargs): BikaListingView.__init__(self, context, request, **kwargs) self.form_id = "instrumentcertifications" self.columns = { 'Title': { 'title': _('Cert. Num'), 'index': 'sortable_title' }, 'getAgency': { 'title': _('Agency') }, 'getDate': { 'title': _('Date') }, 'getValidFrom': { 'title': _('Valid from') }, 'getValidTo': { 'title': _('Valid to') }, 'getDocument': { 'title': _('Document') }, } self.review_states = [ { 'id': 'default', 'title': _('All'), 'contentFilter': {}, 'columns': [ 'Title', 'getAgency', 'getDate', 'getValidFrom', 'getValidTo', 'getDocument' ], 'transitions': [{}] }, ] self.allow_edit = False self.show_select_column = False self.show_workflow_action_buttons = False uids = [c.UID() for c in self.context.getCertifications()] self.catalog = 'portal_catalog' self.contentFilter = {'UID': uids, 'sort_on': 'sortable_title'}
def isItemAllowed(self, obj): # Only show "my" worksheets # this cannot be setup in contentFilter, # because AuthenticatedMember is not available in __init__ if self.selected_state == 'mine' or self.restrict_results == True: analyst = obj.getAnalyst().strip() if analyst != _c(self.member.getId()): return False return BikaListingView.isItemAllowed(self, obj)
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if 'obj' not in items[x]: continue items[x]['replace']['title'] = \ "<a href='%s'>%s</a>" % (items[x]['url'], items[x]['title']) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Title'] = obj.Title() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['title']) items[x]['ProfileKey'] = obj.getProfileKey() return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Description'] = obj.Description() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) if obj.getRetentionPeriod(): items[x]['RetentionPeriod'] = "hours: " + str( obj.getRetentionPeriod()['hours']) + " minutes: " + str( obj.getRetentionPeriod()['minutes']) + " days: " + str( obj.getRetentionPeriod()['days']) else: items[x]['RetentionPeriod'] = '' if obj.getSampleMatrix(): items[x]['SampleMatrix'] = obj.getSampleMatrix().Title() items[x]['replace']['SampleMatrix'] = "<a href='%s'>%s</a>" % \ (obj.getSampleMatrix().absolute_url(), items[x]['SampleMatrix']) else: items[x]['SampleMatrix'] = '' if obj.getContainerType(): items[x]['ContainerType'] = obj.getContainerType().Title() items[x]['replace'][ 'ContainerType'] = "<a href='%s'>%s</a>" % ( obj.getContainerType().absolute_url(), items[x]['ContainerType']) else: items[x]['ContainerType'] = '' if obj.getSamplePoints(): if len(obj.getSamplePoints()) > 1: SPLine = str() urlStr = str() for token in obj.getSamplePoints(): SPLine += token.Title() + ", " urlStr += "<a href='%s'>%s</a>" % ( token.absolute_url(), token.Title()) items[x]['replace']['getSamplePoints'] = urlStr else: items[x]['getSamplePoints'] = obj.getSamplePoints( )[0].Title() items[x]['replace']['getSamplePoints'] = "<a href='%s'>%s</a>" % \ (obj.getSamplePoints()[0].absolute_url(), items[x]['getSamplePoints']) else: items[x]['getSamplePoints'] = '' return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Title'] = obj.Title() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) items[x]['SampleType'] = obj.getSampleType().Title() \ if obj.getSampleType() else "" return items
def folderitems(self): items = BikaListingView.folderitems(self) items.sort(key=itemgetter('OrderDate'), reverse=True) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['OrderNumber'] = obj.getOrderNumber() items[x]['OrderDate'] = self.ulocalized_time(obj.getOrderDate()) items[x]['DateDispatched'] = self.ulocalized_time(obj.getDateDispatched()) items[x]['replace']['OrderNumber'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['OrderNumber']) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if 'obj' not in items[x]: continue items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) items[x]['getEffectiveDate'] = self.ulocalized_time(items[x]['obj'].getEffectiveDate()) items[x]['getExpirationDate'] = self.ulocalized_time(items[x]['obj'].getExpirationDate()) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Title'] = obj.Title() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) st = obj.getSampleType() items[x]['SampleType'] = obj.getSampleType().Title() \ if obj.getSampleType() else "" return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) items[x]['Description'] = obj.Description() if obj.aq_parent.portal_type == 'Client': items[x]['Owner'] = obj.aq_parent.Title() else: items[x]['Owner'] = self.context.bika_setup.laboratory.Title() return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Name'] = obj.getName() items[x]['Email'] = obj.getEmailAddress() items[x]['Phone'] = obj.getPhone() items[x]['Fax'] = obj.getFax() items[x]['replace']['Name'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Name']) return items
def __init__(self, context, request, fieldvalue, allow_edit): BikaListingView.__init__(self, context, request) self.context_actions = {} self.contentFilter = {'review_state' : 'impossible_state'} 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_select_column = False self.pagesize = 999999 self.allow_edit = allow_edit self.show_categories = True # self.expand_all_categories = False self.specsresults = {} for specresults in fieldvalue: self.specsresults[specresults['keyword']] = specresults self.columns = { 'service': {'title': _('Service'), 'index': 'sortable_title', 'sortable': False}, 'min': {'title': _('Min'), 'sortable': False,}, 'max': {'title': _('Max'), 'sortable': False,}, 'error': {'title': _('Permitted Error %'), 'sortable': False}, 'hidemin': {'title': _('< Min'), 'sortable': False}, 'hidemax': {'title': _('> Max'), 'sortable': False}, 'rangecomment': {'title': _('Range comment'), 'sortable': False, 'toggle': False} } self.review_states = [ {'id':'default', 'title': _('All'), 'contentFilter':{}, 'transitions': [], 'columns': ['service', 'min', 'max', 'error', 'hidemin', 'hidemax', 'rangecomment'], }, ]
def folderitems(self): self.contentsMethod = self.getInvoiceBatches items = BikaListingView.folderitems(self) for x, item in enumerate(items): if 'obj' not in item: continue obj = item['obj'] title_link = "<a href='%s'>%s</a>" % (item['url'], item['title']) items[x]['replace']['title'] = title_link items[x]['start'] = self.ulocalized_time(obj.getBatchStartDate()) items[x]['end'] = self.ulocalized_time(obj.getBatchEndDate()) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['replace']['title'] = \ "<a href='%s'>%s</a>" % (items[x]['url'], items[x]['title']) items[x]['replace']['getClientTitle'] = \ "<a href='%s'>%s</a>" % ( obj.aq_parent.absolute_url(), obj.aq_parent.Title()) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Volume'] = obj.getVolume() items[x]['Unit'] = obj.getUnit() items[x]['Price'] = obj.getPrice() items[x]['VATAmount'] = obj.getVATAmount() items[x]['TotalPrice'] = obj.getTotalPrice() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Fullname'] = obj.getFullname() items[x]['Department'] = obj.getDepartmentTitle() items[x]['BusinessPhone'] = obj.getBusinessPhone() items[x]['Fax'] = obj.getBusinessFax() items[x]['MobilePhone'] = obj.getMobilePhone() items[x]['EmailAddress'] = obj.getEmailAddress() items[x]['replace']['Fullname'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Fullname']) return items
def folderitems(self, full_objects=False): currency = currency_format(self.context, 'en') self.show_all = True self.contentsMethod = self.getInvoices items = BikaListingView.folderitems(self, full_objects) for item in items: obj = item['obj'] number_link = "<a href='%s'>%s</a>" % (item['url'], obj.getId()) item['replace']['id'] = number_link item['client'] = obj.getClient().Title() item['invoicedate'] = self.ulocalized_time(obj.getInvoiceDate()) item['subtotal'] = currency(obj.getSubtotal()) item['vatamount'] = currency(obj.getVATAmount()) item['total'] = currency(obj.getTotal()) return items
def __init__(self, context, request, fieldvalue, allow_edit): BikaListingView.__init__(self, context, request) self.context_actions = {} self.contentFilter = {'review_state': 'impossible_state'} 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_select_column = False self.pagesize = 999999 self.allow_edit = allow_edit self.show_categories = True # self.expand_all_categories = False self.referenceresults = {} # we want current field value as a dict # key:uid, value:{dictionary from field list of dict} for refres in fieldvalue: self.referenceresults[refres['uid']] = refres self.columns = { 'service': {'title': _('Service')}, 'result': {'title': _('Expected Result')}, 'error': {'title': _('Permitted Error %')}, 'min': {'title': _('Min')}, 'max': {'title': _('Max')} } self.review_states = [ {'id': 'default', 'title': _('All'), 'contentFilter': {}, 'transitions': [], 'columns': ['service', 'result', 'error', 'min', 'max'], }, ]
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Description'] = obj.Description() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) if obj.getRetentionPeriod(): items[x]['RetentionPeriod'] = "hours: " + str(obj.getRetentionPeriod()['hours']) + " minutes: " + str(obj.getRetentionPeriod()['minutes']) + " days: " + str(obj.getRetentionPeriod()['days']) else: items[x]['RetentionPeriod'] = '' if obj.getSampleMatrix(): items[x]['SampleMatrix'] = obj.getSampleMatrix().Title() items[x]['replace']['SampleMatrix'] = "<a href='%s'>%s</a>" % \ (obj.getSampleMatrix().absolute_url(), items[x]['SampleMatrix']) else: items[x]['SampleMatrix'] = '' if obj.getContainerType(): items[x]['ContainerType'] = obj.getContainerType().Title() items[x]['replace']['ContainerType'] = "<a href='%s'>%s</a>" %(obj.getContainerType().absolute_url(), items[x]['ContainerType']) else: items[x]['ContainerType'] = '' if obj.getSamplePoints(): if len(obj.getSamplePoints()) > 1: SPLine = str() urlStr = str() for token in obj.getSamplePoints(): SPLine += token.Title() + ", " urlStr += "<a href='%s'>%s</a>" % (token.absolute_url(),token.Title()) items[x]['replace']['getSamplePoints'] = urlStr else: items[x]['getSamplePoints'] = obj.getSamplePoints()[0].Title() items[x]['replace']['getSamplePoints'] = "<a href='%s'>%s</a>" % \ (obj.getSamplePoints()[0].absolute_url(), items[x]['getSamplePoints']) else: items[x]['getSamplePoints'] = '' return items
def folderitems(self): items = BikaListingView.folderitems(self) outitems = [] toshow = [] for val in self.context.getValidations(): toshow.append(val.UID()) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] if obj.UID() in toshow: items[x]['getDownFrom'] = obj.getDownFrom() items[x]['getDownTo'] = obj.getDownTo() items[x]['getValidator'] = obj.getValidator() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) outitems.append(items[x]) return outitems
def folderitems(self, full_objects=False): currency = currency_format(self.context, 'en') self.show_all = True self.contentsMethod = self.getInvoices items = BikaListingView.folderitems(self, full_objects) for item in items: obj = item['obj'] number_link = "<a href='%s'>%s</a>" % ( item['url'], obj.getId() ) item['replace']['id'] = number_link item['client'] = obj.getClient().Title() item['invoicedate'] = self.ulocalized_time(obj.getInvoiceDate()) item['subtotal'] = currency(obj.getSubtotal()) item['vatamount'] = currency(obj.getVATAmount()) item['total'] = currency(obj.getTotal()) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Description'] = obj.Description() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) after_icons = '' if obj.getBlank(): after_icons += "<img src='++resource++bika.lims.images/blank.png' title='Blank'>" if obj.getHazardous(): after_icons += "<img src='++resource++bika.lims.images/hazardous.png' title='Hazardous'>" items[x]['replace']['Title'] = "<a href='%s'>%s</a> %s" % \ (items[x]['url'], items[x]['Title'], after_icons) return items
def folderitems(self): items = BikaListingView.folderitems(self) outitems = [] workflow = getToolByName(self.context, 'portal_workflow') for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] if workflow.getInfoFor(obj, 'review_state') == 'current': # Check expiry date from dependencies.dependency import DT2dt from dependencies.dependency import datetime expirydate = DT2dt(obj.getExpiryDate()).replace(tzinfo=None) if (datetime.today() > expirydate): workflow.doActionFor(obj, 'expire') items[x]['review_state'] = 'expired' items[x]['obj'] = obj if 'review_state' in self.contentFilter \ and self.contentFilter['review_state'] == 'current': continue items[x]['ID'] = obj.id items[x]['Manufacturer'] = obj.getReferenceManufacturer() and \ obj.getReferenceManufacturer().Title() or '' items[x]['Definition'] = obj.getReferenceDefinition() and \ obj.getReferenceDefinition().Title() or '' items[x]['DateSampled'] = self.ulocalized_time( obj.getDateSampled()) items[x]['DateReceived'] = self.ulocalized_time( obj.getDateReceived()) items[x]['DateOpened'] = self.ulocalized_time(obj.getDateOpened()) items[x]['ExpiryDate'] = self.ulocalized_time(obj.getExpiryDate()) after_icons = '' if obj.getBlank(): after_icons += "<img\ src='%s/++resource++bika.lims.images/blank.png' \ title='%s'>" % (self.portal_url, t(_('Blank'))) if obj.getHazardous(): after_icons += "<img\ src='%s/++resource++bika.lims.images/hazardous.png' \ title='%s'>" % (self.portal_url, t(_('Hazardous'))) items[x]['replace']['ID'] = "<a href='%s/base_view'>%s</a> %s" % \ (items[x]['url'], items[x]['ID'], after_icons) outitems.append(items[x]) return outitems
def folderitems(self): items = BikaListingView.folderitems(self) outitems = [] toshow = [] for sch in self.context.getSchedule(): toshow.append(sch.UID()) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] if obj.UID() in toshow: items[x]['created'] = self.ulocalized_time(obj.created()) items[x]['creator'] = obj.Creator() items[x]['getType'] = safe_unicode(_( obj.getType()[0])).encode('utf-8') items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) outitems.append(items[x]) return outitems
def folderitems(self): items = BikaListingView.folderitems(self) outitems = [] workflow = getToolByName(self.context, 'portal_workflow') for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] if workflow.getInfoFor(obj, 'review_state') == 'current': # Check expiry date from dependencies.dependency import DT2dt from dependencies.dependency import datetime expirydate = DT2dt(obj.getExpiryDate()).replace(tzinfo=None) if (datetime.today() > expirydate): workflow.doActionFor(obj, 'expire') items[x]['review_state'] = 'expired' items[x]['obj'] = obj if 'review_state' in self.contentFilter \ and self.contentFilter['review_state'] == 'current': continue items[x]['ID'] = obj.id items[x]['Manufacturer'] = obj.getReferenceManufacturer() and \ obj.getReferenceManufacturer().Title() or '' items[x]['Definition'] = obj.getReferenceDefinition() and \ obj.getReferenceDefinition().Title() or '' items[x]['DateSampled'] = self.ulocalized_time(obj.getDateSampled()) items[x]['DateReceived'] = self.ulocalized_time(obj.getDateReceived()) items[x]['DateOpened'] = self.ulocalized_time(obj.getDateOpened()) items[x]['ExpiryDate'] = self.ulocalized_time(obj.getExpiryDate()) after_icons = '' if obj.getBlank(): after_icons += "<img\ src='%s/++resource++bika.lims.images/blank.png' \ title='%s'>" % (self.portal_url, t(_('Blank'))) if obj.getHazardous(): after_icons += "<img\ src='%s/++resource++bika.lims.images/hazardous.png' \ title='%s'>" % (self.portal_url, t(_('Hazardous'))) items[x]['replace']['ID'] = "<a href='%s/base_view'>%s</a> %s" % \ (items[x]['url'], items[x]['ID'], after_icons) outitems.append(items[x]) return outitems
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Description'] = obj.Description() items[x]['ContainerType'] = obj.getContainerType() and obj.getContainerType().Title() or '' items[x]['Capacity'] = obj.getCapacity() and "%s" % \ (obj.getCapacity()) or '' pre = obj.getPrePreserved() pres = obj.getPreservation() items[x]['Pre-preserved'] = '' items[x]['after']['Pre-preserved'] = pre \ and "<a href='%s'>%s</a>" % (pres.absolute_url(), pres.Title()) \ or '' items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) return items
def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Description'] = obj.Description() items[x]['Manager'] = obj.getManagerName() items[x]['ManagerPhone'] = obj.getManagerPhone() items[x]['ManagerEmail'] = obj.getManagerEmail() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) if items[x]['ManagerEmail']: items[x]['replace']['ManagerEmail'] = "<a href='%s'>%s</a>"%\ ('mailto:%s' % items[x]['ManagerEmail'], items[x]['ManagerEmail']) return items