From 58e57714061b0e106e0d0b1ae72771566483b0bb Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Tue, 13 Mar 2018 14:57:49 +0000 Subject: [PATCH] Bug 20421: Inform staff that patron does have the title checked out during placing hold Test plan: 1) Enable the CheckPrevCheckout and DisplayMultiPlaceHold system preferences 2) Have a patron with some checkouts history 3) Try to place hold on one of titles from history for this patron 4) You should see an information at the top of confirm request page, but you still should be able to place a hold 5) Try this with multiple titles - one or more of them should be from history 6) You should see this information in "Information" column 7) There is also new column placed at the beggining with checkbox, you could uncheck it for titles you do not want to place a hold on it 8) Confirm the hold is placed only on checked titles Signed-off-by: Martin Renvoize Signed-off-by: Bin Wen Signed-off-by: Katrin Fischer --- .../prog/en/modules/reserve/request.tt | 28 ++++++++++++++++++---- reserve/request.pl | 18 +++++++++++++- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index c33f33f9b0..834a20206f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -94,6 +94,14 @@ [% ELSIF NOT noitems %] +[% IF ( checked_previously && !multi_hold ) %] +
+
    +
  • Patron has previously checked out this title
  • +
+
+[% END %] + [% IF ( exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted ) %]
@@ -445,6 +453,7 @@ + [% UNLESS ( item_level_itypes ) %] @@ -459,15 +468,17 @@ [% END %] + [% END %] + @@ -478,6 +489,9 @@ [% END %]
  TitleItem type
+ [% UNLESS ( biblioloo.warn ) %] + - [% UNLESS ( biblioloo.warn ) %] - - [% ELSE %] + [% IF ( biblioloo.warn ) %] [% END %] [% biblioloo.rank | html %] + [% IF ( biblioloo.checked_previously ) %] + Patron has previously checked out this title
+ [% END %] [% IF ( biblioloo.alreadyres ) %]
    [% ELSE %] @@ -515,7 +529,11 @@ [% ELSIF ( none_available ) %] [% ELSE %] - + [% IF ( multi_hold ) %] + + [% ELSE %] + + [% END %] [% END %] [% END %] @@ -767,7 +785,7 @@ } function checkMultiHold() { - var spans = $(".multi_hold_item"); + var spans = $(".multi_hold_item_checkbox:checked"); if ($(spans).size() == 0) { alert(MSG_NO_ITEMS_AVAILABLE); return false; diff --git a/reserve/request.pl b/reserve/request.pl index 486c770c75..df9cae861d 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -144,6 +144,7 @@ if ( $biblionumbers ) { push @biblionumbers, $input->multi_param('biblionumber'); } +my $multihold = scalar $input->param('multi_hold'); # FIXME multi_hold should not be a variable but depends on the number of elements in @biblionumbers $template->param(multi_hold => scalar $input->param('multi_hold')); @@ -209,6 +210,10 @@ my $patron = Koha::Patrons->find( $borrowernumber_hold ); my $logged_in_patron = Koha::Patrons->find( $borrowernumber ); +my $wants_check; +if ($patron) { + $wants_check = $patron->wants_check_for_previous_checkout; +} my $itemdata_enumchron = 0; my $itemdata_ccode = 0; my @biblioloop = (); @@ -374,7 +379,18 @@ foreach my $biblionumber (@biblionumbers) { foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { my $item = $iteminfos_of->{$itemnumber}; - + my $do_check; + if ( $patron ) { + $do_check = $patron->do_check_for_previous_checkout($item) if $wants_check; + if ( $do_check && $wants_check ) { + $item->{checked_previously} = $do_check; + if ( $multihold ) { + $biblioloopiter{checked_previously} = $do_check; + } else { + $template->param( checked_previously => $do_check ); + } + } + } $item->{force_hold_level} = $force_hold_level; unless (C4::Context->preference('item-level_itypes')) { -- 2.11.0