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>.
28 use C4::Items qw( GetItemsInfo );
29 use C4::Auth qw( get_template_and_user );
30 use C4::Output qw( output_html_with_http_headers );
32 use Koha::AuthorisedValues;
34 use Koha::CsvProfiles;
38 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
40 template_name => "basket/basket.tt",
43 flagsrequired => { catalogue => 1 },
47 my $bib_list = $query->param('bib_list');
48 my $verbose = $query->param('verbose');
50 if ($verbose) { $template->param( verbose => 1 ); }
52 my @bibs = split( /\//, $bib_list );
56 my $marcflavour = C4::Context->preference('marcflavour');
57 if (C4::Context->preference('TagsEnabled')) {
58 $template->param(TagsEnabled => 1);
59 foreach (qw(TagsShowOnList TagsInputOnList)) {
60 C4::Context->preference($_) and $template->param($_ => 1);
65 foreach my $biblionumber ( @bibs ) {
66 $template->param( biblionumber => $biblionumber );
68 my $biblio = Koha::Biblios->find( $biblionumber ) or next;
69 my $dat = $biblio->unblessed;
70 my $record = &GetMarcBiblio({ biblionumber => $biblionumber });
71 my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour });
72 my $marcauthorsarray = $biblio->get_marc_authors;
73 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
74 my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
75 my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
76 my @items = GetItemsInfo( $biblionumber );
79 if($dat->{'author'} || @$marcauthorsarray) {
84 { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.location' } ) };
86 for my $itm (@items) {
87 if ($itm->{'location'}){
88 $itm->{'location_description'} = $shelflocations->{$itm->{'location'} };
91 # COinS format FIXME: for books Only
92 my $fmt = substr $record->leader(), 6,2;
94 $fmts->{'am'} = 'book';
95 $dat->{ocoins_format} = $fmts->{$fmt};
97 if ( $num % 2 == 1 ) {
102 $dat->{biblionumber} = $biblionumber;
103 $dat->{ITEM_RESULTS} = \@items;
104 $dat->{MARCNOTES} = $marcnotesarray;
105 $dat->{MARCSUBJCTS} = $marcsubjctsarray;
106 $dat->{MARCAUTHORS} = $marcauthorsarray;
107 $dat->{MARCSERIES} = $marcseriesarray;
108 $dat->{MARCURLS} = $marcurlsarray;
109 $dat->{HASAUTHORS} = $hasauthors;
111 push( @results, $dat );
114 my $resultsarray = \@results;
116 # my $itemsarray=\@items;
119 BIBLIO_RESULTS => $resultsarray,
120 csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }),
121 bib_list => $bib_list,
124 output_html_with_http_headers $query, $cookie, $template->output;