Bug 38222

Summary: Let staff pick a cancellation reason when canceling a booking
Product: Koha Reporter: Paul Derscheid <paul.derscheid>
Component: CirculationAssignee: Paul Derscheid <paul.derscheid>
Status: Needs documenting --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, jonathan.druart, kyle.m.hall, lucas, martin.renvoize, simonsen
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: Sponsored
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
This enhancement introduces a combobox component for booking cancellations, allowing users to select from authorized values or enter free text, ensuring consistent input handling and improved user experience across booking management modules.
Version(s) released in:
24.11.00
Circulation function: Bookings
Bug Depends on: 38175, 38193    
Bug Blocks:    
Attachments: Bug 38222: Add combobox component
Bug 38222: Add cancellation reason to bookings patch definition; reformat bookings definition
Bug 38222: Add handling for cancellation reasons to cancel booking modal template, associated script
Bug 38222: Use comboboxes in circ/circulation.pl, bookings/list.pl, members/moremember.pl
Bug 38222: (follow-up) Reset overflow property of modal-body to prevent clipping of combobox options instead of position: fixed
Bug 38222: (follow-up) Include cancellation reason in sample notice for booking cancellation
Bug 38222: (follow-up) Remove residual inline styles from example for combobox usage
Bug 38222: (follow-up) Minimally initialize combobox if passed no data via constructor or referenced elements
Bug 38222: (follow-up) Only replace first numerical match in bookings count containers
Bug 38222: (follow-up) Include cancellation reason in sample notice for booking cancellation
Bug 38222: Add combobox component
Bug 38222: Add cancellation reason to bookings patch definition; reformat bookings definition
Bug 38222: Add handling for cancellation reasons to cancel booking modal template, associated script
Bug 38222: Use comboboxes in circ/circulation.pl, bookings/list.pl, members/moremember.pl
Bug 38222: (follow-up) Reset overflow property of modal-body to prevent clipping of combobox options instead of position: fixed
Bug 38222: (follow-up) Remove residual inline styles from example for combobox usage
Bug 38222: (follow-up) Minimally initialize combobox if passed no data via constructor or referenced elements
Bug 38222: (follow-up) Only replace first numerical match in bookings count containers
Bug 38222: (follow-up) Include cancellation reason in sample notice for booking cancellation
Bug 38222: (QA follow-up) Add av category update
Bug 38222: (QA follow-up) DRY event listener setup for combobox resets on modal close
Bug 38222: (QA follow-up) Show cancellation reason where applicable, appropriately handle statuses
Bug 38222: (QA follow-up) Limit combobox input in cancel booking modal to db field length
Bug 38222: (QA follow-up) DRY event listener setup for combobox resets on modal close
Bug 38222: (QA follow-up) Show cancellation reason where applicable, appropriately handle statuses
Bug 38222: (QA follow-up) Limit combobox input in cancel booking modal to db field length

Description Paul Derscheid 2024-10-22 10:50:48 UTC
This should either be an authorised value or free text.

Applicable to all views that allow booking cancelation.
Comment 1 Paul Derscheid 2024-10-23 16:57:55 UTC
Created attachment 173230 [details] [review]
Bug 38222: Add combobox component

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 2 Paul Derscheid 2024-10-23 16:57:57 UTC
Created attachment 173231 [details] [review]
Bug 38222: Add cancellation reason to bookings patch definition; reformat bookings definition

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 3 Paul Derscheid 2024-10-23 16:57:59 UTC
Created attachment 173232 [details] [review]
Bug 38222: Add handling for cancellation reasons to cancel booking modal template, associated script

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 4 Paul Derscheid 2024-10-23 16:58:01 UTC
Created attachment 173233 [details] [review]
Bug 38222: Use comboboxes in circ/circulation.pl, bookings/list.pl, members/moremember.pl

To test:
1) Apply dependencies and this patch
2) Maybe update class files w/ update_dbix_class_files.pl
3) Build a new bundle w/ yarn api:bundle
4) Restart plack
5) Add a couple bookings to a patron
6) Go to any of the above modules
7) Cancel the booking and note
    7.1) That the value you input is correctly received by the backend for cancellation_reason
    7.2) Do it for the other 2 modules
8) Configure some authorised values under category BOOKING_CANCELLATION
9) Repeat 7 and note that you can select them in the combobox
10) Sign off or leave your feedback

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 5 Paul Derscheid 2024-10-24 11:25:42 UTC
Position: fixed behaves differently in Firefox vs Chrome. In chrome the options of the combobox float around in weird ways.
Comment 6 Paul Derscheid 2024-10-24 12:21:24 UTC
Created attachment 173264 [details] [review]
Bug 38222: (follow-up) Reset overflow property of modal-body to prevent clipping of combobox options instead of position: fixed

Also remove the inlined styles on the unordered list. Bootstrap's dropdown handles all of this.

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 7 Paul Derscheid 2024-10-24 13:00:25 UTC
Created attachment 173265 [details] [review]
Bug 38222: (follow-up) Include cancellation reason in sample notice for booking cancellation

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 8 Paul Derscheid 2024-10-24 13:01:29 UTC
I didn't check how we do this normally, but would it be preferable to write the AV to the db and then use the AuthorisedValues template plugin in the notice instead?
Comment 9 Paul Derscheid 2024-10-24 14:43:50 UTC
Created attachment 173277 [details] [review]
Bug 38222: (follow-up) Remove residual inline styles from example for combobox usage

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 10 Paul Derscheid 2024-10-24 14:43:53 UTC
Created attachment 173278 [details] [review]
Bug 38222: (follow-up) Minimally initialize combobox if passed no data via constructor or referenced elements

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 11 Paul Derscheid 2024-10-24 14:58:41 UTC
Created attachment 173281 [details] [review]
Bug 38222: (follow-up) Only replace first numerical match in bookings count containers

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 12 Biblibre Sandboxes 2024-10-24 15:05:26 UTC
Created attachment 173282 [details] [review]
Bug 38222: (follow-up) Include cancellation reason in sample notice for booking cancellation

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Comment 13 Martin Renvoize (ashimema) 2024-10-25 07:28:24 UTC
Created attachment 173312 [details] [review]
Bug 38222: Add combobox component

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize (ashimema) 2024-10-25 07:28:26 UTC
Created attachment 173313 [details] [review]
Bug 38222: Add cancellation reason to bookings patch definition; reformat bookings definition

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 15 Martin Renvoize (ashimema) 2024-10-25 07:28:29 UTC
Created attachment 173314 [details] [review]
Bug 38222: Add handling for cancellation reasons to cancel booking modal template, associated script

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 16 Martin Renvoize (ashimema) 2024-10-25 07:28:32 UTC
Created attachment 173315 [details] [review]
Bug 38222: Use comboboxes in circ/circulation.pl, bookings/list.pl, members/moremember.pl

To test:
1) Apply dependencies and this patch
2) Maybe update class files w/ update_dbix_class_files.pl
3) Build a new bundle w/ yarn api:bundle
4) Restart plack
5) Add a couple bookings to a patron
6) Go to any of the above modules
7) Cancel the booking and note
    7.1) That the value you input is correctly received by the backend for cancellation_reason
    7.2) Do it for the other 2 modules
8) Configure some authorised values under category BOOKING_CANCELLATION
9) Repeat 7 and note that you can select them in the combobox
10) Sign off or leave your feedback

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 17 Martin Renvoize (ashimema) 2024-10-25 07:28:34 UTC
Created attachment 173316 [details] [review]
Bug 38222: (follow-up) Reset overflow property of modal-body to prevent clipping of combobox options instead of position: fixed

Also remove the inlined styles on the unordered list. Bootstrap's dropdown handles all of this.

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 18 Martin Renvoize (ashimema) 2024-10-25 07:28:37 UTC
Created attachment 173317 [details] [review]
Bug 38222: (follow-up) Remove residual inline styles from example for combobox usage

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 19 Martin Renvoize (ashimema) 2024-10-25 07:28:40 UTC
Created attachment 173318 [details] [review]
Bug 38222: (follow-up) Minimally initialize combobox if passed no data via constructor or referenced elements

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 20 Martin Renvoize (ashimema) 2024-10-25 07:28:43 UTC
Created attachment 173319 [details] [review]
Bug 38222: (follow-up) Only replace first numerical match in bookings count containers

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 21 Martin Renvoize (ashimema) 2024-10-25 07:28:46 UTC
Created attachment 173320 [details] [review]
Bug 38222: (follow-up) Include cancellation reason in sample notice for booking cancellation

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: LEBSimonsen <simonsen@bz-sh.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 22 Martin Renvoize (ashimema) 2024-10-25 07:28:49 UTC
Created attachment 173321 [details] [review]
Bug 38222: (QA follow-up) Add av category update

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 23 Martin Renvoize (ashimema) 2024-10-25 07:36:21 UTC
Discussed with Paul.. we're going to add however text on the cancelled status containing the reason and he's going to move the js snippet that's cloned in a few places into the modal.js asset to dry out the code a little for more re-use :)

Once that's done I reckon we're PQA here :)
Comment 24 Paul Derscheid 2024-10-25 09:05:57 UTC
Created attachment 173322 [details] [review]
Bug 38222: (QA follow-up) DRY event listener setup for combobox resets on modal close

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 25 Paul Derscheid 2024-10-25 09:06:00 UTC
Created attachment 173323 [details] [review]
Bug 38222: (QA follow-up) Show cancellation reason where applicable, appropriately handle statuses

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 26 Paul Derscheid 2024-10-25 10:10:23 UTC
Created attachment 173336 [details] [review]
Bug 38222: (QA follow-up) Limit combobox input in cancel booking modal to db field length

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Comment 27 Martin Renvoize (ashimema) 2024-10-25 10:23:03 UTC
Created attachment 173337 [details] [review]
Bug 38222: (QA follow-up) DRY event listener setup for combobox resets on modal close

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 28 Martin Renvoize (ashimema) 2024-10-25 10:23:06 UTC
Created attachment 173338 [details] [review]
Bug 38222: (QA follow-up) Show cancellation reason where applicable, appropriately handle statuses

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 29 Martin Renvoize (ashimema) 2024-10-25 10:23:09 UTC
Created attachment 173339 [details] [review]
Bug 38222: (QA follow-up) Limit combobox input in cancel booking modal to db field length

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 30 Katrin Fischer 2024-10-25 14:04:03 UTC
Please don't ignore these :)

 FAIL	installer/data/mysql/atomicupdate/bug_38222.pl
   FAIL	  file permissions
		File must have the exec flag

When I git mv the file, I still need to fix it.
Comment 31 Katrin Fischer 2024-10-25 14:19:14 UTC
1) Capitalization (fixed in follow-up)

<label for="cancellation-reason" class="form-label">Cancellation Reason:</label>
= Cancellation reason

2) Translations (fixed in follow-up)

+                                return __("Expired");

Double underscore for JS in .js files.
Single underscore for JS in .tt files (and .inc).

3) combobox.js (to consider)

This almost looks like a library, maybe to avoid any confusion in the future a copyright statement/license would not hurt?
Comment 32 Katrin Fischer 2024-10-25 14:42:29 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 33 Katrin Fischer 2024-11-14 15:32:47 UTC
Dropping keyword.
Comment 34 Lucas Gass (lukeg) 2024-11-18 23:08:48 UTC
Enhancement, no 24.05.x backport
Comment 35 Jonathan Druart 2024-12-04 11:06:08 UTC
No associated dropdown <ul> found for input: cancellation-reason

Nobody sees that in the console?