Bug 7860 - /virtualshelves/addbybiblionumber.pl plack scoping
[koha.git] / catalogue / imageviewer.pl
blob011dfabbb66c70774a80e89278af9a543adc104e
1 #!/usr/bin/perl
3 # Copyright 2011 C & P Bibliography Services
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 use strict;
21 use warnings;
23 use CGI;
24 use C4::Auth;
25 use C4::Biblio;
26 use C4::Items;
27 use C4::Output;
28 use C4::Images;
29 use C4::Search;
31 my $query = new CGI;
32 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
34 template_name => "catalogue/imageviewer.tmpl",
35 query => $query,
36 type => "intranet",
37 authnotrequired => 0,
38 flagsrequired => { catalogue => 1 },
42 my $biblionumber = $query->param('biblionumber') || $query->param('bib');
43 my $imagenumber = $query->param('imagenumber');
44 my ( $count, $biblio ) = GetBiblio($biblionumber);
45 my $itemcount = GetItemsCount($biblionumber);
47 my @items = GetItemsInfo($biblionumber);
49 my $norequests = 1;
50 foreach my $item (@items) {
52 # can place holds defaults to yes
53 $norequests = 0
54 unless ( ( $item->{'notforloan_per_itemtype'} > 0 )
55 || ( $item->{'itemnotforloan'} > 0 ) );
58 if ( $query->cookie("holdfor") ) {
59 my $holdfor_patron =
60 GetMember( 'borrowernumber' => $query->cookie("holdfor") );
61 $template->param(
62 holdfor => $query->cookie("holdfor"),
63 holdfor_surname => $holdfor_patron->{'surname'},
64 holdfor_firstname => $holdfor_patron->{'firstname'},
65 holdfor_cardnumber => $holdfor_patron->{'cardnumber'},
69 if ( C4::Context->preference("LocalCoverImages") ) {
70 my @images = ListImagesForBiblio($biblionumber);
71 $template->{VARS}->{'LocalCoverImages'} = 1;
72 $template->{VARS}->{'images'} = \@images;
73 $template->{VARS}->{'imagenumber'} = $imagenumber || $images[0] || '';
75 $template->{VARS}->{'count'} = $itemcount;
76 $template->{VARS}->{'biblionumber'} = $biblionumber;
77 $template->{VARS}->{'norequests'} = $norequests;
78 $template->param(C4::Search::enabled_staff_search_views);
79 $template->{VARS}->{'biblio'} = $biblio;
81 output_html_with_http_headers $query, $cookie, $template->output;