From 6a4c60e80831d0d0386f38f09f3415f2abd586a6 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Thu, 22 Jun 2017 11:26:53 +0200 Subject: [PATCH] Bug 16284: Check only item for previous checkout if biblio is serial Test plan: 1) Set 'CheckPrevCheckout' system preference to 'Do' 2) Make a checkout with item from serial record (942$s is 1 on default settings) 3) Return that checkout 4) Try to check it out again, you should see an alert, that the patron has thi item checked out previously 5) Try to checkout another item from same bibliographic record, you sholud not see the alert and item should be checked out 6) prove t/db_dependent/Patron/Borrower_PrevCheckout.t --- Koha/Patron.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index d4544443f0..2912a751c0 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -546,11 +546,13 @@ $PATRON, 0 otherwise. sub do_check_for_previous_checkout { my ( $self, $item ) = @_; - # Find all items for bib and extract item numbers. - my @items = Koha::Items->search({biblionumber => $item->{biblionumber}}); my @item_nos; - foreach my $item (@items) { - push @item_nos, $item->itemnumber; + my $biblio = Koha::Biblios->find( $item->{biblionumber} ); + if ( $biblio->serial ) { + push @item_nos, $item->{itemnumber}; + } else { + # Get all itemnumbers for given bibliographic record. + @item_nos = $biblio->items->get_column( 'itemnumber' ); } # Create (old)issues search criteria -- 2.11.0