From 62ce10a838005cb5627a32987e274e197695ce4a Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Sun, 25 Nov 2007 19:32:01 -0600 Subject: [PATCH] adding maxItemsToDisplay Signed-off-by: Joshua Ferraro --- C4/Search.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 05c27e5d30..39ba582dba 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1105,8 +1105,9 @@ sub searchResults { # last check for norequest : if itemtype is notforloan, it can't be reserved either, whatever the items $norequests = 1 if $itemtypes{$oldbiblio->{itemtype}}->{notforloan}; - + my $itemscount; for my $key ( sort keys %$items ) { + $itemscount++; my $this_item = { branchname => $branches{$items->{$key}->{branchcode}}, branchcode => $items->{$key}->{branchcode}, @@ -1118,7 +1119,9 @@ sub searchResults { wthdrawn => $items->{$key}->{wthdrawn}, lost => $items->{$key}->{itemlost}, }; - push @items_loop, $this_item; + # only show the number specified by the user + my $maxitems = (C4::Context->preference('maxItemsinSearchResults')) ? C4::Context->preference('maxItemsinSearchResults')- 1 : 1; + push @items_loop, $this_item unless $itemscount > $maxitems;; } $oldbiblio->{norequests} = $norequests; $oldbiblio->{items_count} = $items_count; -- 2.39.5