From: gfawcett Date: Sun, 5 Apr 2009 23:38:32 +0000 (+0000) Subject: show MARC for matching items on 'mark-item-arrived' screen. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=18ff144c1e4c7ac661f27331a95c25c09b003564;p=Syrup.git 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. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@284 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/libsystems/evergreen/support.py b/conifer/libsystems/evergreen/support.py index df87491..4e4454f 100644 --- a/conifer/libsystems/evergreen/support.py +++ b/conifer/libsystems/evergreen/support.py @@ -70,7 +70,9 @@ def evergreen_request(method, *args, **kwargs): 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] diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py index 70353b7..96ef4ae 100644 --- a/conifer/syrup/models.py +++ b/conifer/syrup/models.py @@ -10,6 +10,7 @@ from conifer.custom import course_sections # fixme, not sure if conifer.custom i from conifer.custom import lib_integration import re import random +from django.utils import simplejson def highlight(text, phrase, highlighter='\\1'): @@ -409,6 +410,10 @@ class Item(m.Model): 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() diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index bd3eabc..39f7237 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -1334,8 +1334,11 @@ def phys_mark_arrived(request): 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) diff --git a/conifer/templates/phys/mark_arrived.xhtml b/conifer/templates/phys/mark_arrived.xhtml index fdaf920..4f52eab 100644 --- a/conifer/templates/phys/mark_arrived.xhtml +++ b/conifer/templates/phys/mark_arrived.xhtml @@ -1,5 +1,4 @@ Item Barcode - + diff --git a/conifer/templates/phys/mark_arrived_choose.xhtml b/conifer/templates/phys/mark_arrived_choose.xhtml index cde15bb..bd0d6c7 100644 --- a/conifer/templates/phys/mark_arrived_choose.xhtml +++ b/conifer/templates/phys/mark_arrived_choose.xhtml @@ -1,6 +1,5 @@ ${v} - - + + - - ${item.author()} + + detail + + ${item.author() or '—'} ${item.course.title} ${','.join(n.last_name for n in item.course.get_instructors())} ${repr(score)} - + + + +
+ + + + + + +
${k}${marc[k]}
+
+ + + diff --git a/conifer/templates/phys/mark_arrived_outcome.xhtml b/conifer/templates/phys/mark_arrived_outcome.xhtml index f022efe..205ba94 100644 --- a/conifer/templates/phys/mark_arrived_outcome.xhtml +++ b/conifer/templates/phys/mark_arrived_outcome.xhtml @@ -17,5 +17,6 @@ title = _('Matches saved; item marked as received')

${title}

+

Continue