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 <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2022-05-03 16:38:37 +01:00 committed by Tomas Cohen Arazi
parent 4595a28b29
commit 6d62f77e95
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
5 changed files with 23 additions and 18 deletions

View file

@ -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;

View file

@ -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
can_be_added_manually: 0

View file

@ -1,5 +1,6 @@
[% USE raw %]
[% USE Koha %]
[% PROCESS 'patron_restrictions.inc' %]
<div id="reldebarments">
[% IF ( not debarments.defined || debarments.size < 1 ) %]
<p>Patron is currently unrestricted.</p>
@ -21,14 +22,7 @@
[% dtype = d.type %]
<tr>
<td>
[% 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 %]
</td>
<td>
[% IF d.comment.search('OVERDUES_PROCESS') %]
@ -65,7 +59,7 @@
<select name="debarred_type">
[% FOREACH code IN restriction_types.keys %]
[% IF restriction_types.$code.can_be_added_manually %]
<option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option>
<option value="[% code | html %]">[% PROCESS restriction_type_description restriction=restriction_types.$code %]</option>
[% END %]
[% END %]
</select>

View file

@ -0,0 +1,10 @@
[%- BLOCK restriction_type_description -%]
[% ddisplay = restriction.display_text %]
[% SWITCH ddisplay %]
[% CASE 'Manual' %]<span>Manual</span>
[% CASE 'Overdues' %]<span>Overdues</span>
[% CASE 'Suspension' %]<span>Suspension</span>
[% CASE 'Discharge' %]<span>Discharge</span>
[% CASE %]<span>[% ddisplay | html %]</span>
[% END %]
[%- END -%]

View file

@ -1,10 +1,11 @@
[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% PROCESS 'patron_restrictions.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% 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 %] &rsaquo; Patron restrictions &rsaquo; Administration &rsaquo; 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 %] &rsaquo; Patron restrictions &rsaquo; Administration &rsaquo; Koha
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
@ -37,7 +38,7 @@
[% IF restriction %]
<li>
<a href="#" aria-current="page">
Modify restriction '[% restriction.display_text | html %]'
Modify restriction '[% PROCESS restriction_type_description %]'
</a>
</li>
[% ELSE %]
@ -85,7 +86,7 @@
<input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="checked" value="0" />
[% IF restriction %]
<h1>Modify restriction [% restriction.display_text | html %]</h1>
<h1>Modify restriction [% PROCESS restriction_type_description %]</h1>
<input type="hidden" name="is_a_modif" value="1" />
[% ELSE %]
<h1>New restriction</h1>
@ -151,7 +152,7 @@
Confirm restriction deletion
</legend>
<p>Are you sure you want to delete &quot;[% restriction.display_text | html %]&quot;</p>
<p>Are you sure you want to delete &quot;[% PROCESS restriction_type_description %]&quot;</p>
<fieldset class="action">
<input type="hidden" name="op" value="delete_confirmed" />
@ -191,7 +192,7 @@
[% restriction.code | html %]
</td>
<td>
[% restriction.display_text | html %]
[% PROCESS restriction_type_description %]
</td>
<td>
[% IF restriction.can_be_added_manually %]Yes[% END %]