library: add Quick Add page (scan an ISBN, the book is added)

A small standard-library Python service next to Koha:
- looks the code up via Z39.50 (yaz) then Open Library over HTTPS
- checks Koha for an existing copy (ISBN-10/13 and UPC/EAN aware)
- adds the record + an item with the next barcode via Koha's REST API
- scanner-friendly UI: auto-focus, audible feedback, duplicate card with
  'add another copy', manual entry when nothing is found, undo, and the
  barcode range to print labels for
Also: enable RESTBasicAuth, map 024$a to the ean column, wire the service,
port and credentials into compose/install.sh.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013wi3ZSot4XbUViwRFgLpRf
This commit is contained in:
Claude
2026-11-06 10:24:54 +00:00
parent f4da2608cd
commit 2ef8f68b9b
8 changed files with 853 additions and 0 deletions
+7
View File
@@ -96,10 +96,17 @@ $admin->set_password({ password => $env{admin_pass}, skip_validation => 1 });
$dbh->do(q{UPDATE marc_subfield_structure SET defaultvalue = 'BOOK'
WHERE tagfield = '942' AND tagsubfield = 'c'});
# UPC/EAN barcodes (DVDs, CDs, games) live in 024$a, which the stock framework
# leaves unmapped - so Koha can neither search nor de-duplicate on them. Map it
# to the catalogue's `ean` column (used by the quick-add page's duplicate check).
$dbh->do(q{UPDATE marc_subfield_structure SET kohafield = 'biblioitems.ean'
WHERE tagfield = '024' AND tagsubfield = 'a' AND (kohafield IS NULL OR kohafield = '')});
# ---- Preferences ----------------------------------------------------------
my %prefs = (
autoBarcode => 'incremental', # new items get a barcode automatically
itemcallnumber => '082ab', # Dewey call number copied from the MARC record
RESTBasicAuth => 1, # lets the quick-add page use the REST API
OpenLibraryCovers => 1, # cover images in the catalogue
OPACSearchForTitleIn => '',
BiblioDefaultView => 'normal',