1 of 22

TINKERING

WITH

TEMPLATES

Creating Report-Driven Tools and Interfaces

koha-US Conference ★ Round Rock, Texas ★ August 14, 2024

Jason Robb - Southeast Kansas Library System

2 of 22

OBLIGATORY KANSAS KOHA MAP SLIDE

Northwest

Southwest

Central

South Central

Southeast

Northeast

North

Central

NorCat

State Library Cards

3 of 22

Add ability to render a report using a notice template

4 of 22

01 - SQL

02 - TEMPLATE

03 - UI/UX CONSIDERATIONS

COMPONENTS

5 of 22

    • The mail merge analogy:
      • Each column heading represents a field reference
      • Each row of data represents one “letter”

SQL

6 of 22

[% FOREACH b IN data %]

<div> [% b.stuff %] and [% b.junk %] </div>

[% END %]

    • Tools > Notices and slips > New notice
      • Koha module: Reports
      • Template toolkit goes in the Print section
    • SQL results are in the data object
    • Access via a FOREACH loop
    • Pull data using column headings from the report

TEMPLATES

7 of 22

[% FOREACH b IN data %]

<div> [% b.stuff %] and [% b.junk %] <div>

[% END %]

F Roberts and 35323000108980

Pbk F Silver and 35331000000164

F Roberts and 35318000011727

J523.8 Thompson and 35328000000012

SQL + TEMPLATES =

8 of 22

1

    • Running reports is fun and all, but...
    • Playing click golf

2

3

4

5

6

7

8

9

10

11

12

UI/UX CONSIDERATIONS

9 of 22

PROJECT #1:

Printable insert for kits

10 of 22

SELECT i.itemcallnumber, b.title, bi.pages, CONCAT(

'<img src="/cgi-bin/koha/svc/barcode?barcode=',

CONCAT('A', i.barcode, 'A'),

'&type=NW7&notext=1',

'"></img>') AS bcodepic, i.barcode as bcodetext

FROM items i

LEFT JOIN biblio b USING (biblionumber)

LEFT JOIN biblioitems bi USING (biblionumber)

WHERE i.barcode = <<Barcode>>

SQL

PROJECT #1:

Printable insert for kits

11 of 22

Template

PROJECT #1:

Printable insert for kits

12 of 22

    • Added button to quickly go from the record to printing the sheet for that item

UI/UX

PROJECT #1:

Printable insert for kits

    • Print button formats to only print page (extra JS)
    • Displayed content can be edited before printing

13 of 22

PROJECT #2:

Print overdue notices

14 of 22

Code

PROJECT #2:

Print overdue notices

15 of 22

UI/UX

PROJECT #2:

Print overdue notices

    • Complete checkout list, grouped by when notified then sorted by call number
    • Ability to print a single notice or exclude certain notices from batch prints
    • Exclusion of notices where items are no longer checked out
    • Print a batch at once, one notice per page
    • Unlock and lock in-line editing
    • Controls on Circ home go directly to results

    • “Today” includes Sunday if its Monday

16 of 22

PROJECT #3:

Stats infographic/dashboard

17 of 22

Code

PROJECT #3:

Stats infographic/dashboard(this is more of a proof of concept, definitely needs more work)

18 of 22

Highlights

PROJECT #3:

Stats infographic/dashboard

Font Awesome icons

Contextual info

Charting with Charts.css

(open source CSS framework)

Cover image via Amazon

19 of 22

Display shelf poster

PROJECT #4:

?

20 of 22

Staff picks

PROJECT #5:

21 of 22

QUESTIONS

Jason Robb - SEKnFind Coordinator - SEKLS

    • Email: jrobb@sekls.org
    • Mattermost: jrobb
    • Slack: Jason - SEKLS

22 of 22

RESOURCES

Jason Robb - SEKnFind Coordinator - SEKLS

    • Email: jrobb@sekls.org
    • Mattermost: jrobb
    • Slack: Jason - SEKLS