Bug 23681: Allow for selection of restriction type
This patch displays a restriction type select box (when appropriate) when adding manual patron restrictions Sponsored-by: Loughborough University Signed-off-by: Benjamin Veasey <B.T.Veasey@lboro.ac.uk> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
e0160b905b
commit
a8448041ba
|
|
@ -1,4 +1,5 @@
|
|||
[% USE raw %]
|
||||
[% USE Koha %]
|
||||
<div id="reldebarments">
|
||||
[% IF ( not debarments.defined || debarments.size < 1 ) %]
|
||||
<p>Patron is currently unrestricted.</p>
|
||||
|
|
@ -51,6 +52,16 @@
|
|||
<fieldset class="rows" id="manual_restriction_form">
|
||||
<legend>Add manual restriction</legend>
|
||||
<ol>
|
||||
[% IF Koha.Preference('PatronRestrictionTypes') %]
|
||||
<li>
|
||||
<label for="debarred_type">Type:</label>
|
||||
<select name="debarred_type">
|
||||
[% FOREACH code IN restriction_types.keys %]
|
||||
<option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
[% END %]
|
||||
<li><label for="rcomment">Comment:</label> <input type="text" id="rcomment" name="comment" /></li>
|
||||
<li>
|
||||
<label for="rexpiration">Expiration:</label>
|
||||
|
|
|
|||
|
|
@ -1397,6 +1397,16 @@ legend:hover {
|
|||
<input type="hidden" id="add_debarment" name="add_debarment" value="0" />
|
||||
<legend id="manual_restriction_lgd">Add manual restriction</legend>
|
||||
<ol>
|
||||
[% IF Koha.Preference('PatronRestrictionTypes') %]
|
||||
<li>
|
||||
<label for="debarred_type">Type:</label>
|
||||
<select name="debarred_type">
|
||||
[% FOREACH code IN restriction_types.keys %]
|
||||
<option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="debarred_comment">Comment: </label>
|
||||
<input type="text" id="debarred_comment" name="debarred_comment" />
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ if ( $input->param('add_debarment') ) {
|
|||
AddDebarment(
|
||||
{
|
||||
borrowernumber => $borrowernumber,
|
||||
type => 'MANUAL',
|
||||
type => scalar $input->param('debarred_type') // 'MANUAL',
|
||||
comment => scalar $input->param('debarred_comment'),
|
||||
expiration => $expiration,
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' )
|
|||
qr/^\d+-DAYS/,
|
||||
qr/^patron_attr_/,
|
||||
qr/^csrf_token$/,
|
||||
qr/^add_debarment$/, qr/^debarred_comment$/,qr/^debarred_expiration$/, qr/^remove_debarment$/, # We already dealt with debarments previously
|
||||
qr/^add_debarment$/, qr/^debarred_comment$/,qr/^debarred_expiration$/, qr/^debarred_type$/, qr/^remove_debarment$/, # We already dealt with debarments previously
|
||||
qr/^housebound_chooser$/, qr/^housebound_deliverer$/,
|
||||
qr/^select_city$/,
|
||||
qr/^new_guarantor_/,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ if ( $action eq 'del' ) {
|
|||
DelDebarment( scalar $cgi->param('borrower_debarment_id') );
|
||||
} elsif ( $action eq 'add' ) {
|
||||
my $expiration = $cgi->param('expiration');
|
||||
my $type = $cgi->param('debarred_type') // 'MANUAL';
|
||||
if ($expiration) {
|
||||
$expiration = dt_from_string($expiration);
|
||||
$expiration = $expiration->ymd();
|
||||
|
|
@ -51,7 +52,7 @@ if ( $action eq 'del' ) {
|
|||
|
||||
AddDebarment(
|
||||
{ borrowernumber => $borrowernumber,
|
||||
type => 'MANUAL',
|
||||
type => $type,
|
||||
comment => scalar $cgi->param('comment'),
|
||||
expiration => $expiration,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ for (qw(gonenoaddress lost borrowernotes is_debarred)) {
|
|||
|
||||
$template->param(
|
||||
restriction_types => scalar Koha::RestrictionTypes->keyed_on_code()
|
||||
}
|
||||
);
|
||||
|
||||
if ( $patron->is_debarred ) {
|
||||
$template->param(
|
||||
|
|
|
|||
Loading…
Reference in New Issue