Koha Solutions knowledge base: run log of a live check Article https://kohasolutions.com/knowledge-base/koha-notices-and-slips Check scripts/kb/live/koha-notices-and-slips.mjs (SHA-256 0efafbaf75e82fe2b38872589fd841abb65872db28874746c04fe150b2c38376) Ran 2026-11-05T14:28:56Z (UTC), 11 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 17 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 "A fresh Koha has about ninety notices" seen: 91 ok Koha ships ODUE but no ODUE2/ODUE3 ok the All libraries row offers "Copy to Centerville" ok Copy opens "New notice" with Library Centerville (CPL) seen: New notice / branch=CPL ok Edit opens "Modify notice" ok CHECKOUT's email subject is "Checkouts" ok buttons: Insert, Preview, View default; Save / Save and continue editing ok SMS panel: "You should enable the SMSSendDriver preference to use the SMS templates." ok Preview: "Do not forget that the item has not been checked out yet." seen: Preview notice template | Preview notice template | Do not forget that the item has not been checked out yet. | The generated notices are exactly the same! | Original version | Dear < '' ORDER BY itemnumber LIMIT 1") const before = ctx.sqlValue("SELECT CONCAT(COUNT(*), '/', MAX(updated_on)) FROM letter WHERE code = 'CHECKOUT'") const n = Number(ctx.sqlValue("SELECT COUNT(DISTINCT module, code) FROM letter WHERE branchcode = ''")) ctx.check('"A fresh Koha has about ninety notices"', n >= 80 && n <= 100, n) ctx.check('Koha ships ODUE but no ODUE2/ODUE3', ctx.sqlValue("SELECT GROUP_CONCAT(DISTINCT code) FROM letter WHERE code LIKE 'ODUE%' AND branchcode = ''") === 'ODUE') const page = await ctx.newPage() await ctx.staffLogin(page) // Copy to a library opens "New notice" for that library (not saved). await page.goto(`${ctx.STAFF}${LETTER}`) const row = page.locator('form', { has: page.locator('input[name=code][value=CHECKOUT]') }).filter({ has: page.locator('input[name=oldbranchcode][value=""]') }).first() const opt = await row.locator('option', { hasText: 'Copy to Centerville' }).getAttribute('value').catch(() => null) ctx.check('the All libraries row offers "Copy to Centerville"', Boolean(opt)) if (opt !== null) { await row.locator('select').selectOption(opt) await row.locator('button', { hasText: 'Copy' }).click() await page.waitForLoadState() const html = await page.content() const lib = await page.locator('#branch').first().inputValue().catch(() => '') ctx.check('Copy opens "New notice" with Library Centerville (CPL)', html.includes('New notice') && lib === 'CPL', `${html.includes('New notice') ? 'New notice' : page.url()} / branch=${lib}`) } // The editor. await page.goto(`${ctx.STAFF}${LETTER}?op=add_form&branchcode=&module=circulation&code=CHECKOUT`) const editor = await ctx.pageText(page) ctx.check('Edit opens "Modify notice"', editor.includes('Modify notice')) ctx.check('CHECKOUT\'s email subject is "Checkouts"', (await page.locator('input[name=title]').first().inputValue().catch(() => '')) === 'Checkouts' || /Message subject:[\s|]*Checkouts/.test(editor)) ctx.check('buttons: Insert, Preview, View default; Save / Save and continue editing', ['Insert', 'Preview', 'View default', 'Save and continue editing'].every((b) => editor.includes(b)) || (await page.locator('text=Save and continue editing').count()) > 0) ctx.check('SMS panel: "You should enable the SMSSendDriver preference to use the SMS templates."', ctx.sqlValue("SELECT value FROM systempreferences WHERE variable = 'SMSSendDriver'") ? true : (await page.content()).includes('You should enable the SMSSendDriver preference to use the SMS templates.')) // Preview with a misspelled variable (form content only; not saved). await page.evaluate(() => document.querySelectorAll('.collapse').forEach((c) => c.classList.add('show'))) const panel = page.locator('fieldset.mtt', { has: page.locator('#content_email_default') }) const preview = async (data, body) => { if (body !== undefined) await page.locator('#content_email_default').fill(body) await page.locator('#data_preview').fill(data) await panel.locator('a.preview_template').click() await page.locator('#preview_template').waitFor({ state: 'visible' }) await page.waitForTimeout(1500) const txt = await ctx.pageText(page, '#preview_template') await page.keyboard.press('Escape') await page.waitForTimeout(500) return txt } const p1 = await preview(`${barcode}|${pid}`, 'Dear <>,') ctx.check('Preview: "Do not forget that the item has not been checked out yet."', p1.includes('Do not forget that the item has not been checked out yet.'), p1.slice(0, 200)) ctx.check('Preview: "The generated notices are exactly the same!"', p1.includes('The generated notices are exactly the same!')) ctx.check('a misspelled variable renders as nothing: "Dear ,"', p1.includes('Dear ,')) ctx.check('empty data → "You did not specify data for preview."', (await preview('')).includes('You did not specify data for preview.')) ctx.check('wrong barcode → "The item or the patron does not exist."', (await preview('KBVERIFY-NO-SUCH|1')).includes('The item or the patron does not exist.')) // No preview for other notices. await page.goto(`${ctx.STAFF}${LETTER}?op=add_form&branchcode=&module=circulation&code=ODUE`) ctx.check('ODUE: no Data for preview box and no Preview button', (await page.locator('#data_preview').count()) === 0 && (await page.locator('a.preview_template').count()) === 0) ctx.check('nothing was saved (CHECKOUT rows unchanged)', ctx.sqlValue("SELECT CONCAT(COUNT(*), '/', MAX(updated_on)) FROM letter WHERE code = 'CHECKOUT'") === before) // The overdue item loop and items.content, as the article describes them. ctx.check('shipped ODUE email lists items with [% FOREACH overdue IN overdues %]', (ctx.sqlValue("SELECT content FROM letter WHERE code = 'ODUE' AND branchcode = '' AND message_transport_type = 'email' LIMIT 1") ?? '').includes('[% FOREACH overdue IN overdues %]')) ctx.check('the daily cron runs overdue_notices.pl -t; --itemscontent defaults to date_due,title,barcode,author,itemnumber', ctx.sh('grep -c "overdue_notices.pl -t" /etc/cron.daily/koha-common').out === '1' && ctx.sh("grep -c \"qw( date_due title barcode author itemnumber )\" /usr/share/koha/bin/cronjobs/overdue_notices.pl").out === '1') }