# Copyright 2000-2002 Katipo Communications
+# Parts Copyright Catalyst IT 2011
#
# This file is part of Koha.
#
";
$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,
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;
}
for my $thisitemtype (@$advsearchtypes) {
my $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;