3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
27 use C4::Auth qw( get_template_and_user );
28 use C4::Output qw( output_html_with_http_headers );
30 use Koha::AuthorisedValues;
32 use Koha::CsvProfiles;
36 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
38 template_name => "basket/basket.tt",
41 flagsrequired => { catalogue => 1 },
45 my $bib_list = $query->param('bib_list');
46 my $verbose = $query->param('verbose');
48 if ($verbose) { $template->param( verbose => 1 ); }
50 my @bibs = split( /\//, $bib_list );
54 my $marcflavour = C4::Context->preference('marcflavour');
55 if (C4::Context->preference('TagsEnabled')) {
56 $template->param(TagsEnabled => 1);
57 foreach (qw(TagsShowOnList TagsInputOnList)) {
58 C4::Context->preference($_) and $template->param($_ => 1);
63 foreach my $biblionumber ( @bibs ) {
64 $template->param( biblionumber => $biblionumber );
66 my $biblio = Koha::Biblios->find( $biblionumber ) or next;
67 my $dat = $biblio->unblessed;
68 my $record = $biblio->metadata->record;
69 my $marcnotesarray = $biblio->get_marc_notes;
70 my $marcauthorsarray = $biblio->get_marc_contributors;
71 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
72 my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
73 my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
76 if($dat->{'author'} || @$marcauthorsarray) {
80 # COinS format FIXME: for books Only
81 my $fmt = substr $record->leader(), 6,2;
83 $fmts->{'am'} = 'book';
84 $dat->{ocoins_format} = $fmts->{$fmt};
86 if ( $num % 2 == 1 ) {
91 $dat->{biblionumber} = $biblionumber;
92 $dat->{ITEM_RESULTS} = $biblio->items->search_ordered;
93 $dat->{MARCNOTES} = $marcnotesarray;
94 $dat->{MARCSUBJCTS} = $marcsubjctsarray;
95 $dat->{MARCAUTHORS} = $marcauthorsarray;
96 $dat->{MARCSERIES} = $marcseriesarray;
97 $dat->{MARCURLS} = $marcurlsarray;
98 $dat->{HASAUTHORS} = $hasauthors;
100 push( @results, $dat );
103 my $resultsarray = \@results;
105 # my $itemsarray=\@items;
108 BIBLIO_RESULTS => $resultsarray,
109 csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }),
110 bib_list => $bib_list,
113 output_html_with_http_headers $query, $cookie, $template->output;