From bfe89a6aaebde8c42e2f352beaee503f315c1785 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 Signed-off-by: Michal Denar Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- Koha/Patron.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index db04efc781..bbacd94f22 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -556,11 +556,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.39.5