X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=opac%2Fopac-topissues.pl;h=dfdb6cd86cb18dc9509a5c9f3346a5aa79506dd3;hb=722701d59644a2963cb4e7b326aa6287941cd483;hp=80e7c35aba235742c21b3eeca901e6f102cc98dd;hpb=b06a289173d0f2e299b0c8652d59d47dc196062c;p=koha.git diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl index 80e7c35aba..dfdb6cd86c 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,35 +122,34 @@ 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'; $itemtypes = GetItemTypes; my @itemtypesloop; -my $selected=1; if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { - my $selected = 1 if $thisitemtype eq $itemtype; my %row =( value => $thisitemtype, description => $itemtypes->{$thisitemtype}->{'description'}, - selected => $selected, + selected => $thisitemtype eq $itemtype, ); push @itemtypesloop, \%row; } } 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 => $selected, + selected => $thisitemtype eq $itemtype, description => $thisitemtype->{'lib'}, ); push @itemtypesloop, \%row;