Bug 6916 - item's acq date now takes you to its invoice
[koha.git] / opac / opac-topissues.pl
index b4b83f1..6899215 100755 (executable)
@@ -46,7 +46,7 @@ my ($template, $borrowernumber, $cookie)
        = get_template_and_user({template_name => 'opac-topissues.tmpl',
                                query => $input,
                                type => "opac",
-                               authnotrequired => 1,
+               authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
                                debug => 1,
                                });
 my $dbh = C4::Context->dbh;
@@ -127,13 +127,11 @@ $template->param( branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}
 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;
         }
@@ -142,7 +140,7 @@ if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
         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;