library: seed label templates/layouts, default item type, fix Apache setup
- Seed Avery 5160/5167 and Demco spine templates plus Spine, Spine+barcode and Barcode-only layouts (Dewey call number split across lines) - Default 942$c (item type) to BOOK so a Z39.50 import saves without edits - Enable Plack includes in addition to the plain ones (static files/rewrites) - Swap Apache from mpm_itk to prefork after koha-create (itk can't switch users in a container and returned HTTP 500 on every page) - Drop unneeded SETUID/SETGID caps Verified live: staff login, Z39.50 search/import against a local server, save + auto barcode, label PDF with Dewey spine + barcode. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wi3ZSot4XbUViwRFgLpRf
This commit is contained in:
@@ -37,10 +37,6 @@ services:
|
|||||||
KOHA_ADMIN_USER: ${ADMIN_USER:-admin}
|
KOHA_ADMIN_USER: ${ADMIN_USER:-admin}
|
||||||
KOHA_ADMIN_PASS: ${ADMIN_PASSWORD}
|
KOHA_ADMIN_PASS: ${ADMIN_PASSWORD}
|
||||||
KOHA_LIBRARY_NAME: ${LIBRARY_NAME:-My Library}
|
KOHA_LIBRARY_NAME: ${LIBRARY_NAME:-My Library}
|
||||||
# Koha's Apache uses mpm_itk, which switches users per request.
|
|
||||||
cap_add:
|
|
||||||
- SETUID
|
|
||||||
- SETGID
|
|
||||||
ports:
|
ports:
|
||||||
- "${OPAC_PORT:-8080}:80"
|
- "${OPAC_PORT:-8080}:80"
|
||||||
- "${STAFF_PORT:-8081}:8081"
|
- "${STAFF_PORT:-8081}:8081"
|
||||||
|
|||||||
@@ -90,6 +90,12 @@ my $admin = Koha::Patron->new({
|
|||||||
})->store;
|
})->store;
|
||||||
$admin->set_password({ password => $env{admin_pass}, skip_validation => 1 });
|
$admin->set_password({ password => $env{admin_pass}, skip_validation => 1 });
|
||||||
|
|
||||||
|
# ---- Make "add a book" need as few decisions as possible -------------------
|
||||||
|
# The item type (942$c) is mandatory in Koha's frameworks; default it to Book so
|
||||||
|
# a Z39.50 import can be saved without touching that field.
|
||||||
|
$dbh->do(q{UPDATE marc_subfield_structure SET defaultvalue = 'BOOK'
|
||||||
|
WHERE tagfield = '942' AND tagsubfield = 'c'});
|
||||||
|
|
||||||
# ---- Preferences ----------------------------------------------------------
|
# ---- Preferences ----------------------------------------------------------
|
||||||
my %prefs = (
|
my %prefs = (
|
||||||
autoBarcode => 'incremental', # new items get a barcode automatically
|
autoBarcode => 'incremental', # new items get a barcode automatically
|
||||||
|
|||||||
@@ -45,16 +45,21 @@ if [ ! -d "/etc/koha/sites/$INST" ]; then
|
|||||||
|
|
||||||
# Serve both interfaces through Plack (much faster than plain CGI).
|
# Serve both interfaces through Plack (much faster than plain CGI).
|
||||||
SITE="/etc/apache2/sites-available/$INST.conf"
|
SITE="/etc/apache2/sites-available/$INST.conf"
|
||||||
|
# The *-plack.conf files add the proxy rules on top of the plain ones (which
|
||||||
|
# still provide static files and rewrites), so enable them in addition.
|
||||||
sed -i \
|
sed -i \
|
||||||
-e 's|^\(\s*\)Include /etc/koha/apache-shared-opac.conf|\1Include /etc/koha/apache-shared-opac-plack.conf|' \
|
-e 's|^#\s*Include /etc/koha/apache-shared-opac-plack.conf| Include /etc/koha/apache-shared-opac-plack.conf|' \
|
||||||
-e 's|^\(\s*\)Include /etc/koha/apache-shared-intranet.conf|\1Include /etc/koha/apache-shared-intranet-plack.conf|' \
|
-e 's|^#\s*Include /etc/koha/apache-shared-intranet-plack.conf| Include /etc/koha/apache-shared-intranet-plack.conf|' "$SITE"
|
||||||
-e 's|^#\s*Include /etc/koha/apache-shared-opac-plack.conf||' \
|
|
||||||
-e 's|^#\s*Include /etc/koha/apache-shared-intranet-plack.conf||' "$SITE"
|
|
||||||
koha-plack --enable "$INST" >/dev/null 2>&1 || true # koha-create may already have enabled it
|
koha-plack --enable "$INST" >/dev/null 2>&1 || true # koha-create may already have enabled it
|
||||||
|
|
||||||
# Run Apache itself as the instance user instead of mpm_itk's per-vhost
|
# Run Apache itself as the instance user instead of mpm_itk's per-vhost
|
||||||
# uid switching (which needs extra capabilities and is pointless here:
|
# uid switching (which needs extra capabilities and is pointless here:
|
||||||
# Plack does the real work as that user already).
|
# Plack does the real work as that user already).
|
||||||
|
# koha-create insists on mpm_itk being enabled, but inside a container it can
|
||||||
|
# not switch users (initgroups: Operation not permitted -> HTTP 500 on every
|
||||||
|
# page). Now that the instance exists, swap to plain prefork.
|
||||||
|
rm -f /etc/apache2/mods-enabled/mpm_itk.*
|
||||||
|
a2enmod mpm_prefork >/dev/null 2>&1 || true
|
||||||
sed -i '/AssignUserID/d' "$SITE"
|
sed -i '/AssignUserID/d' "$SITE"
|
||||||
sed -i -e "s/^export APACHE_RUN_USER=.*/export APACHE_RUN_USER=$INST-koha/" \
|
sed -i -e "s/^export APACHE_RUN_USER=.*/export APACHE_RUN_USER=$INST-koha/" \
|
||||||
-e "s/^export APACHE_RUN_GROUP=.*/export APACHE_RUN_GROUP=$INST-koha/" /etc/apache2/envvars
|
-e "s/^export APACHE_RUN_GROUP=.*/export APACHE_RUN_GROUP=$INST-koha/" /etc/apache2/envvars
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
---
|
||||||
|
description:
|
||||||
|
- "Label sheets and layouts for Tools > Labels (spine labels and barcodes)"
|
||||||
|
tables:
|
||||||
|
- creator_templates:
|
||||||
|
translatable: [ template_desc ]
|
||||||
|
multiline: [ ]
|
||||||
|
rows:
|
||||||
|
# Avery 5160 / 8160 - the common 30-up address sheet; fits a spine label
|
||||||
|
# plus barcode on one label.
|
||||||
|
- template_code: "Avery 5160 | 1 x 2-5/8 (30 per sheet)"
|
||||||
|
template_desc: "3 columns, 10 rows. Spine label with barcode."
|
||||||
|
page_width: 8.5
|
||||||
|
page_height: 11
|
||||||
|
label_width: 2.63
|
||||||
|
label_height: 1
|
||||||
|
top_text_margin: 0.139
|
||||||
|
left_text_margin: 0.1
|
||||||
|
top_margin: 0.35
|
||||||
|
left_margin: 0.23
|
||||||
|
cols: 3
|
||||||
|
rows: 10
|
||||||
|
col_gap: 0.13
|
||||||
|
row_gap: 0
|
||||||
|
units: "INCH"
|
||||||
|
creator: "Labels"
|
||||||
|
|
||||||
|
# Avery 5167 / 8167 - 80-up small labels, good for barcode-only stickers.
|
||||||
|
- template_code: "Avery 5167 | 1/2 x 1-3/4 (80 per sheet)"
|
||||||
|
template_desc: "4 columns, 20 rows. Barcode-only stickers."
|
||||||
|
page_width: 8.5
|
||||||
|
page_height: 11
|
||||||
|
label_width: 1.75
|
||||||
|
label_height: 0.5
|
||||||
|
top_text_margin: 0.1
|
||||||
|
left_text_margin: 0.05
|
||||||
|
top_margin: 0.5
|
||||||
|
left_margin: 0.3
|
||||||
|
cols: 4
|
||||||
|
rows: 20
|
||||||
|
col_gap: 0.3
|
||||||
|
row_gap: 0
|
||||||
|
units: "INCH"
|
||||||
|
creator: "Labels"
|
||||||
|
|
||||||
|
# Demco 1" x 1.5" spine labels (Koha's own sample measurements).
|
||||||
|
- template_code: "Demco spine | 1 x 1.5 (50 per sheet)"
|
||||||
|
template_desc: "5 columns, 10 rows. Dewey / call number on up to four lines."
|
||||||
|
page_width: 8.5
|
||||||
|
page_height: 11
|
||||||
|
label_width: 1.5
|
||||||
|
label_height: 1
|
||||||
|
top_text_margin: 0.236
|
||||||
|
left_text_margin: 0
|
||||||
|
top_margin: 0.5
|
||||||
|
left_margin: 0.25
|
||||||
|
cols: 5
|
||||||
|
rows: 10
|
||||||
|
col_gap: 0.0625
|
||||||
|
row_gap: 0
|
||||||
|
units: "INCH"
|
||||||
|
creator: "Labels"
|
||||||
|
|
||||||
|
- creator_layouts:
|
||||||
|
translatable: [ layout_name, layout_xml ]
|
||||||
|
multiline: [ layout_xml ]
|
||||||
|
rows:
|
||||||
|
# callnum_split splits "613.2 SMI" onto separate lines the way spine
|
||||||
|
# labels are normally read (Dewey/LC aware).
|
||||||
|
- layout_name: "Spine - call number"
|
||||||
|
barcode_type: CODE39
|
||||||
|
start_label: 1
|
||||||
|
printing_type: BIB
|
||||||
|
guidebox: 0
|
||||||
|
oblique_title: 0
|
||||||
|
font: TB
|
||||||
|
font_size: 11
|
||||||
|
units: POINT
|
||||||
|
callnum_split: 1
|
||||||
|
text_justify: C
|
||||||
|
format_string: "itemcallnumber"
|
||||||
|
layout_xml:
|
||||||
|
- "<opt></opt>"
|
||||||
|
creator: "Labels"
|
||||||
|
|
||||||
|
- layout_name: "Spine + barcode"
|
||||||
|
barcode_type: CODE39
|
||||||
|
start_label: 1
|
||||||
|
printing_type: BIBBAR
|
||||||
|
guidebox: 0
|
||||||
|
oblique_title: 0
|
||||||
|
font: TB
|
||||||
|
font_size: 10
|
||||||
|
units: POINT
|
||||||
|
callnum_split: 1
|
||||||
|
text_justify: C
|
||||||
|
format_string: "itemcallnumber"
|
||||||
|
layout_xml:
|
||||||
|
- "<opt></opt>"
|
||||||
|
creator: "Labels"
|
||||||
|
|
||||||
|
- layout_name: "Barcode only"
|
||||||
|
barcode_type: CODE39
|
||||||
|
start_label: 1
|
||||||
|
printing_type: BAR
|
||||||
|
guidebox: 0
|
||||||
|
oblique_title: 0
|
||||||
|
font: TR
|
||||||
|
font_size: 10
|
||||||
|
units: POINT
|
||||||
|
callnum_split: 0
|
||||||
|
text_justify: L
|
||||||
|
format_string: "barcode"
|
||||||
|
layout_xml:
|
||||||
|
- "<opt></opt>"
|
||||||
|
creator: "Labels"
|
||||||
Reference in New Issue
Block a user