@memoize(timeout=CACHE_TIME)
def _item_status(bib_id):
+
if bib_id:
try:
counts = E1('open-ils.search.biblio.copy_counts.location.summary.retrieve',
bib_id, 1, 0)
lib = desk = avail = 0
+ dueinfo = ''
+ callno = ''
for org, callnum, loc, stats in counts:
+ if len(callno) == 0:
+ callno = callnum
avail_here = stats.get(AVAILABLE, 0)
anystatus_here = sum(stats.values())
if loc == RESERVES_DESK_NAME:
desk += anystatus_here
avail += avail_here
lib += anystatus_here
- return (lib, desk, avail)
- except:
+ copyids = E1('open-ils.search.asset.copy.retrieve_by_cn_label',
+ bib_id, callnum, org)
+
+ """
+ we will need to determine the first available copy, will look
+ at date/time logic for this
+ """
+ for copyid in copyids:
+ circinfo = E1('open-ils.search.asset.copy.fleshed2.retrieve', copyid)
+ circs = circinfo.get("circulations")
+ if circs:
+ # just grab the first for now, not much point iterating
+ #until compare is done
+
+ if len(circs) > 0:
+ circ = circs[0]
+ dueinfo = circ.get("due_date")
+ callno = callnum
+ return (lib, desk, avail, callno, dueinfo)
+ except:
+ print "problem: ", bib_id
pass # fail silently if there's an opensrf related error.
return None
if not stat:
return (False, 'Status information not available.')
else:
- lib, desk, avail = stat
+ lib, desk, avail, callno, dueinfo = stat
return (avail > 0,
'%d of %d copies available at reserves desk; '
'%d total copies in library system'
- % (avail, desk, lib))
+ % (avail, desk, lib, callno, dueinfo))
_video_type_re = re.compile(r'tag="007">v(.)')
_video_types = {'c':'videocartridge',
return dct['090a']
cn = ('%s %s' % (dct.get('050a', ''),
dct.get('050b', ''))).strip()
+ if len(cn) < 2:
+ cn = ('%s %s' % (dct.get('092a', ''),
+ dct.get('092b', ''))).strip()
return cn
except:
return None
?>
<div class="availability" py:if="item.item_type == 'PHYS'">
<a href="${item.item_url()}">
- <div py:if="valid" py:with="(_lib, _desk, _avail) = stat"
+ <div py:if="valid" py:with="(_lib, _desk, _avail, _callno, _dueinfo) = stat"
class="${_avail > 0 and 'available' or 'unavailable'}"
title="${_avail} of ${_desk} copies available at reserves desk; ${_lib} total copies in library system">
- <div>${_avail and 'Available' or 'Unavailable'} (${_avail}/${_desk})</div>
+ <div>${_avail and 'Available' or 'Unavailable'} (${_avail}/${_desk})</div>
+ <div py:if="_dueinfo">${_dueinfo} (will reformat this)</div>
+ <!--
<div class="callnumber">${item.call_number()}</div>
+ -->
+ <div class="callnumber">${_callno}</div>
</div>
</a>
<div py:if="not valid" title="No copies are available at the reserves desk. No further status information is available.">
</div>
<div id="footer">
<div>
- Syrup is a subproject of <a href="http://projectconifer.ca">Project Conifer</a> © 2010
+ Syrup is a subproject of <a href="http://projectconifer.ca">Project Conifer</a> © 2011
</div>
</div>
</div>