[open-ils-commits] r1201 - in servres/trunk/conifer: integration templates/components templates/item (artunit)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jan 17 21:25:44 EST 2011
Author: artunit
Date: 2011-01-17 21:25:43 -0500 (Mon, 17 Jan 2011)
New Revision: 1201
Modified:
servres/trunk/conifer/integration/uwindsor.py
servres/trunk/conifer/templates/components/site.xhtml
servres/trunk/conifer/templates/item/item_metadata.xhtml
Log:
first draft of handling multi-volume sets, sync status info in full display
Modified: servres/trunk/conifer/integration/uwindsor.py
===================================================================
--- servres/trunk/conifer/integration/uwindsor.py 2011-01-17 15:43:50 UTC (rev 1200)
+++ servres/trunk/conifer/integration/uwindsor.py 2011-01-18 02:25:43 UTC (rev 1201)
@@ -102,20 +102,34 @@
if bib_id:
try:
counts = E1(OPENSRF_COPY_COUNTS, bib_id, 1, 0)
- lib = desk = avail = 0
+ lib = desk = avail = vol = 0
dueinfo = ''
callno = ''
circmod = ''
for org, callnum, loc, stats in counts:
+ callprefix = ''
+ callsuffix = ''
if len(callno) == 0:
callno = callnum
avail_here = stats.get(AVAILABLE, 0)
avail_here += stats.get(RESHELVING, 0)
anystatus_here = sum(stats.values())
+
+ """
+ volume check - based on v.1, etc. in call number
+ """
+ voltest = re.search(r'\w*v\.\s?(\d+)', callnum)
+
if loc == RESERVES_DESK_NAME:
desk += anystatus_here
avail += avail_here
- callno = callnum
+ if voltest and vol > 0:
+ if (int(voltest.group(1)) > vol):
+ callsuffix = "/" + callnum
+ else:
+ callprefix = callnum + "/"
+ else:
+ callno = callnum
dueinfo = ''
lib += anystatus_here
copyids = E1(OPENSRF_CN_CALL, bib_id, callnum, org)
@@ -129,7 +143,7 @@
if loc == RESERVES_DESK_NAME:
if len(circmod) == 0:
circmod = circinfo.get("circ_modifier")
- if avail == 0:
+ if avail == 0 or (voltest and callno.find(voltest.group(0)) == -1):
circs = circinfo.get("circulations")
if circs and len(circs) > 0:
circ = circs[0]
@@ -137,15 +151,34 @@
#remove offset info, %z is flakey for some reason
rawdate = rawdate[:-5]
duetime = time.strptime(rawdate, TIME_FORMAT)
- if len(dueinfo) == 0:
+ if len(dueinfo) == 0 or voltest:
earliestdue = duetime
- dueinfo = time.strftime(DUE_FORMAT,earliestdue)
- callno = callnum
- if duetime < earliestdue:
+ if voltest:
+ if (int(voltest.group(1)) > vol):
+ if len(dueinfo) > 0:
+ dueinfo = dueinfo + "/"
+ dueinfo = dueinfo + voltest.group(0) + ': ' + time.strftime(DUE_FORMAT,earliestdue)
+ else:
+ tmpinfo = dueinfo
+ dueinfo = voltest.group(0) + ': ' + time.strftime(DUE_FORMAT,earliestdue)
+ if len(tmpinfo) > 0:
+ dueinfo = dueinfo + "/" + dueinfo
+ callprefix = callsuffix = ''
+ else:
+ dueinfo = time.strftime(DUE_FORMAT,earliestdue)
+
+ if not voltest:
+ callno = callnum
+
+ # way too wacky to sort out vols for this
+ if duetime < earliestdue and not voltest:
earliestdue = duetime
dueinfo = time.strftime(DUE_FORMAT,earliestdue)
callno = callnum
+ if voltest:
+ callno = callprefix + callno + callsuffix
+ vol = int(voltest.group(1))
return (lib, desk, avail, callno, dueinfo, circmod)
except:
print "due date/call problem: ", bib_id
Modified: servres/trunk/conifer/templates/components/site.xhtml
===================================================================
--- servres/trunk/conifer/templates/components/site.xhtml 2011-01-17 15:43:50 UTC (rev 1200)
+++ servres/trunk/conifer/templates/components/site.xhtml 2011-01-18 02:25:43 UTC (rev 1201)
@@ -44,7 +44,6 @@
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 py:if="_dueinfo">DUE: ${_dueinfo}</div>
<div py:if="_circmod">
<span py:if="_circmod == 'RSV2'">2 Hour Loan</span>
<span py:if="_circmod == 'RSV3'">3 Day Loan</span>
@@ -60,12 +59,16 @@
<span py:if="_circmod == 'RESERVE 7 DAY'">7 Day Loan</span>
</div>
<div class="callnumber">${_callno}</div>
- </div>
- <div py:if="not valid" class="unavailable">
- Availability unknown.
- <div class="callnumber">${item.call_number()}</div>
- </div>
- </a>
+ <div py:if="_dueinfo">DUE: ${_dueinfo}</div>
+ </div>
+
+ <div py:if="not valid" class="unavailable">
+ Availability unknown.
+ <div class="callnumber">${item.call_number()}</div>
+
+ </div>
+
+ </a>
</div>
<div class="availability avail_nonphys" py:if="item.item_type != 'PHYS'">
</div>
Modified: servres/trunk/conifer/templates/item/item_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_metadata.xhtml 2011-01-17 15:43:50 UTC (rev 1200)
+++ servres/trunk/conifer/templates/item/item_metadata.xhtml 2011-01-18 02:25:43 UTC (rev 1201)
@@ -52,9 +52,44 @@
<tr py:if="item.issue"><th>Issue</th><td>${item.issue}</td></tr>
<tr py:if="item.pages"><th>Pages</th><td>${item.pages}</td></tr>
<tr py:if="item.isbn"><th>ISBN</th><td>${item.isbn}</td></tr>
+ <!--
<tr py:if="callnum"><th>Call Number</th><td>${callnum}</td></tr>
+ -->
<tr py:if="item.item_type=='ELEC'"><th>Copyright status</th><td>${item.get_copyright_status_display()}</td></tr>
<tr><th>Type</th><td>${item.get_item_type_display()}</td></tr>
+ <?python
+ downloads_allowed = site.allows_downloads_to(user)
+ stat = callhook('item_status', item) if (item.item_type == 'PHYS') else None
+ valid = stat is not None
+ ?>
+ <tr py:if="valid" py:with="(_lib, _desk, _avail, _callno, _dueinfo, _circmod) = stat"
+ title="${_avail} of ${_desk} copies available at reserves desk; ${_lib} total copies in library system">
+ <th>Call Number (take this to the counter)</th>
+ <td>
+ <div class="${_avail > 0 and 'available' or 'unavailable'}" py:if="_dueinfo">DUE: ${_dueinfo}</div>
+ <div class="callnumber ${_avail > 0 and 'available' or 'unavailable'}">${_callno}</div>
+ <div py:if="_circmod">
+ <span py:if="_circmod == 'RSV2'">2 Hour Loan</span>
+ <span py:if="_circmod == 'RSV3'">3 Day Loan</span>
+ <span py:if="_circmod == 'RSV4'">4 Day Loan</span>
+ <span py:if="_circmod == 'RSV7'">7 Day Loan</span>
+ <span py:if="_circmod == 'RESERVE 1 DAY'">1 Day Loan</span>
+ <span py:if="_circmod == 'RESERVE 1 HOUR'">1 Hour Loan</span>
+ <span py:if="_circmod == 'RESERVE 14 DAY'">14 Day Loan</span>
+ <span py:if="_circmod == 'RESERVE 2 DAY'">2 Day Loan</span>
+ <span py:if="_circmod == 'RESERVE 2 HOUR'">2 Hour Loan</span>
+ <span py:if="_circmod == 'RESERVE 3 DAY'">3 Day Loan</span>
+ <span py:if="_circmod == 'RESERVE 4 HOUR'">4 Hour Loan</span>
+ <span py:if="_circmod == 'RESERVE 7 DAY'">7 Day Loan</span>
+ </div>
+
+ <div py:if="not valid" class="unavailable">
+ Availability unknown.
+ <div class="callnumber">${item.call_number()}</div>
+
+ </div>
+ </td>
+ </tr>
<tr py:if="item.item_type=='PHYS'"
py:with="avail, status = item.describe_physical_item_status()">
<th>Status</th><td><div class="${avail and 'available' or 'unavailable'}">${status}</div></td>
More information about the open-ils-commits
mailing list