Bug 39810

Summary: Use select2 to select library limitations in credit and debit type administration
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: Pushed to main --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: david, jonathan.druart, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39099
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
This improves the selection of the values for the 'Libraries limitation' field when adding and editing: - Debit types - Credit types Instead of selecting multiple values from a dropdown list using the Ctrl key, you can either select or start typing the value, select or press enter, then repeat to select additional values.
Version(s) released in:
25.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 39957    
Attachments: Bug 39810: Use select2 to select library limitations in credit and debit type administration
Bug 39810: Use select2 to select library limitations in credit and debit type administration
Bug 39810: Use select2 to select library limitations in credit and debit type administration

Description Owen Leonard 2025-05-01 18:58:33 UTC
Like Bug 39099.
Comment 1 Owen Leonard 2025-05-06 12:45:54 UTC
Created attachment 181968 [details] [review]
Bug 39810: Use select2 to select library limitations in credit and debit type administration

This patch updates the credit and debit type administration templates so
that library selection uses a Select2-styled menu instead of a standard
<select>. Both pages offer a "library limitation" option, and Select2
will make library selection behave like item search options do.

To test, apply the patch and rebuild the staff interface CSS.

- Go to Administration -> Credit types edit a credit type.
- On the "Library limitation" line, click the field to trigger the
  Select2 menu. Confirm that it works as expected.
- Save your changes to confirm that the data is saved correctly.
- Edit the credit type again to clear all your selections and confirm
  that it saves correctly.
- Repeat the same process on the debit types page.

Sponsored-by: Athens County Public Libraries
Comment 2 David Nind 2025-05-08 22:42:27 UTC
Created attachment 182132 [details] [review]
Bug 39810: Use select2 to select library limitations in credit and debit type administration

This patch updates the credit and debit type administration templates so
that library selection uses a Select2-styled menu instead of a standard
<select>. Both pages offer a "library limitation" option, and Select2
will make library selection behave like item search options do.

To test, apply the patch and rebuild the staff interface CSS.

- Go to Administration -> Credit types edit a credit type.
- On the "Library limitation" line, click the field to trigger the
  Select2 menu. Confirm that it works as expected.
- Save your changes to confirm that the data is saved correctly.
- Edit the credit type again to clear all your selections and confirm
  that it saves correctly.
- Repeat the same process on the debit types page.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Martin Renvoize (ashimema) 2025-05-16 12:13:02 UTC
Created attachment 182521 [details] [review]
Bug 39810: Use select2 to select library limitations in credit and debit type administration

This patch updates the credit and debit type administration templates so
that library selection uses a Select2-styled menu instead of a standard
<select>. Both pages offer a "library limitation" option, and Select2
will make library selection behave like item search options do.

To test, apply the patch and rebuild the staff interface CSS.

- Go to Administration -> Credit types edit a credit type.
- On the "Library limitation" line, click the field to trigger the
  Select2 menu. Confirm that it works as expected.
- Save your changes to confirm that the data is saved correctly.
- Edit the credit type again to clear all your selections and confirm
  that it saves correctly.
- Repeat the same process on the debit types page.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 4 Katrin Fischer 2025-05-16 12:27:16 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 5 Jonathan Druart 2025-05-21 14:03:07 UTC
With ktd sample data:
http://localhost:8081//cgi-bin/koha/admin/debit_types.pl
Uncaught TypeError: $(...)[0] is undefined
Comment 6 Owen Leonard 2025-05-21 15:46:22 UTC
> Uncaught TypeError: $(...)[0] is undefined

See Bug 39957