From 15809094775d00d886617202836908943359ae4d 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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). Signed-off-by: Emmanuel Bétemps --- installer/data/mysql/atomicupdate/bug_38776.pl | 13 +++++++++++++ .../prog/en/includes/patron-restrictions-tab.inc | 12 +++++++----- .../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, 36 insertions(+), 6 deletions(-) create mode 100644 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 100644 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 d7e527ee2b0..6f7bcb90f3f 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 f67d9570427..f7e0c3eccef 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 @@ -545,7 +545,7 @@ > [% 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 f0d61473a73..7b95ab24544 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -847,6 +847,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..7246eab02c1 --- /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.34.1