From cb9c3a13644b00c021a2907e9b3554225e8a6415 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 Signed-off-by: Benjamin Veasey Sponsored-by: Loughborough University --- .../intranet-tmpl/prog/en/includes/borrower_debarments.inc | 11 +++++++++++ .../intranet-tmpl/prog/en/modules/members/memberentrygen.tt | 10 ++++++++++ members/memberentry.pl | 4 ++-- members/mod_debarment.pl | 3 ++- 4 files changed, 25 insertions(+), 3 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 9dde40aa7d..1edec9ca19 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. Clear date
  4. 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 c650cd2ef2..6f8234289e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1044,6 +1044,16 @@ Add manual restriction
      + [% IF Koha.Preference('PatronRestrictionTypes') %] +
    1. + + +
    2. + [% END %]
    3. Clear date
    4. diff --git a/members/memberentry.pl b/members/memberentry.pl index 3415bc50d9..16d895f17a 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -139,7 +139,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, } @@ -236,7 +236,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_expiration$/, qr/^remove_debarment$/, # We already dealt with debarments previously + qr/^add_debarment$/, 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 bc155e54a3..03889351d5 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, } -- 2.11.0