From ed67025d1939006a84acf083a33a3a512c8fc63b Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 10 Jul 2023 13:46:48 +0000 Subject: [PATCH] Bug 31731: Offer user a dropdown of authorized values instead of a text field in preferences This patch updates the system preferences interface so that preferences which ask for a single authorized value can offer a dropdown menu of choices instead of a text field. The patch also updates a few existing preferences to use the new feature: BundleLostValue, BundleNotLoanValue, and ClaimReturnedLostValue. To test, apply the patch and restart services. - Go to Administration -> System preferences and search for "authorized value." - The search results should include the entries for BundleLostValue, BundleNotLoanValue, and ClaimReturnedLostValue. - Confirm that the dropdowns show the correct authorized value category (LOST or NOT_LOAN) - Confirm that setting or unsetting each of the preferences works correctly. Signed-off-by: Sam Lau Signed-off-by: Katrin Fischer --- admin/preferences.pl | 5 +++++ .../prog/en/modules/admin/preferences.tt | 14 +++++++++++--- .../en/modules/admin/preferences/circulation.pref | 6 ++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index 45a5891c62..e43491c1ea 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -102,6 +102,11 @@ sub _get_chunk { } elsif ( $options{choices} eq 'patron-categories' ) { $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search->as_list }; $add_blank = 1; + } elsif ( $options{'choices'} eq 'authval' ){ + if( $options{'source'} ){ + $options{'choices'} = { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search( { category => $options{'source'} } )->as_list }; + $add_blank = 1; + } } else { die 'Unrecognized source of preference values: ' . $options{'choices'}; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt index 1bc1458141..aa93e7e622 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -131,9 +131,17 @@ [% ELSIF ( CHUNK.type_modalselect ) %] [% ELSIF ( CHUNK.type_multiple ) %] - + [% ELSIF ( CHUNK.type_textarea )%] [% IF ( CHUNK.syntax == "text/html" && Koha.Preference('UseWYSIWYGinSystemPreferences') ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index ffe8481869..4a2975f51b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -1285,10 +1285,14 @@ Circulation: - - Use the LOST authorized value - pref: BundleLostValue + choices: authval + source: LOST - to represent 'missing from bundle' at return. - - Use the NOT_LOAN authorized value - pref: BundleNotLoanValue + choices: authval + source: NOT_LOAN - to represent 'added to bundle' when an item is attached to bundle. Return claims: @@ -1304,6 +1308,8 @@ Circulation: - - Use the LOST authorized value - pref: ClaimReturnedLostValue + choices: authval + source: LOST - to represent 'claims returned'. - - Warn librarians that a patron has excessive return claims if the patron has claimed the return of more than -- 2.30.2