[open-ils-commits] r1166 - in servres/trunk/conifer: integration syrup templates templates/components (artunit)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jan 7 00:22:14 EST 2011


Author: artunit
Date: 2011-01-07 00:22:11 -0500 (Fri, 07 Jan 2011)
New Revision: 1166

Modified:
   servres/trunk/conifer/integration/uwindsor.py
   servres/trunk/conifer/syrup/models.py
   servres/trunk/conifer/templates/components/site.xhtml
   servres/trunk/conifer/templates/master.xhtml
Log:
added hook for due time info with checked out items

Modified: servres/trunk/conifer/integration/uwindsor.py
===================================================================
--- servres/trunk/conifer/integration/uwindsor.py	2011-01-06 03:04:16 UTC (rev 1165)
+++ servres/trunk/conifer/integration/uwindsor.py	2011-01-07 05:22:11 UTC (rev 1166)
@@ -88,20 +88,44 @@
 
 @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
 

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2011-01-06 03:04:16 UTC (rev 1165)
+++ servres/trunk/conifer/syrup/models.py	2011-01-07 05:22:11 UTC (rev 1166)
@@ -748,11 +748,11 @@
         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 @@
                     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

Modified: servres/trunk/conifer/templates/components/site.xhtml
===================================================================
--- servres/trunk/conifer/templates/components/site.xhtml	2011-01-06 03:04:16 UTC (rev 1165)
+++ servres/trunk/conifer/templates/components/site.xhtml	2011-01-07 05:22:11 UTC (rev 1166)
@@ -39,11 +39,15 @@
       ?>
       <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 &gt; 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.">

Modified: servres/trunk/conifer/templates/master.xhtml
===================================================================
--- servres/trunk/conifer/templates/master.xhtml	2011-01-06 03:04:16 UTC (rev 1165)
+++ servres/trunk/conifer/templates/master.xhtml	2011-01-07 05:22:11 UTC (rev 1166)
@@ -72,7 +72,7 @@
       </div>
       <div id="footer">
 	<div> 
-    Syrup is a subproject of <a href="http://projectconifer.ca">Project Conifer</a> &copy; 2010
+    Syrup is a subproject of <a href="http://projectconifer.ca">Project Conifer</a> &copy; 2011
     </div>
       </div>
       </div>



More information about the open-ils-commits mailing list