Bugzilla – Attachment 181968 Details for
Bug 39810
Use select2 to select library limitations in credit and debit type administration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39810: Use select2 to select library limitations in credit and debit type administration
Bug-39810-Use-select2-to-select-library-limitation.patch (text/plain), 5.68 KB, created by
Owen Leonard
on 2025-05-06 12:45:54 UTC
(
hide
)
Description:
Bug 39810: Use select2 to select library limitations in credit and debit type administration
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-05-06 12:45:54 UTC
Size:
5.68 KB
patch
obsolete
>From 7b871454b113172932022311f1e345f53924fa0a Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 1 May 2025 18:59:33 +0000 >Subject: [PATCH] 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 >--- > .../prog/en/modules/admin/credit_types.tt | 11 +++++++---- > .../prog/en/modules/admin/debit_types.tt | 10 +++++++--- > 2 files changed, 14 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt >index c74933db752..2e7ddf500cc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt >@@ -124,12 +124,11 @@ > <span class="hint">Enable automatic generation of credit number (see <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreditNumber">AutoCreditNumber</a>)</span> > </li> > <li> >- <label for="branches">Libraries limitation: </label> >+ <label for="library_limitation">Libraries limitation: </label> > [% IF credit_type && credit_type.is_system %] > <span>No library limitation</span> > [% ELSE %] >- <select id="branches" name="branches" multiple size="10"> >- <option value="">All libraries</option> >+ <select id="library_limitation" name="branches" multiple size="10"> > [% FOREACH branch IN branches_loop %] > [% IF ( branch.selected ) %] > <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option> >@@ -138,7 +137,7 @@ > [% END %] > [% END %] > </select> >- <div class="hint">Select 'All libraries' if this credit type should be available at all libraries. Otherwise select libraries you want to associate credit type with.</div> >+ <div class="hint">Limit the use of this credit type to the selected libraries.</div> > [% END %] > </li> > </ol> >@@ -237,6 +236,7 @@ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/admin-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'select2.inc' %] > <script> > $(document).ready(function () { > var txtActivefilter = _("Filter system credit types"); >@@ -271,6 +271,9 @@ > > //Start filtered > $("#filter_system").click(); >+ >+ $("#library_limitation")[0].style.minWidth = "450px"; >+ $("#library_limitation").select2(); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt >index f6210039d14..e0e38da88e6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt >@@ -131,8 +131,8 @@ > [% END %] > </li> > <li> >- <label for="branches">Libraries limitation: </label> >- <select id="branches" name="branches" multiple size="10"> >+ <label for="library_limitation">Libraries limitation: </label> >+ <select id="library_limitation" name="branches" multiple size="10"> > <option value="">All libraries</option> > [% FOREACH branch IN branches_loop %] > [% IF ( branch.selected ) %] >@@ -142,7 +142,7 @@ > [% END %] > [% END %] > </select> >- <div class="hint">Select 'All libraries' if this debit type should be available at all libraries. Otherwise select libraries you want to associate debit type with.</div> >+ <div class="hint">Limit use of this debit type to the selected libraries.</div> > </li> > </ol> > </fieldset> >@@ -253,6 +253,7 @@ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/admin-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'select2.inc' %] > <script> > $(document).ready(function () { > var txtActivefilter = _("Filter system debit types"); >@@ -287,6 +288,9 @@ > > //Start filtered > $("#filter_system").click(); >+ >+ $("#library_limitation")[0].style.minWidth = "450px"; >+ $("#library_limitation").select2(); > }); > </script> > [% END %] >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39810
:
181968
|
182132
|
182521