From 6d62f77e95f1136be04e037ec12dff95874a7ee3 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 3 May 2022 16:38:37 +0100 Subject: [PATCH] Bug 23681: (QA follow-up) Restore customisablity of description This patch restores the customisability of description for system restriction types. Translatability is not affected as you can translate the defaults via template translation and assuming the end users leave their descriptions at the default, the translations will be picked. Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- admin/restrictions.pl | 2 +- .../data/mysql/en/mandatory/patron_restrictions.yml | 4 ++-- .../prog/en/includes/borrower_debarments.inc | 12 +++--------- .../prog/en/includes/patron_restrictions.inc | 10 ++++++++++ .../prog/en/modules/admin/restrictions.tt | 13 +++++++------ 5 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron_restrictions.inc diff --git a/admin/restrictions.pl b/admin/restrictions.pl index d3449269a5..b41fd3f6cd 100755 --- a/admin/restrictions.pl +++ b/admin/restrictions.pl @@ -67,8 +67,8 @@ if ( $op eq 'add_form') { }; } else { my $restriction = Koha::RestrictionTypes->find($code); + $restriction->display_text($display_text); unless ($restriction->is_system) { - $restriction->display_text($display_text); $restriction->can_be_added_manually($can_be_added_manually); } $restriction->store; diff --git a/installer/data/mysql/en/mandatory/patron_restrictions.yml b/installer/data/mysql/en/mandatory/patron_restrictions.yml index c0aeb7a396..26216504bd 100644 --- a/installer/data/mysql/en/mandatory/patron_restrictions.yml +++ b/installer/data/mysql/en/mandatory/patron_restrictions.yml @@ -22,7 +22,7 @@ description: tables: - debarment_types: - translatable: [ display_text ] + translatable: [] multiline: [] rows: - code: "MANUAL" @@ -47,4 +47,4 @@ tables: display_text: "Discharge" is_system: 1 default: 0 - can_be_added_manually: 0 \ No newline at end of file + can_be_added_manually: 0 diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc index b489c64123..e5ff9639dc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc @@ -1,5 +1,6 @@ [% USE raw %] [% USE Koha %] +[% PROCESS 'patron_restrictions.inc' %]
[% IF ( not debarments.defined || debarments.size < 1 ) %]

Patron is currently unrestricted.

@@ -21,14 +22,7 @@ [% dtype = d.type %] - [% ddisplay = restriction_types.$dtype.display_text %] - [% SWITCH ddisplay %] - [% CASE 'Manual' %]Manual - [% CASE 'Overdues' %]Overdues - [% CASE 'Suspension' %]Suspension - [% CASE 'Discharge' %]Discharge - [% CASE %][% ddisplay | html %] - [% END %] + [% PROCESS restriction_type_description restriction=restriction_types.$dtype %] [% IF d.comment.search('OVERDUES_PROCESS') %] @@ -65,7 +59,7 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_restrictions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_restrictions.inc new file mode 100644 index 0000000000..3d0afd5fc1 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_restrictions.inc @@ -0,0 +1,10 @@ +[%- BLOCK restriction_type_description -%] + [% ddisplay = restriction.display_text %] + [% SWITCH ddisplay %] + [% CASE 'Manual' %]Manual + [% CASE 'Overdues' %]Overdues + [% CASE 'Suspension' %]Suspension + [% CASE 'Discharge' %]Discharge + [% CASE %][% ddisplay | html %] + [% END %] +[%- END -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt index 82dcc485d7..4b9767e46e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt @@ -1,10 +1,11 @@ [% USE raw %] [% USE Asset %] [% USE Koha %] +[% PROCESS 'patron_restrictions.inc' %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] -[% IF op == 'add_form' %][% IF ( restriction ) %]Modify restriction '[% restriction.display_text | html %]'[% ELSE %]New restriction[% END %][% END %] -[% IF op == 'delete_confirm' %]Confirm deletion of restriction '[% restriction.display_text | html %]'[% END %] › Patron restrictions › Administration › Koha +<title>[% IF op == 'add_form' %][% IF ( restriction ) %]Modify restriction '[% PROCESS restriction_type_description %]'[% ELSE %]New restriction[% END %][% END %] +[% IF op == 'delete_confirm' %]Confirm deletion of restriction '[% PROCESS restriction_type_description %]'[% END %] › Patron restrictions › Administration › Koha [% INCLUDE 'doc-head-close.inc' %] @@ -37,7 +38,7 @@ [% IF restriction %]
  • - Modify restriction '[% restriction.display_text | html %]' + Modify restriction '[% PROCESS restriction_type_description %]'
  • [% ELSE %] @@ -85,7 +86,7 @@ [% IF restriction %] -

    Modify restriction [% restriction.display_text | html %]

    +

    Modify restriction [% PROCESS restriction_type_description %]

    [% ELSE %]

    New restriction

    @@ -151,7 +152,7 @@ Confirm restriction deletion -

    Are you sure you want to delete "[% restriction.display_text | html %]"

    +

    Are you sure you want to delete "[% PROCESS restriction_type_description %]"

    @@ -191,7 +192,7 @@ [% restriction.code | html %] - [% restriction.display_text | html %] + [% PROCESS restriction_type_description %] [% IF restriction.can_be_added_manually %]Yes[% END %] -- 2.39.5