my ( $template, $loggedinuser, $cookie );
my $resultsperpage;
-my $authtypes = getauthtypes;
-my @authtypesloop;
-foreach my $thisauthtype ( sort { $authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'} }
- keys %$authtypes )
-{
- my $selected = 1 if $thisauthtype eq $authtypecode;
- my %row = (
- value => $thisauthtype,
- selected => $selected,
- authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
- );
- push @authtypesloop, \%row;
+my $authtypes = getauthtypes();
+my @authtypesloop = ();
+foreach my $thisauthtype (
+ sort {
+ $authtypes->{$a}->{'authtypetext'}
+ cmp $authtypes->{$b}->{'authtypetext'}
+ }
+ keys %{$authtypes}
+ ) {
+ push @authtypesloop,
+ { value => $thisauthtype,
+ selected => $thisauthtype eq $authtypecode,
+ authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
+ };
}
if ( $op eq "do_search" ) {
else {
$to = ( ( $startfrom + 1 ) * $resultsperpage );
}
+ unless (C4::Context->preference('OPACShowUnusedAuthorities')) {
+ my @usedauths = grep { $_->{used} > 0 } @$results;
+ $results = \@usedauths;
+ }
$template->param( result => $results ) if $results;
$template->param( FIELDS => \@fields );
$template->param( orderby => $orderby );
startfromnext => $startfrom + 1,
startfromprev => $startfrom - 1,
searchdata => \@field_data,
+ countfuzzy => !(C4::Context->preference('OPACShowUnusedAuthorities')),
total => $total,
from => $from,
to => $to,
+ resultcount => scalar @$results,
numbers => \@numbers,
authtypecode => $authtypecode,
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
template_name => "opac-authorities-home.tmpl",
query => $query,
type => 'opac',
- authnotrequired => 1,
+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
debug => 1,
}
);