# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
-use C4::Auth;
+use C4::Auth qw( get_template_and_user );
use C4::Context;
-use C4::Languages;
use C4::Search;
-use C4::Output;
-use C4::Koha;
-use C4::Branch;
-use C4::Circulation;
-use Date::Manip;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Circulation qw( GetTopIssues );
=head1 NAME
=cut
-my $input = new CGI;
+my $input = CGI->new;
# if OpacTopissue is disabled, leave immediately
if ( ! C4::Context->preference('OpacTopissue') ) {
exit;
}
-my $branches = GetBranches();
-my $itemtypes = GetItemTypes();
-
my ($template, $borrowernumber, $cookie) = get_template_and_user(
{
template_name => 'opac-topissues.tt',
query => $input,
type => "opac",
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
- debug => 1,
}
);
my $dbh = C4::Context->dbh;
}
my $itemtype = $input->param('itemtype') || '';
my $timeLimit = $input->param('timeLimit') || 3;
-my $advanced_search_types = C4::Context->preference('AdvancedSearchTypes');
+my $advanced_search_types = C4::Context->preference('OpacAdvancedSearchTypes');
my @advanced_search_types = split /\|/, $advanced_search_types;
my $params = {
$type = 'itemtype';
}
$params->{$type} = $input->param($type);
- $template->param('selected_' . $type => $input->param($type));
+ $template->param('selected_' . $type => scalar $input->param($type));
}
my @results = GetTopIssues($params);
$template->param(
limit => $limit,
- branch => $branches->{$branch}->{branchname},
+ branch => $branch,
timeLimit => $timeLimit,
results => \@results,
);
-$template->param(branchloop => GetBranchesLoop($branch));
-
output_html_with_http_headers $input, $cookie, $template->output;