def get_item_status(item_id): """Method connects to ILS and retrieves the current circulation status of a an item. :param item_id: Item id, required :rtype: String of status """ item_bot = ItemBot(opac_url=ils_settings.OPAC_URL,item_id=item_id) item_status = item_bot.status() if item_status is None: css_class = '' elif item_status.startswith('Due'): css_class = 'due-back' else: css_class = 'available' status_txt = '''<span class="%s">%s ''' % (css_class,item_status) volume = item_bot.volume() if volume is not None: status_txt += item_bot.volume() status_txt += '</span>' location = item_bot.location() if location is not None: if not location.startswith('Online'): status_txt += ' located in %s' % location call_number = item_bot.callnumber() if call_number is not None: status_txt += ' with call number <b>%s</b>' % call_number return mark_safe(status_txt)
def get_item_tds(item_id): """ Method conntect to ILS to retrieve item information and generates an html table cells with the information. :param item_id: Item id :rtype: HTML string """ item_bot = ItemBot(opac_url=ils_settings.OPAC_URL,item_id=item_id) output_html = "<td>{0}</td><td>{1}</td><td>{2}</td>".format(item_bot.status(), item_bot.location(), item_bot.callnumber()) return mark_safe(output_html)
def get_item_status(item_id): """Method connects to ILS and retrieves the current circulation status of a an item. """ item_bot = ItemBot(opac_url=ils_settings.OPAC_URL,item_id=item_id) item_status = item_bot.status() if item_status is None: css_class = '' elif item_status.startswith('Due'): css_class = 'due-back' else: css_class = 'available' status_txt = '''<span class="%s">%s ''' % (css_class,item_status) volume = item_bot.volume() if volume: status_txt += item_bot.volume() status_txt += '</span>' location = item_bot.location() if location is not None: if not location.startswith('Online'): status_txt += ' located at %s' % location return mark_safe(status_txt)