[open-ils-commits] r284 - in servres/trunk/conifer: libsystems/evergreen syrup templates/phys (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Apr 5 19:38:32 EDT 2009


Author: gfawcett
Date: 2009-04-05 19:38:32 -0400 (Sun, 05 Apr 2009)
New Revision: 284

Modified:
   servres/trunk/conifer/libsystems/evergreen/support.py
   servres/trunk/conifer/syrup/models.py
   servres/trunk/conifer/syrup/views.py
   servres/trunk/conifer/templates/phys/mark_arrived.xhtml
   servres/trunk/conifer/templates/phys/mark_arrived_choose.xhtml
   servres/trunk/conifer/templates/phys/mark_arrived_outcome.xhtml
Log:
show MARC for matching items on 'mark-item-arrived' screen.

So, in a thorny case, you can match the barcode-swiped item's bib
record against those in the database.


Modified: servres/trunk/conifer/libsystems/evergreen/support.py
===================================================================
--- servres/trunk/conifer/libsystems/evergreen/support.py	2009-04-05 22:31:06 UTC (rev 283)
+++ servres/trunk/conifer/libsystems/evergreen/support.py	2009-04-05 23:38:32 UTC (rev 284)
@@ -70,7 +70,9 @@
 
 def evergreen_request_single_result(method, *args):
     resp = evergreen_request(method, *args)
-    if len(resp) > 1:
+    if not resp:
+        return None
+    elif len(resp) > 1:
         warnings.warn('taking single value from multivalue evergreen response')
         print >> sys.stderr, repr(resp)
     return resp[0]

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2009-04-05 22:31:06 UTC (rev 283)
+++ servres/trunk/conifer/syrup/models.py	2009-04-05 23:38:32 UTC (rev 284)
@@ -10,6 +10,7 @@
 from conifer.custom import lib_integration
 import re
 import random
+from django.utils import simplejson
 
 def highlight(text, phrase,
               highlighter='<strong class="highlight">\\1</strong>'):
@@ -409,6 +410,10 @@
     def barcode(self):
         bc = self.metadata_set.filter(name='syrup:barcode')
         return bc and bc[0].value or None
+ 
+    def marc(self):
+        m = self.metadata_set.filter(name='syrup:marc')
+        return m and simplejson.loads(m[0].value) or None
 
     def smallint(self):
         bc = self.barcode()

Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py	2009-04-05 22:31:06 UTC (rev 283)
+++ servres/trunk/conifer/syrup/views.py	2009-04-05 23:38:32 UTC (rev 284)
@@ -1334,8 +1334,11 @@
             msg = _('This item has already been marked as received. Date received: %s')
             msg = msg % str(already.received)
             return simple_message(_('Item already marked as received'), msg)
-                                  
         bib_id  = lib_integration.barcode_to_bib_id(barcode)
+        if not bib_id:
+            return simple_message(_('Item not found'), 
+                                  _('No item matching this barcode could be found.'))
+
         marcxml = lib_integration.bib_id_to_marcxml(bib_id)
         dct     = marcxml_to_dictionary(marcxml)
         dublin  = marcxml_dictionary_to_dc(dct)

Modified: servres/trunk/conifer/templates/phys/mark_arrived.xhtml
===================================================================
--- servres/trunk/conifer/templates/phys/mark_arrived.xhtml	2009-04-05 22:31:06 UTC (rev 283)
+++ servres/trunk/conifer/templates/phys/mark_arrived.xhtml	2009-04-05 23:38:32 UTC (rev 284)
@@ -1,5 +1,4 @@
 <?python
-sample_item = '31862016799294'  # fixme, just for testing.
 title = _('Mark Items as Arrived')
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
@@ -24,7 +23,7 @@
       <tr>
 	<th>Item Barcode</th>
 	<td>
-	  <input type="text" id="item" name="item" style="width: 400;" value="${sample_item}"/>
+	  <input type="text" id="item" name="item" style="width: 400;" value=""/>
 	</td>
       </tr>
       <tr>

Modified: servres/trunk/conifer/templates/phys/mark_arrived_choose.xhtml
===================================================================
--- servres/trunk/conifer/templates/phys/mark_arrived_choose.xhtml	2009-04-05 22:31:06 UTC (rev 283)
+++ servres/trunk/conifer/templates/phys/mark_arrived_choose.xhtml	2009-04-05 23:38:32 UTC (rev 284)
@@ -1,6 +1,5 @@
 <?python
 import re
-sample_item = '31862016799294'  # fixme, just for testing.
 title = _('Mark Items as Arrived: Choose Match')
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
@@ -46,16 +45,34 @@
       <thead style="font-size: 70%;">
 	<tr><th py:for="v in 'Select Title Author Course Instructor Score'.split(' ')">${v}</th></tr>
       </thead>
-      <tbody>
-      <tr py:for="score, item in ranked" class="${score &lt; 5 and 'likely' or score &lt; 50 and 'maybe' or 'doubtful'}">
+      <tbody py:for="n, (score, item) in enumerate(ranked)"
+	  class="${score &lt; 5 and 'likely' or score &lt; 50 and 'maybe' or 'doubtful'}"
+	  py:with="marc=item.marc()">
+	<tr>
 	<td><input type="checkbox" name="choose_${item.id}" id="choose_${item.id}"/></td>
-	<td><label for="choose_${item.id}">${item}</label></td>
-	<td>${item.author()}</td>
+	<td><label for="choose_${item.id}">${item}</label>
+	<span py:if="marc"><a href="javascript:$('#marcdata${n}').toggle();void(0);">detail</a></span>
+	</td>
+	<td>${item.author() or '&mdash;'}</td>	
 	<td>${item.course.title}</td>
 	<td>${','.join(n.last_name for n in item.course.get_instructors())}</td>
 	<td>${repr(score)}</td>
 	</tr>
-	</tbody>
+	<tr id="marcdata${n}"  style="display: none;">
+	  <td/>
+	  <td colspan="3">
+	    <div>
+	      <?python keys=marc.keys(); keys.sort() ?>
+	      <table>
+		<tr py:for="k in keys">
+		  <th>${k}</th>
+		  <td>${marc[k]}</td>
+		</tr>
+	      </table>
+	    </div>
+	  </td>
+	</tr>
+      </tbody>
     </table>
     </form>
   </div>

Modified: servres/trunk/conifer/templates/phys/mark_arrived_outcome.xhtml
===================================================================
--- servres/trunk/conifer/templates/phys/mark_arrived_outcome.xhtml	2009-04-05 22:31:06 UTC (rev 283)
+++ servres/trunk/conifer/templates/phys/mark_arrived_outcome.xhtml	2009-04-05 23:38:32 UTC (rev 284)
@@ -17,5 +17,6 @@
 </head>
 <body>
   <h1>${title}</h1>
+  <p><a href="../">Continue</a></p>
 </body>
 </html>



More information about the open-ils-commits mailing list