Patch from Joe Atzberger to remove $Id$ and $Log$ from scripts
[koha.git] / opac / opac-basket.pl
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
9 #
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA  02111-1307 USA
17
18
19 use strict;
20 require Exporter;
21 use CGI;
22 use C4::Biblio;
23 use C4::Auth;
24 use C4::Output;
25
26 my $query = new CGI;
27
28 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
29     {
30         template_name   => "opac-basket.tmpl",
31         query           => $query,
32         type            => "opac",
33         authnotrequired => 1,
34         flagsrequired   => { borrow => 1 },
35     }
36 );
37
38 my $bib_list     = $query->param('bib_list');
39 my $print_basket = $query->param('print');
40 my $verbose      = $query->param('verbose');
41
42 if ($verbose)      { $template->param( verbose      => 1 ); }
43 if ($print_basket) { $template->param( print_basket => 1 ); }
44
45 my @bibs = split( /\//, $bib_list );
46 my @results;
47
48 my $num = 1;
49 my $marcflavour = C4::Context->preference('marcflavour');
50 foreach my $biblionumber ( @bibs ) {
51     $template->param( biblionumber => $biblionumber );
52
53     my $dat              = &GetBiblioData($biblionumber);
54     my $record           = &GetMarcBiblio($biblionumber);
55     my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
56     my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
57     my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
58     my @items            = &GetItemsInfo( $biblionumber, 'opac' );
59
60     if ( $num % 2 == 1 ) {
61         $dat->{'even'} = 1;
62     }
63
64     $num++;
65     $dat->{biblionumber} = $biblionumber;
66     $dat->{ITEM_RESULTS}   = \@items;
67     $dat->{MARCNOTES}      = $marcnotesarray;
68     $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
69     $dat->{MARCAUTHORS}    = $marcauthorsarray;
70
71     if ( C4::Context->preference("BiblioDefaultView") eq "normal" ) {
72         $dat->{dest} = "opac-detail.pl";
73     }
74     elsif ( C4::Context->preference("BiblioDefaultView") eq "marc" ) {
75         $dat->{dest} = "opac-MARCdetail.pl";
76     }
77     else {
78         $dat->{dest} = "opac-ISBDdetail.pl";
79     }
80     push( @results, $dat );
81 }
82
83 my $resultsarray = \@results;
84
85 # my $itemsarray=\@items;
86
87 $template->param(
88     BIBLIO_RESULTS => $resultsarray,
89 );
90
91 output_html_with_http_headers $query, $cookie, $template->output;