X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=opac%2Fopac-topissues.pl;h=3d5f3b84ebac3b7b4407758ade19f00a39810bcb;hb=840a907b86c054aa1c216a8cf353b1a9ef3c44fa;hp=6899215cc7cb9cd40d44e074faf8cd1e571ca3fd;hpb=16f1fffdd1f5d1c97db0bf664f83496864b7e24d;p=koha.git diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl index 6899215cc7..3d5f3b84eb 100755 --- a/opac/opac-topissues.pl +++ b/opac/opac-topissues.pl @@ -2,6 +2,7 @@ # Copyright 2000-2002 Katipo Communications +# Parts Copyright Catalyst IT 2011 # # This file is part of Koha. # @@ -83,7 +84,14 @@ if($advanced_search_types eq 'ccode'){ "; $template->param(ccodesearch => 1); }else{ - $whereclause .= ' AND biblioitems.itemtype='.$dbh->quote($itemtype) if $itemtype; + if ($itemtype){ + if (C4::Context->preference('item-level_itypes')){ + $whereclause .= ' AND items.itype = ' . $dbh->quote($itemtype); + } + else { + $whereclause .= ' AND biblioitems.itemtype='.$dbh->quote($itemtype); + } + } $query = "SELECT datecreated, biblio.biblionumber, title, author, sum( items.issues ) AS tot, biblioitems.itemtype, biblioitems.publishercode,biblioitems.publicationyear, @@ -114,14 +122,14 @@ if($timeLimit eq 999){ $timeLimitFinite = 0 }; $template->param(do_it => 1, limit => $limit, - branch => $branches->{$branch}->{branchname} || 'all locations', - itemtype => $itemtypes->{$itemtype}->{description} || 'item types', + branch => $branches->{$branch}->{branchname}, + itemtype => $itemtypes->{$itemtype}->{description}, timeLimit => $timeLimit, timeLimitFinite => $timeLimit, results_loop => \@results, ); -$template->param( branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'})); +$template->param( branchloop => GetBranchesLoop(C4::Context->userenv?C4::Context->userenv->{'branch'}:'')); # the index parameter is different for item-level itemtypes my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; @@ -138,7 +146,8 @@ if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { } else { my $advsearchtypes = GetAuthorisedValues($advanced_search_types, '', 'opac'); for my $thisitemtype (@$advsearchtypes) { - my $selected = 1 if $thisitemtype->{authorised_value} eq $itemtype; + my $selected; + $selected = 1 if $thisitemtype->{authorised_value} eq $itemtype; my %row =( value => $thisitemtype->{authorised_value}, selected => $thisitemtype eq $itemtype, description => $thisitemtype->{'lib'}, @@ -149,7 +158,6 @@ if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { $template->param( itemtypeloop =>\@itemtypesloop, - dateformat => C4::Context->preference("dateformat"), ); output_html_with_http_headers $input, $cookie, $template->output;