From: artunit Date: Fri, 7 Jan 2011 05:22:11 +0000 (+0000) Subject: added hook for due time info with checked out items X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9e9b393c630868ae72f8cb84a97e270a360675bb;p=Syrup.git added hook for due time info with checked out items git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1166 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/integration/uwindsor.py b/conifer/integration/uwindsor.py index 9a87e62..ef3eeee 100644 --- a/conifer/integration/uwindsor.py +++ b/conifer/integration/uwindsor.py @@ -88,20 +88,44 @@ CACHE_TIME = 300 @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 diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py index cc45f6e..f84d47f 100644 --- a/conifer/syrup/models.py +++ b/conifer/syrup/models.py @@ -748,11 +748,11 @@ class Item(BaseModel): 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', @@ -777,6 +777,9 @@ class Item(BaseModel): 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 diff --git a/conifer/templates/components/site.xhtml b/conifer/templates/components/site.xhtml index 1481f50..f944d42 100644 --- a/conifer/templates/components/site.xhtml +++ b/conifer/templates/components/site.xhtml @@ -39,11 +39,15 @@ searchtext = _('search this site...') ?>
-
-
${_avail and 'Available' or 'Unavailable'} (${_avail}/${_desk})
+
${_avail and 'Available' or 'Unavailable'} (${_avail}/${_desk})
+
${_dueinfo} (will reformat this)
+ +
${_callno}
diff --git a/conifer/templates/master.xhtml b/conifer/templates/master.xhtml index b44de1b..81338f1 100644 --- a/conifer/templates/master.xhtml +++ b/conifer/templates/master.xhtml @@ -72,7 +72,7 @@ from django.conf import settings