From 093b71a09e28076a853ae8b1fd8c0a0593bba36e Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Mon, 6 Jan 2025 16:23:10 +0100 Subject: [PATCH] Bug 38776: (QA follow-up) UI improvement + category renamed - The authorised value category was renamed from "R_COMMENTS" to a more explicit value : "RESTRICTION_COMMENTS" - It is now easier in the patron detail page to either select one of the defined value or to fill in a custom value (select "other" then type your comment). --- installer/data/mysql/atomicupdate/bug_38776.pl | 13 +++++++++++++ .../prog/en/includes/patron-restrictions-tab.inc | 14 ++++++++------ .../prog/en/modules/admin/authorised_values.tt | 2 +- .../prog/en/modules/members/moremember.tt | 1 + .../intranet-tmpl/prog/js/patron-restrictions.js | 14 ++++++++++++++ 5 files changed, 37 insertions(+), 7 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_38776.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/js/patron-restrictions.js diff --git a/installer/data/mysql/atomicupdate/bug_38776.pl b/installer/data/mysql/atomicupdate/bug_38776.pl new file mode 100755 index 00000000000..33693880d7c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_38776.pl @@ -0,0 +1,13 @@ +use Modern::Perl; + +return { + bug_number => "BUG_38776", + description => "Add RESTRICTION_COMMENTS authorised_value category", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do(q{INSERT INTO authorised_value_categories VALUES ('RESTRICTION_COMMENTS',0,0);}); + say $out "Added 'RESTRICTION_COMMENTS' authorised_values category"; + }, +}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc index aadf9f5bebe..93ed35c104e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc @@ -82,13 +82,15 @@ [% END %]
  • - - - [% FOREACH rcomment IN AuthorisedValues.Get( 'R_COMMENTS' ) %] - + + + + +
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index 9dd5f46a4bb..6acd1391b27 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -543,7 +543,7 @@

    Can be used to further sort and filter your reports. This category is empty by default. Values here need to include the authorized value code from REPORT_GROUP in the Description (OPAC) field to link the subgroup to the appropriate group.

    [% CASE 'RESTRICTED' %]

    Restricted status of an item

    - [% CASE 'R_COMMENTS' %] + [% CASE 'RESTRICTION_COMMENTS' %]

    Values for custom patron restriction comments to pre-fill the manual restrictions. The value in the description field should be the message text and is limited to 200 characters

    [% CASE 'ROADTYPE' %]

    Road types to be used in patron addresses

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index a12b9e3a504..8b8fdccd511 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -840,6 +840,7 @@ [% Asset.js("js/checkouts.js") | $raw %] [% Asset.js("js/tables/bookings.js") | $raw %] + [% Asset.js("js/patron-restrictions.js") | $raw %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-restrictions.js b/koha-tmpl/intranet-tmpl/prog/js/patron-restrictions.js new file mode 100644 index 00000000000..9d2f5085831 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/patron-restrictions.js @@ -0,0 +1,14 @@ +$(document).ready(function(){ + $("#other_reason").on('change', function(){ + $("#rcomment").val($(this).val()); + }); + $("select#restriction-reason").on('change', function(){ + if($(this).val() == "other"){ + $("#other_reason").show(); + $("#rcomment").val(''); + return; + } + $("#other_reason").hide(); + $("#rcomment").val($(this).val()); + }) +}); -- 2.39.5