Bug 25898: Prohibit indirect object notation
[koha.git] / opac / svc / shelfbrowser.pl
1 #!/usr/bin/perl
2
3 use Modern::Perl;
4 use CGI qw ( -utf8 );
5
6 use C4::Auth;
7 use C4::Context;
8 use C4::Output;
9 use C4::ShelfBrowser;
10
11 my $cgi = CGI->new;
12
13 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
14     {
15         template_name   => "svc/shelfbrowser.tt",
16         query           => $cgi,
17         type            => "opac",
18         authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
19     }
20 );
21
22 # Shelf Browser Stuff
23 if (C4::Context->preference("OPACShelfBrowser")) {
24     my $starting_itemnumber = $cgi->param('shelfbrowse_itemnumber');
25     if (defined($starting_itemnumber)) {
26         my $nearby = GetNearbyItems($starting_itemnumber);
27
28         $template->param(
29             starting_homebranch => $nearby->{starting_homebranch}->{description},
30             starting_location => $nearby->{starting_location}->{description},
31             starting_ccode => $nearby->{starting_ccode}->{description},
32             shelfbrowser_prev_item => $nearby->{prev_item},
33             shelfbrowser_next_item => $nearby->{next_item},
34             shelfbrowser_items => $nearby->{items},
35             OpenOPACShelfBrowser => 1,
36         );
37     }
38 }
39
40 output_html_with_http_headers $cgi, $cookie, $template->output;