From ce98f11cf3e165019255a8613ad02049760da51b Mon Sep 17 00:00:00 2001 From: artunit Date: Sun, 16 Jan 2011 05:17:30 +0000 Subject: [PATCH] support for barcode searching, expose bib_id in item edit git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1198 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/integration/uwindsor.py | 12 ++++++++++++ conifer/syrup/views/items.py | 1 - conifer/templates/item/common_metadata.xhtml | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/conifer/integration/uwindsor.py b/conifer/integration/uwindsor.py index 65b7a31..226169d 100644 --- a/conifer/integration/uwindsor.py +++ b/conifer/integration/uwindsor.py @@ -156,6 +156,7 @@ def _item_status(bib_id): def cat_search(query, start=1, limit=10): bibid=0 + bc = re.search('\d{14}', query.strip()) if query.startswith(EG_BASE): # query is an Evergreen URL # snag the bibid at this point @@ -165,6 +166,17 @@ def cat_search(query, start=1, limit=10): bibid = params[key] results = M.marcxml_to_records(I.url_to_marcxml(query)) numhits = len(results) + elif bc: + results = [] + numhits = 0 + bib = E1('open-ils.search.bib_id.by_barcode', bc.group(0)) + if bib: + copy = E1('open-ils.supercat.record.object.retrieve', bib) + rec = copy[0] + marc = unicode(rec['marc'], 'utf-8') + tree = M.marcxml_to_records(marc)[0] + results.append(tree) + numhits = 1 else: # query is an actual query if USE_Z3950: diff --git a/conifer/syrup/views/items.py b/conifer/syrup/views/items.py index 6223ed6..0d517f8 100644 --- a/conifer/syrup/views/items.py +++ b/conifer/syrup/views/items.py @@ -298,7 +298,6 @@ def item_add_cat_search(request, site_id, item_id): author=dublin.get('dc:creator'), publisher=dublin.get('dc:publisher',''), published=pubdate, - bib_id=request.POST.get('bibid'), marcxml=raw_pickitem, **dct) item.save() diff --git a/conifer/templates/item/common_metadata.xhtml b/conifer/templates/item/common_metadata.xhtml index 6c6c2b2..95b0110 100644 --- a/conifer/templates/item/common_metadata.xhtml +++ b/conifer/templates/item/common_metadata.xhtml @@ -23,6 +23,7 @@ if len(authors) < 2: Issue Pages ISBN + Bib Id of Item Copyright Status @@ -36,4 +37,4 @@ if len(authors) < 2: - \ No newline at end of file + -- 2.11.0