From 0f3a7074cb7be32ab059226675455042c3706dec 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 Signed-off-by: Tomas Cohen Arazi --- 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 05b98dbbe9..108aaf41d1 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -108,6 +108,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 3b8eb35bfe..56de788a6a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -139,9 +139,17 @@ [% ELSIF ( CHUNK.type_modaljs ) %] [% 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 83157917b6..b9c4414ac1 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 @@ -1286,10 +1286,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: @@ -1305,6 +1309,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.39.5