From a8448041ba32ae4a1624a611ea12bf615f851524 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Thu, 3 Oct 2019 15:13:27 +0100 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../prog/en/includes/borrower_debarments.inc | 11 +++++++++++ .../prog/en/modules/members/memberentrygen.tt | 10 ++++++++++ members/memberentry.pl | 4 ++-- members/mod_debarment.pl | 3 ++- members/moremember.pl | 2 +- 5 files changed, 26 insertions(+), 4 deletions(-) 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 dbc1273f88..126979c74b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc @@ -1,4 +1,5 @@ [% USE raw %] +[% USE Koha %]
[% IF ( not debarments.defined || debarments.size < 1 ) %]

Patron is currently unrestricted.

@@ -51,6 +52,16 @@
Add manual restriction
    + [% IF Koha.Preference('PatronRestrictionTypes') %] +
  1. + + +
  2. + [% END %]
  3. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 5d304031dc..ade7a102bc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1397,6 +1397,16 @@ legend:hover { Add manual restriction
      + [% IF Koha.Preference('PatronRestrictionTypes') %] +
    1. + + +
    2. + [% END %]
    3. diff --git a/members/memberentry.pl b/members/memberentry.pl index 765534246f..f5b00fe5b7 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -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_/, diff --git a/members/mod_debarment.pl b/members/mod_debarment.pl index 977cb2fddd..e9a99eec8c 100755 --- a/members/mod_debarment.pl +++ b/members/mod_debarment.pl @@ -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, } diff --git a/members/moremember.pl b/members/moremember.pl index 478b8e0b67..e966647a54 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -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( -- 2.39.5