Koha Solutions knowledge base: run log of a live check Article https://kohasolutions.com/knowledge-base/koha-opac-customization-guide Check scripts/kb/live/koha-opac-customization-guide.mjs (SHA-256 513245242c9246e38a6669da321c20356f93f25bf95e2dcb2d3f23041d6f8835) Ran 2026-11-05T16:16:57Z (UTC), 129 s Koha 26.05.02 (Koha::version 26.05.02.002, database version 26.0600002) Source https://git.koha-community.org/Koha-community/Koha/src/commit/d3fc229bc5eaea25dfe88f86149386408fe5d32d System Debian GNU/Linux 13 (trixie) Result PASS: all 62 claims held Each claim is something the article says. "seen" is what the check read back when it is not just a yes/no. Changes the check made to the test server were undone afterwards, as its header describes. == Claims == ok the OPAC preferences named exist: LibraryName, OpacPublic, OpacMaintenance, opacthemes, OPACFallback, OPACUserCSS, OPACUserJS, OpacAdditionalStylesheet, opaclayoutstylesheet, OpacFavicon, OPACXSLTDetailsDisplay, OPACXSLTResultsDisplay, OPACXSLTListsDisplay ok the OPAC tab of System preferences has 10 sections (Appearance, Features, … Authentication) seen: 10 ok LibraryName "Kbverify Library" is the text of the header link (#logo a) seen: Kbverify Library ok …and the logo you see is a CSS background on #logo (koha-green-logo.svg), so it is changed with CSS seen: url("http://localhost:8080/opac-tmpl/bootstrap/images/koha-green-logo.svg") ok Tools lists "News", "HTML customizations", "Pages" and "Record display customizations" ok an HTML customization in OpacMainUserBlock shows on the OPAC home page ok a Pages entry (OPAC only) is its own page at /cgi-bin/koha/opac-page.pl?page_id=112 ok …set to staff only, the OPAC link redirects to the 404 page seen: http://localhost:8080/cgi-bin/koha/errors/404.pl ok a Record display customization at OPACDetailPage is added to the record's page, with [% record.title %] filled in seen: E Street shuffle : the glory days of Bruce Springsteen & the E Street Band / Clinton Heylin. | title: E Street shuffle : ok …and not to search results (that is OPACResultsPage) ok OPACXSLTDetailsDisplay is "default" (the shipped stylesheet) seen: default ok a plain copy in another folder fails: plack-opac-error.log "xsl:import : unable to load /var/lib/koha/kohadev/MARC21slimUtils.xsl" seen: [2026/11/05 16:17:14] [WARN] XSLT::Base: I/O warning : failed to load external entity "/var/lib/koha/kohadev/MARC21slimUtils.xsl" compilation error: file /var/lib/koha/kohadev/kbv-detail-1793895417350.xsl element import xsl:import : unable to load /var/lib/koha/kohadev/MARC21slimUtils.xsl at /kohad ok …and the record page shows none of the copy (no record description at all) ok with the xsl:import changed to the full path of MARC21slimUtils.xsl, the record page uses the copy ok a folder kbvtheme/en in the OPAC template directory appears as a choice for opacthemes seen: bootstrap , kbvtheme ok opacthemes = the new theme: its own opac-main.tt is used ok …every page it does not contain comes from the fallback (bootstrap): search still works ok …but its home page links no opac.css: CSS is looked up in the theme folder only, so a theme without css/ is unstyled ok …plack-opac-error.log: "File not found : css/opac.css at …/Koha/Template/Plugin/Asset.pm" (and js/basket.js, js/Gettext.js…) seen: [2026/11/05 16:17:19] [WARN] File not found : css/opac.css at /kohadevbox/koha/Koha/Template/Plugin/Asset.pm line 107. [2026/11/05 16:17:19] [WARN] File not found : css/print.css at /kohadevbox/koha/Koha/Template/Plugin/Asset.pm line 107. [2026/11/05 16:17:19] [WARN] File not found : js/Gettext.js at /kohadevbox/koha/Koha/Template/Plugin/Asset.pm line 84. [2026/11/05 16:17:19] [WARN] File not foun ok with css, js and images linked to bootstrap's (ln -s ../bootstrap/css css …), the theme's page loads opac-tmpl/kbvtheme/css/opac_….css seen: opac-tmpl/kbvtheme/css/opac_26.0502002.css ok OpacPublic Disable: the OPAC home page asks to log in ("Log in to your account") ok OpacMaintenance Show: every OPAC page shows "System maintenance" instead ok logo: an OPACUserCSS rule on #logo replaces the Koha logo with your image seen: url("https://cdn.example.org/our-logo.png") 200px ok header: an opacheader HTML customization shows on every page (search results too), just under the top bar seen: after-nav ok links: an OpacMoreSearches entry adds a link to the row under the search box (#moresearches), on every page ok home page: no left column (#navigation) while OpacNav and OpacNavBottom are empty ok links: an OpacNavBottom entry shows in the left column of the home page ok staff page: the Pages entry shows its title and the staff table at opac-page.pl?page_id= ok left block: an OpacNav entry shows in the left column (#navigation), with its link to the staff page seen:
ok left block: OpacNav does not print the entry's Title (write your own heading in Content) ok right block: an OpacNavRight entry shows in the right column (#OpacNavRight), under the login box seen: in right column ok right block: OpacNavRight does not print the entry's Title either ok the layout: three columns when left and right blocks are set (centre col-lg-7) ok News and Pages Display location options read "Staff interface and OPAC", "Staff interface", "OPAC" seen: ok news: an item with location OPAC shows on the home page with "Published on" ok news: it still shows on its Expiration date (hidden from the day after) ok news: an item whose Publication date is in the future is not shown yet ok news: newest Publication date first, whatever "Appear in position" says seen: newer 18220, event 18941 ok news: an expired item still opens from its own link (opac-main.pl?news_id=), as the editor hint says ok news: the editor hint reads "News will still be accessible by direct URL if expired." ok news: the home page links an RSS feed (opac-news-rss.pl) that carries the items ok QuoteOfTheDay is empty on a new Koha (no quote shown anywhere) ok QuoteOfTheDay = OPAC: the home page shows "Quote of the day" with a quote seen: My fellow Americans, ask not what your country can do for you; ask what you can do for your country. ok …the same quote all day: a second visit shows the same one seen: My fellow Americans, ask not what your country can do for you; ask what you can do for your country. / My fellow Americans, ask not what your country can do for you; ask what you can do for your country. ok …because showing it stamps that quote's Last display with today ok …and the next day (no quote stamped today) Koha picks a new one at random by itself, no cron job seen: My fellow Americans, ask not what your country can do for you; ask what you can do for your country. ok the public report at /cgi-bin/koha/svc/report?id=…&annotated=1 returns the newest items as JSON (biblionumber, title, author, added) seen: {"biblionumber":2603,"title":"Kbverify new arrival one","added":"2026-11-05","author":null} ok …20 rows: the report's own LIMIT 20 decides how many seen: 20 ok …without a LIMIT the service returns only 10 (SvcMaxReportRows, default 10) seen: 10 ok STUCK: a book added after the first request does not appear (the JSON is cached for the report's 300 seconds) seen: Kbverify new arrival one | The God of Small Things ok OLD BOOKS: a deleted book is still in the slider until the cache expires seen: Kbverify new arrival one | The God of Small Things ok fix: with the cache cleared (or expired), the deleted book is gone and the new one is first seen: Kbverify new arrival two | The God of Small Things ok fix: with the report's cache expiry set low, a newly added book appears on its own within that time seen: Kbverify new arrival three | Kbverify new arrival two ok a withdrawn copy is left out by the report (withdrawn = 0) ok the slider: the OPACUserJS code fills #new-arrivals with one link per book, newest first, in a scrolling row seen: 20 cards, first "Kbverify new arrival three", flex auto ok …each card links to the book's page seen: /cgi-bin/koha/opac-detail.pl?biblionumber=2605 ok the OPAC includes call KohaPlugins.get_plugins_opac_head and get_plugins_opac_js seen: 2 ok package install: bootstrap templates and the default XSLT belong to koha-common (an upgrade overwrites them) seen: koha-common: /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/opac-main.tt koha-common: /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl dpkg-query: no path found matching pattern /usr/share/koha/opac/htdocs/opac-tmpl/mytheme Version: 26.05.05-1 ok …and a theme folder of your own belongs to no package: "dpkg-query: no path found matching pattern …/mytheme" seen: koha-common: /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/opac-main.tt koha-common: /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl dpkg-query: no path found matching pattern /usr/share/koha/opac/htdocs/opac-tmpl/mytheme Version: 26.05.05-1 ok …on koha-common 26.05.05 seen: koha-common: /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/opac-main.tt koha-common: /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl dpkg-query: no path found matching pattern /usr/share/koha/opac/htdocs/opac-tmpl/mytheme Version: 26.05.05-1 ok the article's theme commands, on a package install: the folder holds one template and three links to bootstrap seen: total 4 lrwxrwxrwx 1 root root 16 Nov 5 16:18 css -> ../bootstrap/css drwxr-xr-x 3 root root 4096 Nov 5 16:18 en lrwxrwxrwx 1 root root 19 Nov 5 16:18 images -> ../bootstrap/images lrwxrwxrwx 1 root root 15 Nov 5 16:18 js -> ../bootstrap/js /usr/share/koha/opac/htdocs/opac-tmpl/mytheme/en/modules/opac-main.tt --- 10: ok the article's XSLT commands: the copy now imports MARC21slimUtils.xsl by its full path seen: total 4 lrwxrwxrwx 1 root root 16 Nov 5 16:18 css -> ../bootstrap/css drwxr-xr-x 3 root root 4096 Nov 5 16:18 en lrwxrwxrwx 1 root root 19 Nov 5 16:18 images -> ../bootstrap/images lrwxrwxrwx 1 root root 15 Nov 5 16:18 js -> ../bootstrap/js /usr/share/koha/opac/htdocs/opac-tmpl/mytheme/en/modules/opac-main.tt --- 10: == The check that produced this log (scripts/kb/live/koha-opac-customization-guide.mjs) == /** * Live check for prisma/ks-kb/99-koha-opac-customization-guide.ts (the OPAC customization pillar). On live Koha: * the OPAC preferences the article names exist; LibraryName is the header's text over the Koha logo; the four Tools * entries (News, HTML customizations, Pages, Record display customizations); a Pages entry served by * opac-page.pl?page_id= (and a 404 when it is staff-only); a Record display customization appended to the record's * page with Template Toolkit ([% record.title %]); a custom XSLT file named in OPACXSLTDetailsDisplay; a custom theme * folder holding one template, falling back to bootstrap for the rest, and its missing CSS; OpacPublic and * OpacMaintenance. The upgrade claims (which paths the koha-common package owns) run in a throwaway * kbv-koha-ubuntu:24.04 box (koha-common 26.05.05). Undone: prefs, rows, files and the theme folder. */ import { spawnSync } from 'node:child_process' // The article shows these four exactly; the check runs them as they are. export const NEW_ARRIVALS_SQL = `SELECT b.biblionumber, b.title, b.author, MAX(i.dateaccessioned) AS added FROM items i JOIN biblio b ON b.biblionumber = i.biblionumber WHERE i.withdrawn = 0 AND i.itemlost = 0 AND i.dateaccessioned IS NOT NULL GROUP BY b.biblionumber, b.title, b.author ORDER BY added DESC, b.biblionumber DESC LIMIT 20` export const SLIDER_HTML = '

New arrivals

\n
' export const SLIDER_CSS = '.new-arrivals { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .5rem; }\n.new-arrivals a { flex: 0 0 10rem; scroll-snap-align: start; border: 1px solid #ddd; border-radius: 6px; padding: .75rem; }' export const SLIDER_JS = `$(function () { var box = $("#new-arrivals"); if (!box.length) return; $.getJSON("/cgi-bin/koha/svc/report?id=REPORT_ID&annotated=1", function (rows) { $.each(rows, function (i, r) { $("").attr("href", "/cgi-bin/koha/opac-detail.pl?biblionumber=" + r.biblionumber) .text(r.title + (r.author ? " / " + r.author : "")).appendTo(box); }); }); });` export const THEME_CMDS = `cd /usr/share/koha/opac/htdocs/opac-tmpl sudo mkdir -p mytheme/en/modules sudo cp bootstrap/en/modules/opac-main.tt mytheme/en/modules/ cd mytheme sudo ln -s ../bootstrap/css css sudo ln -s ../bootstrap/js js sudo ln -s ../bootstrap/images images ls -l find /usr/share/koha/opac/htdocs/opac-tmpl/mytheme -name '*.tt'` export const XSLT_CMDS = `sudo mkdir -p /usr/local/share/koha-custom sudo cp /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl /usr/local/share/koha-custom/ sudo sed -i 's#"MARC21slimUtils.xsl"#"/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl"#' /usr/local/share/koha-custom/MARC21slim2OPACDetail.xsl grep -n 'xsl:import' /usr/local/share/koha-custom/MARC21slim2OPACDetail.xsl` // Home page blocks, the staff page and an event, as the article shows them (owner, 2026-11-05). export const LEFT_BLOCK_HTML = `

Quick links

` export const RIGHT_BLOCK_HTML = `

Opening hours

Mon-Fri 8:00-20:00
Sat 9:00-13:00

` export const STAFF_PAGE_HTML = `
NameRoleEmail
A. LibrarianChief librarianchief@example.org
B. AssistantCirculation deskdesk@example.org
` export const EVENT_NEWS_HTML = `

Thursday 3 December, 14:00, Main reading room. A one-hour session on finding journal articles. Free, no booking.

` export const meta = { koha: '26.05.02', passed: '2026-11-05' } const IMG = 'kbv-koha-ubuntu:24.04' const HT = '/kohadevbox/koha/koha-tmpl/opac-tmpl' const THEME = 'kbvtheme' // a new name each run: Koha::XSLT::Base caches a stylesheet by file name in each Plack worker const XSL = `/var/lib/koha/kohadev/kbv-detail-${Date.now()}.xsl` export default async function run(ctx) { const opac = (path) => ctx.sh(`curl -s -L '${ctx.OPAC}${path}'`).out const bib = ctx.sqlValue('SELECT MIN(biblionumber) FROM biblio') const ids = [] ctx.restore("delete this run's additional_contents rows", () => { if (!ids.length) return ctx.sql(`DELETE FROM additional_contents_localizations WHERE additional_content_id IN (${ids.join(',')})`) ctx.sql(`DELETE FROM additional_contents WHERE id IN (${ids.join(',')})`) ctx.flushCaches() }) const add = (category, location, code, content) => { ctx.sql(`INSERT INTO additional_contents (category, code, location, branchcode, published_on) VALUES ('${category}', '${code}', '${location}', NULL, CURDATE() - INTERVAL 1 DAY)`) const id = ctx.sqlValue(`SELECT MAX(id) FROM additional_contents WHERE code = '${code}'`) ids.push(id) ctx.sql(`INSERT INTO additional_contents_localizations (additional_content_id, title, content, lang) VALUES (${id}, 'Kbverify ${code}', ${ctx.q(content)}, 'default')`) ctx.flushCaches() return id } // 1. The preferences the article names. const names = ['LibraryName', 'OpacPublic', 'OpacMaintenance', 'opacthemes', 'OPACFallback', 'OPACUserCSS', 'OPACUserJS', 'OpacAdditionalStylesheet', 'opaclayoutstylesheet', 'OpacFavicon', 'OPACXSLTDetailsDisplay', 'OPACXSLTResultsDisplay', 'OPACXSLTListsDisplay'] const have = ctx.sql(`SELECT variable FROM systempreferences WHERE variable IN (${names.map((n) => `'${n}'`).join(',')})`).map((r) => r[0]) ctx.check(`the OPAC preferences named exist: ${names.join(', ')}`, names.every((n) => have.includes(n)), names.filter((n) => !have.includes(n)).join(', ')) const pref = ctx.sh('grep -c "^ [A-Z][A-Za-z ]*:$" /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref').out ctx.check('the OPAC tab of System preferences has 10 sections (Appearance, Features, … Authentication)', pref === '10', pref) // 2. LibraryName is the header's text; the Koha logo is a CSS background. ctx.setPref('LibraryName', 'Kbverify Library') const b = await ctx.newPage() await b.goto(`${ctx.OPAC}/cgi-bin/koha/opac-main.pl`) const brand = (await b.locator('#logo a').innerText().catch(() => '')).trim() const bg = await b.evaluate(() => getComputedStyle(document.querySelector('#logo')).backgroundImage) ctx.check('LibraryName "Kbverify Library" is the text of the header link (#logo a)', brand === 'Kbverify Library', brand) ctx.check('…and the logo you see is a CSS background on #logo (koha-green-logo.svg), so it is changed with CSS', /koha-green-logo/.test(bg), bg) // 3. Tools → the four content tools. const staff = await ctx.newPage() await ctx.staffLogin(staff) await staff.goto(`${ctx.STAFF}/cgi-bin/koha/tools/tools-home.pl`) const tools = await ctx.pageText(staff) const four = ['News', 'HTML customizations', 'Pages', 'Record display customizations'] ctx.check('Tools lists "News", "HTML customizations", "Pages" and "Record display customizations"', four.every((x) => tools.includes(x)), four.filter((x) => !tools.includes(x)).join(', ')) // 4. HTML customization: one block on the home page. add('html_customizations', 'OpacMainUserBlock', 'KBV_MAIN', '

Kbverify main block

') ctx.check('an HTML customization in OpacMainUserBlock shows on the OPAC home page', opac('/cgi-bin/koha/opac-main.pl').includes('Kbverify main block')) // 5. Pages. const page = add('pages', 'opac_only', 'KBV_PAGE', '

Kbverify opening hours page

') ctx.check(`a Pages entry (OPAC only) is its own page at /cgi-bin/koha/opac-page.pl?page_id=${page}`, opac(`/cgi-bin/koha/opac-page.pl?page_id=${page}`).includes('Kbverify opening hours page')) ctx.sql(`UPDATE additional_contents SET location = 'staff_only' WHERE id = ${page}`) ctx.flushCaches() const code = ctx.sh(`curl -s -o /dev/null -w '%{redirect_url}' '${ctx.OPAC}/cgi-bin/koha/opac-page.pl?page_id=${page}'`).out ctx.check('…set to staff only, the OPAC link redirects to the 404 page', /errors\/404\.pl/.test(code), code) // 6. Record display customization. add('record_display', 'OPACDetailPage', 'KBV_REC', '

Kbverify note for [% record.title %]

') const title = ctx.sqlValue(`SELECT title FROM biblio WHERE biblionumber = ${bib}`) const det = opac(`/cgi-bin/koha/opac-detail.pl?biblionumber=${bib}`) const shown = (det.match(/Kbverify note for ([^<]*)/s//Kbverify custom XSLT<\\/span>/' ${XSL} && chmod 644 ${XSL}`) ctx.restore('remove the custom XSLT file', () => ctx.sh(`rm -f ${XSL}`)) ctx.setPref('OPACXSLTDetailsDisplay', XSL) const logMark = Number(ctx.sh('wc -l < /var/log/koha/kohadev/plack-opac-error.log').out) let d = opac(`/cgi-bin/koha/opac-detail.pl?biblionumber=${bib}`) const err = ctx.sh(`tail -n +${logMark + 1} /var/log/koha/kohadev/plack-opac-error.log`).out ctx.check(`a plain copy in another folder fails: plack-opac-error.log "xsl:import : unable to load ${XSL.replace(/kbv-detail-[0-9]+\.xsl$/, 'MARC21slimUtils.xsl')}"`, err.includes(`xsl:import : unable to load ${XSL.replace(/kbv-detail-[0-9]+\.xsl$/, 'MARC21slimUtils.xsl')}`), err.slice(0, 300)) ctx.check('…and the record page shows none of the copy (no record description at all)', !d.includes('Kbverify custom XSLT')) ctx.sh(`sed -i 's###' ${XSL}`) ctx.sh(`grep -n 'xsl:import' ${XSL}`) d = opac(`/cgi-bin/koha/opac-detail.pl?biblionumber=${bib}`) ctx.check('with the xsl:import changed to the full path of MARC21slimUtils.xsl, the record page uses the copy', d.includes('Kbverify custom XSLT')) ctx.setPref('OPACXSLTDetailsDisplay', 'default') // 8. A theme folder with one template. ctx.sh(`mkdir -p ${HT}/${THEME}/en/modules && cp ${HT}/bootstrap/en/modules/opac-main.tt ${HT}/${THEME}/en/modules/ && sed -i '0,/
/s//

Kbverify theme<\\/p>/' ${HT}/${THEME}/en/modules/opac-main.tt && chown -R kohadev-koha: ${HT}/${THEME}`) ctx.restore('remove the test theme folder', () => ctx.sh(`rm -rf ${HT}/${THEME}`)) await staff.goto(`${ctx.STAFF}/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=opacthemes`) const opts = await staff.locator('select[name="pref_opacthemes"] option').allInnerTexts() ctx.check(`a folder ${THEME}/en in the OPAC template directory appears as a choice for opacthemes`, opts.map((o) => o.trim()).includes(THEME), opts.join(', ')) ctx.setPref('OPACFallback', 'bootstrap') ctx.setPref('opacthemes', THEME) const themeMark = Number(ctx.sh('wc -l < /var/log/koha/kohadev/plack-opac-error.log').out) const home = opac('/cgi-bin/koha/opac-main.pl') ctx.check('opacthemes = the new theme: its own opac-main.tt is used', home.includes('id="kbv-theme"')) ctx.check('…every page it does not contain comes from the fallback (bootstrap): search still works', opac('/cgi-bin/koha/opac-search.pl?q=a').includes('id="numresults"') || opac('/cgi-bin/koha/opac-search.pl?q=a').includes('results')) ctx.check('…but its home page links no opac.css: CSS is looked up in the theme folder only, so a theme without css/ is unstyled', !/opac-tmpl\/[a-z]+\/css\/opac[_0-9]*\.css/.test(home), (home.match(/opac-tmpl\/[^"]*\.css/g) ?? []).join(' ')) const tlog = ctx.sh(`tail -n +${themeMark + 1} /var/log/koha/kohadev/plack-opac-error.log`).out ctx.check('…plack-opac-error.log: "File not found : css/opac.css at …/Koha/Template/Plugin/Asset.pm" (and js/basket.js, js/Gettext.js…)', tlog.includes('File not found : css/opac.css') && tlog.includes('File not found : js/Gettext.js'), tlog.slice(0, 400)) ctx.sh(`cd ${HT}/${THEME} && ln -s ../bootstrap/css css && ln -s ../bootstrap/js js && ln -s ../bootstrap/images images`) const fixed = opac('/cgi-bin/koha/opac-main.pl') ctx.check(`with css, js and images linked to bootstrap's (ln -s ../bootstrap/css css …), the theme's page loads opac-tmpl/${THEME}/css/opac_….css`, new RegExp(`opac-tmpl/${THEME}/css/opac_[0-9.]+\\.css`).test(fixed) && fixed.includes('id="kbv-theme"'), (fixed.match(/opac-tmpl\/[^"]*opac[^"]*\.css/g) ?? []).join(' ')) ctx.setPref('opacthemes', 'bootstrap') // 9. Private and maintenance. ctx.setPref('OpacPublic', '0') ctx.check('OpacPublic Disable: the OPAC home page asks to log in ("Log in to your account")', opac('/cgi-bin/koha/opac-main.pl').includes('Log in to your account')) ctx.setPref('OpacPublic', '1') ctx.setPref('OpacMaintenance', '1') ctx.check('OpacMaintenance Show: every OPAC page shows "System maintenance" instead', opac('/cgi-bin/koha/opac-main.pl').includes('System maintenance') && opac(`/cgi-bin/koha/opac-detail.pl?biblionumber=${bib}`).includes('System maintenance')) ctx.setPref('OpacMaintenance', '0') // 9b. Logo, header and navigation links. ctx.setPref('OPACUserCSS', '#logo { background-image: url("https://cdn.example.org/our-logo.png"); background-size: contain; width: 200px; } #logo a { width: 200px; padding-top: 50px; }') await b.goto(`${ctx.OPAC}/cgi-bin/koha/opac-main.pl`) const logo = await b.evaluate(() => { const s = getComputedStyle(document.querySelector('#logo')); return `${s.backgroundImage} ${s.width}` }) ctx.check('logo: an OPACUserCSS rule on #logo replaces the Koha logo with your image', logo.includes('https://cdn.example.org/our-logo.png') && logo.includes('200px'), logo) ctx.setPref('OPACUserCSS', '') add('html_customizations', 'opacheader', 'KBV_HEAD', '

Kbverify header strip

') await b.goto(`${ctx.OPAC}/cgi-bin/koha/opac-search.pl?q=a`) const headPos = await b.evaluate(() => { const h = document.querySelector('.kbv-head'); const n = document.querySelector('#header-region nav'); return h && n ? (n.compareDocumentPosition(h) & Node.DOCUMENT_POSITION_FOLLOWING ? 'after-nav' : 'before-nav') : 'missing' }) ctx.check('header: an opacheader HTML customization shows on every page (search results too), just under the top bar', headPos === 'after-nav', headPos) add('html_customizations', 'OpacMoreSearches', 'KBV_MORE', '') await b.goto(`${ctx.OPAC}/cgi-bin/koha/opac-search.pl?q=a`) ctx.check('links: an OpacMoreSearches entry adds a link to the row under the search box (#moresearches), on every page', (await b.locator('#moresearches a', { hasText: 'Kbverify opening hours' }).count()) === 1) ctx.check('home page: no left column (#navigation) while OpacNav and OpacNavBottom are empty', !opac('/cgi-bin/koha/opac-main.pl').includes('id="navigation"')) add('html_customizations', 'OpacNavBottom', 'KBV_NAVB', '') ctx.check('links: an OpacNavBottom entry shows in the left column of the home page', opac('/cgi-bin/koha/opac-main.pl').includes('Kbverify staff directory')) // 9b. Home page side blocks (left, centre, right), a staff page, and news used for events. const full = ({ category, location, code, title, content, pub = 1, exp = null, number = null }) => { ctx.sql(`INSERT INTO additional_contents (category, code, location, branchcode, published_on, expirationdate, number) VALUES ('${category}', '${code}', '${location}', NULL, CURDATE() - INTERVAL ${pub} DAY, ${exp === null ? 'NULL' : `CURDATE() - INTERVAL ${exp} DAY`}, ${number === null ? 'NULL' : number})`) const id = ctx.sqlValue(`SELECT MAX(id) FROM additional_contents WHERE code = '${code}'`) ids.push(id) ctx.sql(`INSERT INTO additional_contents_localizations (additional_content_id, title, content, lang) VALUES (${id}, ${ctx.q(title)}, ${ctx.q(content)}, 'default')`) ctx.flushCaches() return id } const staffPage = full({ category: 'pages', location: 'opac_only', code: 'KBV_STAFF', title: 'Kbverify Our staff', content: STAFF_PAGE_HTML }) const sp = opac(`/cgi-bin/koha/opac-page.pl?page_id=${staffPage}`) ctx.check('staff page: the Pages entry shows its title and the staff table at opac-page.pl?page_id=', sp.includes('Kbverify Our staff') && sp.includes('Chief librarian') && sp.includes('')) full({ category: 'html_customizations', location: 'OpacNav', code: 'KBV_LEFT', title: 'Kbverify left title', content: LEFT_BLOCK_HTML.replace('PAGE_ID', staffPage) }) full({ category: 'html_customizations', location: 'OpacNavRight', code: 'KBV_RIGHT', title: 'Kbverify Opening hours', content: RIGHT_BLOCK_HTML }) const hp = opac('/cgi-bin/koha/opac-main.pl') const navDiv = (hp.match(/