From f00a4a7cfbf66976a3a031badc2f682a69b29b9c Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Fri, 2 Oct 2009 11:15:16 +0200 Subject: [PATCH] MT 1976 : Lists are directly displayed through VirtualShelves.pm (and not through the session, like in opac) --- catalogue/search.pl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index aac95b07b0..adb3cc7341 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -144,6 +144,7 @@ use C4::Auth qw(:DEFAULT get_session); use C4::Search; use C4::Languages qw(getAllLanguages); use C4::Koha; +use C4::VirtualShelves qw(GetRecentShelves); use POSIX qw(ceil floor); use C4::Branch; # GetBranches @@ -640,23 +641,22 @@ if ($query_desc || $limit_desc) { # VI. BUILD THE TEMPLATE # Build drop-down list for 'Add To:' menu... -my $session = get_session($cgi->cookie("CGISESSID")); -my @addpubshelves; -my $pubshelves = $session->param('pubshelves'); -my $barshelves = $session->param('barshelves'); -foreach my $shelf (@$pubshelves) { - next if ( ($shelf->{'owner'} != ($borrowernumber ? $borrowernumber : -1)) && ($shelf->{'category'} < 3) ); - push (@addpubshelves, $shelf); -} -if (@addpubshelves) { - $template->param( addpubshelves => scalar (@addpubshelves)); - $template->param( addpubshelvesloop => \@addpubshelves); +my $row_count = 10; # FIXME:This probably should be a syspref +my ($pubshelves, $total) = GetRecentShelves(2, $row_count, undef); +my ($barshelves, $total) = GetRecentShelves(1, $row_count, $borrowernumber); + +my @pubshelves = @{$pubshelves}; +my @barshelves = @{$barshelves}; + +if (@pubshelves) { + $template->param( addpubshelves => scalar (@pubshelves)); + $template->param( addpubshelvesloop => @pubshelves); } -if (defined $barshelves) { - $template->param( addbarshelves => scalar (@$barshelves)); - $template->param( addbarshelvesloop => $barshelves); +if (@barshelves) { + $template->param( addbarshelves => scalar (@barshelves)); + $template->param( addbarshelvesloop => @barshelves); } -- 2.39.5