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
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
35 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
37 template_name => "catalogue/imageviewer.tt",
40 flagsrequired => { catalogue => 1 },
44 my $itemnumber = $query->param('itemnumber');
45 my $biblionumber = $query->param('biblionumber') || $query->param('bib') || Koha::Items->find($itemnumber)->biblionumber;
46 my $imagenumber = $query->param('imagenumber');
47 my $biblio = Koha::Biblios->find( $biblionumber );
48 my $itemcount = $biblio ? $biblio->items->count : 0;
49 my @items = GetItemsInfo($biblionumber);
51 if ( $query->cookie("holdfor") ) {
52 my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
54 holdfor => $query->cookie("holdfor"),
55 holdfor_surname => $holdfor_patron->surname,
56 holdfor_firstname => $holdfor_patron->firstname,
57 holdfor_cardnumber => $holdfor_patron->cardnumber,
61 if( $query->cookie("searchToOrder") ){
62 my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") );
64 searchtoorder_basketno => $basketno,
65 searchtoorder_vendorid => $vendorid
69 if ( C4::Context->preference("LocalCoverImages") ) {
71 my $image = C4::Images::GetImageForItem($itemnumber);
73 LocalCoverImages => 1,
75 imagenumber => $imagenumber,
79 my @images = ListImagesForBiblio($biblionumber);
81 LocalCoverImages => 1,
83 imagenumber => $imagenumber || $images[0] || '',
87 $template->{VARS}->{'count'} = $itemcount;
88 $template->{VARS}->{'biblionumber'} = $biblionumber;
89 $template->param(C4::Search::enabled_staff_search_views);
90 $template->{VARS}->{'biblio'} = $biblio;
92 my $hold_count = $biblio ? $biblio->holds->count : 0;
93 $template->param( holdcount => $hold_count );
95 output_html_with_http_headers $query, $cookie, $template->output;