Bug 32986 - Add ability to generate custom slips for patrons
Summary: Add ability to generate custom slips for patrons
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Nick Clemens
QA Contact: Katrin Fischer
URL:
Keywords:
: 21920 23041 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-02-16 19:52 UTC by Nick Clemens
Modified: 2023-12-29 17:04 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/803
Text to go in the release notes:
This feature makes it possible to create custom slips that will appear in the 'Print' menu in the patron's user account in staff. For this purpose a new module was added to the pull down in the notices and slips tool: 'Patrons (custom slip)'.
Version(s) released in:
23.11.00


Attachments
Bug 32986: Add patron_slip module to letters and allow printing on members account (14.56 KB, patch)
2023-02-16 19:57 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: Add patron_slip module to letters and allow printing on members account (14.60 KB, patch)
2023-03-16 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: (follow-up) Restore styling for print button (2.73 KB, patch)
2023-03-17 15:05 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: Add patron_slip module to letters and allow printing on members account (15.47 KB, patch)
2023-03-17 15:42 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: Add patron_slip module to letters and allow printing on members account (15.53 KB, patch)
2023-03-17 16:06 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 32986: Add patron_slip module to letters and allow printing on members account (15.53 KB, patch)
2023-04-11 21:38 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: (QA follow-up) Fix QA script complaints: tabs and TT filters (4.92 KB, patch)
2023-04-11 21:38 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: Add patron_slip module to letters and allow printing on members account (15.53 KB, patch)
2023-07-14 12:56 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: (QA follow-up) Fix QA script complaints: tabs and TT filters (5.24 KB, patch)
2023-07-14 12:56 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: (follow-up) Tidy conditional in letter.pl (3.69 KB, patch)
2023-07-14 12:56 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: (follow-up) POD (1.17 KB, patch)
2023-07-14 12:56 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: (follow-up) Fix CircAutoPrintQuickSlip and remove unecessary module usage (1.63 KB, patch)
2023-10-10 16:17 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32986: Add patron_slip module to letters and allow printing on members account (15.44 KB, patch)
2023-11-04 22:57 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: (QA follow-up) Fix QA script complaints: tabs and TT filters (4.19 KB, patch)
2023-11-04 22:57 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: (follow-up) Tidy conditional in letter.pl (3.75 KB, patch)
2023-11-04 22:57 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: (follow-up) POD (1.22 KB, patch)
2023-11-04 22:58 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: (follow-up) Fix CircAutoPrintQuickSlip and remove unecessary module usage (1.69 KB, patch)
2023-11-04 22:58 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: (QA follow-up) Rename notices module (3.65 KB, patch)
2023-11-04 22:58 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: (QA follow-up) Remove 'slip' from print dialog (1.53 KB, patch)
2023-11-04 22:58 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32986: (follow-up) Unit tests (2.54 KB, patch)
2023-11-06 14:08 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2023-02-16 19:52:17 UTC
Some libraries would like to be able to provide custom information to a patron, while still using traditional slips - we should be able to add custom slips for printing form a patron's account
Comment 1 Nick Clemens 2023-02-16 19:57:15 UTC
Created attachment 146750 [details] [review]
Bug 32986: Add patron_slip module to letters and allow printing on members account

This patch adds a new module to letters 'patron_slip' / Patrons toolbar
(slip)

This also combines some of the slip printing JS to make things more
direct

To test:
1 - Apply patch
2 - Confirm you can print slip, summary, quickslip, and checkin slip
  when viewing a patron's account
3 - Enable  DisplayClearScreenButton syspref, and test that it works
  with both values
4 - Go to Tools->Notices and slips
5 - Define a new notice in the 'Patron toolbar (slip)' module
6 - Enter content like below in the 'Print' transport:
Patron has [% borrower.holds.count %] holds

List of holds:
[% FOREACH hold IN borrower.holds %]
===============================
    Reserve id: [% hold.reserve_id %]
    Title [% hold.biblio.title %]
[% END %]
7 - Go to patron scree
8 - Note new option under 'Print'
9 - Print the new slip and confirm it works (try with and without
  placing holds for patron
Comment 2 Andrew Fuerste-Henry 2023-03-02 17:41:50 UTC
I cleared a merge error to get this to apply. I'm not sure if the issues I ran into were due to me not clearing the error properly or if they're inherent to the patch. In my testing, with the patch applied, the checkin slip always gives an error of "no template defined" and the clear screen and print buttons aren't in the right place after enabling DisplayClearScreenButton.
Comment 3 Nick Clemens 2023-03-16 13:45:27 UTC
Created attachment 148267 [details] [review]
Bug 32986: Add patron_slip module to letters and allow printing on members account

This patch adds a new module to letters 'patron_slip' / Patrons toolbar
(slip)

This also combines some of the slip printing JS to make things more
direct

To test:
1 - Apply patch
2 - Confirm you can print slip, summary, quickslip, and checkin slip
  when viewing a patron's account
3 - Enable  DisplayClearScreenButton syspref, and test that it works
  with both values
4 - Go to Tools->Notices and slips
5 - Define a new notice in the 'Patron toolbar (slip)' module
6 - Enter content like below in the 'Print' transport:
Patron has [% borrower.holds.count %] holds

List of holds:
[% FOREACH hold IN borrower.holds %]
===============================
    Reserve id: [% hold.reserve_id %]
    Title [% hold.biblio.title %]
[% END %]
7 - Go to patron scree
8 - Note new option under 'Print'
9 - Print the new slip and confirm it works (try with and without
  placing holds for patron
Comment 4 Andrew Fuerste-Henry 2023-03-17 14:15:23 UTC
(In reply to Andrew Fuerste-Henry from comment #2)
> I cleared a merge error to get this to apply. I'm not sure if the issues I
> ran into were due to me not clearing the error properly or if they're
> inherent to the patch. In my testing, with the patch applied, the checkin
> slip always gives an error of "no template defined" and the clear screen and
> print buttons aren't in the right place after enabling
> DisplayClearScreenButton.

Thanks for clearing the merge error! These things are both still true. The Checkin slip always says "No template defined" and the printer icon for DisplayClearScreenButton has jumped to the left side of the checkout box.
Comment 5 Nick Clemens 2023-03-17 15:05:55 UTC
Created attachment 148361 [details] [review]
Bug 32986: (follow-up) Restore styling for print button

To test:
Apply
yarn build
COnfirm display of printer icon is restored
Comment 6 Nick Clemens 2023-03-17 15:42:54 UTC
Created attachment 148374 [details] [review]
Bug 32986: Add patron_slip module to letters and allow printing on members account

This patch adds a new module to letters 'patron_slip' / Patrons toolbar
(slip)

This also combines some of the slip printing JS to make things more
direct

To test:
1 - Apply patch
2 - restart_all
3 - yarn build
4 - Confirm you can print slip, summary, quickslip, and checkin slip
  when viewing a patron's account
5 - Enable  DisplayClearScreenButton syspref, and test that it works
  with both values
6 - Go to Tools->Notices and slips
7 - Define a new notice in the 'Patron toolbar (slip)' module
8 - Enter content like below in the 'Print' transport:
Patron has [% borrower.holds.count %] holds

List of holds:
[% FOREACH hold IN borrower.holds %]
===============================
    Reserve id: [% hold.reserve_id %]
    Title [% hold.biblio.title %]
[% END %]
9 - Go to patron scree
10 - Note new option under 'Print'
11 - Print the new slip and confirm it works (try with and without
  placing holds for patron
Comment 7 ByWater Sandboxes 2023-03-17 16:06:15 UTC
Created attachment 148376 [details] [review]
Bug 32986: Add patron_slip module to letters and allow printing on members account

This patch adds a new module to letters 'patron_slip' / Patrons toolbar
(slip)

This also combines some of the slip printing JS to make things more
direct

To test:
1 - Apply patch
2 - restart_all
3 - yarn build
4 - Confirm you can print slip, summary, quickslip, and checkin slip
  when viewing a patron's account
5 - Enable  DisplayClearScreenButton syspref, and test that it works
  with both values
6 - Go to Tools->Notices and slips
7 - Define a new notice in the 'Patron toolbar (slip)' module
8 - Enter content like below in the 'Print' transport:
Patron has [% borrower.holds.count %] holds

List of holds:
[% FOREACH hold IN borrower.holds %]
===============================
    Reserve id: [% hold.reserve_id %]
    Title [% hold.biblio.title %]
[% END %]
9 - Go to patron scree
10 - Note new option under 'Print'
11 - Print the new slip and confirm it works (try with and without
  placing holds for patron

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 8 Katrin Fischer 2023-04-10 21:32:40 UTC
Starting here:

1) QA test tools:

Ohoh!

FAIL	Koha/Template/Plugin/Notices.pm
   FAIL	  pod coverage
		POD coverage was greater before, try perl -MPod::Coverage=PackageName -e666

 OK	koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
 FAIL	koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
   FAIL	  filters
		missing_filter at line 36 (                     <li><a class="printslip" data-code="[% notice.code %]" href="#">Print [% notice.name %] slip</a></li>)
		missing_filter at line 36 (                     <li><a class="printslip" data-code="[% notice.code %]" href="#">Print [% notice.name %] slip</a></li>)
   FAIL	  forbidden patterns
		forbidden pattern: tab char (line 35)
		forbidden pattern: tab char (line 37)

 OK	koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
   FAIL	  forbidden patterns
		forbidden pattern: tab char (line 236)

 OK	koha-tmpl/intranet-tmpl/prog/js/members-menu.js
 FAIL	members/printslip.pl
   FAIL	  forbidden patterns
		forbidden pattern: tab char (line 101)
		forbidden pattern: tab char (line 102)
		forbidden pattern: tab char (line 103)
		forbidden pattern: tab char (line 104)
		forbidden pattern: tab char (line 105)
		forbidden pattern: tab char (line 106)


Not finished with testing yet, but follow-ups welcome :)
Comment 9 Katrin Fischer 2023-04-11 21:38:56 UTC
Created attachment 149506 [details] [review]
Bug 32986: Add patron_slip module to letters and allow printing on members account

This patch adds a new module to letters 'patron_slip' / Patrons toolbar
(slip)

This also combines some of the slip printing JS to make things more
direct

To test:
1 - Apply patch
2 - restart_all
3 - yarn build
4 - Confirm you can print slip, summary, quickslip, and checkin slip
  when viewing a patron's account
5 - Enable  DisplayClearScreenButton syspref, and test that it works
  with both values
6 - Go to Tools->Notices and slips
7 - Define a new notice in the 'Patron toolbar (slip)' module
8 - Enter content like below in the 'Print' transport:
Patron has [% borrower.holds.count %] holds

List of holds:
[% FOREACH hold IN borrower.holds %]
===============================
    Reserve id: [% hold.reserve_id %]
    Title [% hold.biblio.title %]
[% END %]
9 - Go to patron scree
10 - Note new option under 'Print'
11 - Print the new slip and confirm it works (try with and without
  placing holds for patron

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 10 Katrin Fischer 2023-04-11 21:38:59 UTC
Created attachment 149507 [details] [review]
Bug 32986: (QA follow-up) Fix QA script complaints: tabs and TT filters

* Perltidied the section with tabs in printslip.pl
* Fixed indentation and tabs in letter.tt
* Added missing TT filters to members-toolbar.inc
Comment 11 Katrin Fischer 2023-04-11 21:39:35 UTC
Still not finished here, but I have fixed the QA script complaints :)
Comment 12 Marcel de Rooy 2023-05-04 14:04:18 UTC
Not sure whats going on, but clicking these Print buttons or options does actually do totally nothing..
Comment 13 Nick Clemens 2023-05-04 14:34:27 UTC
(In reply to Marcel de Rooy from comment #12)
> Not sure whats going on, but clicking these Print buttons or options does
> actually do totally nothing..

All working for me, ensure you hard refresh the browser so that the JS reloads - I saw your issue before I did that
Comment 14 Marcel de Rooy 2023-07-14 07:23:48 UTC
Applying: Bug 32986: (QA follow-up) Fix QA script complaints: tabs and TT filters
error: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc).
error: could not build fake ancestor
Comment 15 Nick Clemens 2023-07-14 12:56:02 UTC
Created attachment 153479 [details] [review]
Bug 32986: Add patron_slip module to letters and allow printing on members account

This patch adds a new module to letters 'patron_slip' / Patrons toolbar
(slip)

This also combines some of the slip printing JS to make things more
direct

To test:
1 - Apply patch
2 - restart_all
3 - yarn build
4 - Confirm you can print slip, summary, quickslip, and checkin slip
  when viewing a patron's account
5 - Enable  DisplayClearScreenButton syspref, and test that it works
  with both values
6 - Go to Tools->Notices and slips
7 - Define a new notice in the 'Patron toolbar (slip)' module
8 - Enter content like below in the 'Print' transport:
Patron has [% borrower.holds.count %] holds

List of holds:
[% FOREACH hold IN borrower.holds %]
===============================
    Reserve id: [% hold.reserve_id %]
    Title [% hold.biblio.title %]
[% END %]
9 - Go to patron scree
10 - Note new option under 'Print'
11 - Print the new slip and confirm it works (try with and without
  placing holds for patron

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 16 Nick Clemens 2023-07-14 12:56:04 UTC
Created attachment 153480 [details] [review]
Bug 32986: (QA follow-up) Fix QA script complaints: tabs and TT filters

* Perltidied the section with tabs in printslip.pl
* Fixed indentation and tabs in letter.tt
* Added missing TT filters to members-toolbar.inc
Comment 17 Nick Clemens 2023-07-14 12:56:06 UTC
Created attachment 153481 [details] [review]
Bug 32986: (follow-up) Tidy conditional in letter.pl
Comment 18 Nick Clemens 2023-07-14 12:56:09 UTC
Created attachment 153482 [details] [review]
Bug 32986: (follow-up) POD
Comment 19 Jonathan Druart 2023-07-19 07:47:43 UTC
1.
 25 use C4::Koha;
 26 use C4::Context;

in Koha/Template/Plugin/Notices.pm, there are not needed.

2.
-                                                    [% CASE 'members' %]<span>Patrons</span>
+                                                   [% CASE 'members' %]<span>Patrons</span>
+                                                    [% CASE 'patron_slip' %]<span>Patrons toolbar (slip)</span>

3. You removed printx_window but we still have:

koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt:                        return printx_window( '[% CircAutoPrintQuickSlip | html %]' );

4. Not blocker - changes in tools/letter.pl were not needed.


I can follow-up later this week but cannot right now.
Comment 20 Katrin Fischer 2023-10-08 10:31:43 UTC
*** Bug 23041 has been marked as a duplicate of this bug. ***
Comment 21 Katrin Fischer 2023-10-08 10:32:51 UTC
*** Bug 21920 has been marked as a duplicate of this bug. ***
Comment 22 Nick Clemens 2023-10-10 16:17:05 UTC
Created attachment 156800 [details] [review]
Bug 32986: (follow-up) Fix CircAutoPrintQuickSlip and remove unecessary module usage
Comment 23 Nick Clemens 2023-10-10 16:19:44 UTC
(In reply to Jonathan Druart from comment #19)
> 1.
>  25 use C4::Koha;
>  26 use C4::Context;
> 
> in Koha/Template/Plugin/Notices.pm, there are not needed.

Fixed

> 
> 2.
> -                                                    [% CASE 'members'
> %]<span>Patrons</span>
> +                                                   [% CASE 'members'
> %]<span>Patrons</span>
> +                                                    [% CASE 'patron_slip'
> %]<span>Patrons toolbar (slip)</span>
>

Already tidied in the patchset
 
> 3. You removed printx_window but we still have:
> 
> koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt:                
> return printx_window( '[% CircAutoPrintQuickSlip | html %]' );

Fixed 

> 
> 4. Not blocker - changes in tools/letter.pl were not needed.

I add a condition in the first patch - tidied the whole block for consistency


> I can follow-up later this week but cannot right now.

Thanks for looking!
Comment 24 Katrin Fischer 2023-11-04 22:57:51 UTC
Created attachment 158399 [details] [review]
Bug 32986: Add patron_slip module to letters and allow printing on members account

This patch adds a new module to letters 'patron_slip' / Patrons toolbar
(slip)

This also combines some of the slip printing JS to make things more
direct

To test:
1 - Apply patch
2 - restart_all
3 - yarn build
4 - Confirm you can print slip, summary, quickslip, and checkin slip
  when viewing a patron's account
5 - Enable  DisplayClearScreenButton syspref, and test that it works
  with both values
6 - Go to Tools->Notices and slips
7 - Define a new notice in the 'Patron toolbar (slip)' module
8 - Enter content like below in the 'Print' transport:
Patron has [% borrower.holds.count %] holds

List of holds:
[% FOREACH hold IN borrower.holds %]
===============================
    Reserve id: [% hold.reserve_id %]
    Title [% hold.biblio.title %]
[% END %]
9 - Go to patron scree
10 - Note new option under 'Print'
11 - Print the new slip and confirm it works (try with and without
  placing holds for patron

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 25 Katrin Fischer 2023-11-04 22:57:54 UTC
Created attachment 158400 [details] [review]
Bug 32986: (QA follow-up) Fix QA script complaints: tabs and TT filters

* Perltidied the section with tabs in printslip.pl
* Fixed indentation and tabs in letter.tt
* Added missing TT filters to members-toolbar.inc

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 26 Katrin Fischer 2023-11-04 22:57:57 UTC
Created attachment 158401 [details] [review]
Bug 32986: (follow-up) Tidy conditional in letter.pl

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 27 Katrin Fischer 2023-11-04 22:58:00 UTC
Created attachment 158402 [details] [review]
Bug 32986: (follow-up) POD

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 28 Katrin Fischer 2023-11-04 22:58:03 UTC
Created attachment 158403 [details] [review]
Bug 32986: (follow-up) Fix CircAutoPrintQuickSlip and remove unecessary module usage

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 29 Katrin Fischer 2023-11-04 22:58:06 UTC
Created attachment 158404 [details] [review]
Bug 32986: (QA follow-up) Rename notices module

This renames the notices and slips module from
Patrons toolbar (slip) to Patrons (custom slip)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 30 Katrin Fischer 2023-11-04 22:58:10 UTC
Created attachment 158405 [details] [review]
Bug 32986: (QA follow-up) Remove 'slip' from print dialog

This makes it more flexible and the slip can be added to the
notice name easily.

For example: In German the slip would usually be part of the word, not separate:
Gebührenquittung (slip = quittung)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 31 Katrin Fischer 2023-11-04 22:58:55 UTC
I think this would make a great addition and is low risk, but: we need some unit tests for the new module.

I am setting the keyword and adding my sign-off lines - please hurry.
Comment 32 Nick Clemens 2023-11-06 14:08:45 UTC
Created attachment 158523 [details] [review]
Bug 32986: (follow-up) Unit tests
Comment 33 Tomás Cohen Arazi 2023-11-08 21:00:32 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 34 Fridolin Somers 2023-11-11 07:11:36 UTC
Enhancement not pushed to 23.05.x
Comment 35 Caroline Cyr La Rose 2023-12-22 15:51:51 UTC
This is a very cool feature! Thanks everyone.