support for barcode searching, expose bib_id in item edit
authorartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 16 Jan 2011 05:17:30 +0000 (05:17 +0000)
committerartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 16 Jan 2011 05:17:30 +0000 (05:17 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1198 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/integration/uwindsor.py
conifer/syrup/views/items.py
conifer/templates/item/common_metadata.xhtml

index 65b7a31..226169d 100644 (file)
@@ -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:
index 6223ed6..0d517f8 100644 (file)
@@ -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()
index 6c6c2b2..95b0110 100644 (file)
@@ -23,6 +23,7 @@ if len(authors) < 2:
       <tr><th>Issue</th><td><input type="text" name="issue" value="${item.issue}"/></td></tr>
       <tr><th>Pages</th><td><input type="text" name="pages" value="${item.pages}"/></td></tr>
       <tr><th>ISBN</th><td><input type="text" name="isbn" value="${item.isbn}"/></td></tr>
+      <tr><th>Bib Id of Item</th><td><input type="text" name="bib_id" value="${item.bib_id}"/></td></tr>
       <tr py:if="user.is_staff and item.item_type == 'ELEC'">
        <th>Copyright Status</th>
        <td>
@@ -36,4 +37,4 @@ if len(authors) < 2:
       </tr>
     </tbody>
 
-</html>
\ No newline at end of file
+</html>