added hook for due time info with checked out items
authorartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Fri, 7 Jan 2011 05:22:11 +0000 (05:22 +0000)
committerartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Fri, 7 Jan 2011 05:22:11 +0000 (05:22 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1166 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/integration/uwindsor.py
conifer/syrup/models.py
conifer/templates/components/site.xhtml
conifer/templates/master.xhtml

index 9a87e62..ef3eeee 100644 (file)
@@ -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
 
index cc45f6e..f84d47f 100644 (file)
@@ -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
index 1481f50..f944d42 100644 (file)
@@ -39,11 +39,15 @@ searchtext = _('search this site...')
       ?>
       <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.">
index b44de1b..81338f1 100644 (file)
@@ -72,7 +72,7 @@ from django.conf import settings
       </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>