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>.
29 use C4::Items qw( GetItemsInfo );
30 use C4::Auth qw( get_template_and_user );
31 use C4::Output qw( output_html_with_http_headers );
33 use Koha::AuthorisedValues;
35 use Koha::CsvProfiles;
39 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
41 template_name => "basket/basket.tt",
44 flagsrequired => { catalogue => 1 },
48 my $bib_list = $query->param('bib_list');
49 my $verbose = $query->param('verbose');
51 if ($verbose) { $template->param( verbose => 1 ); }
53 my @bibs = split( /\//, $bib_list );
57 my $marcflavour = C4::Context->preference('marcflavour');
58 if (C4::Context->preference('TagsEnabled')) {
59 $template->param(TagsEnabled => 1);
60 foreach (qw(TagsShowOnList TagsInputOnList)) {
61 C4::Context->preference($_) and $template->param($_ => 1);
66 foreach my $biblionumber ( @bibs ) {
67 $template->param( biblionumber => $biblionumber );
69 my $dat = &GetBiblioData($biblionumber);
71 my $biblio = Koha::Biblios->find( $biblionumber );
72 my $record = &GetMarcBiblio({ biblionumber => $biblionumber });
73 my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour });
74 my $marcauthorsarray = $biblio->get_marc_authors;
75 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
76 my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
77 my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
78 my @items = GetItemsInfo( $biblionumber );
81 if($dat->{'author'} || @$marcauthorsarray) {
86 { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.location' } ) };
88 for my $itm (@items) {
89 if ($itm->{'location'}){
90 $itm->{'location_description'} = $shelflocations->{$itm->{'location'} };
93 # COinS format FIXME: for books Only
94 my $fmt = substr $record->leader(), 6,2;
96 $fmts->{'am'} = 'book';
97 $dat->{ocoins_format} = $fmts->{$fmt};
99 if ( $num % 2 == 1 ) {
104 $dat->{biblionumber} = $biblionumber;
105 $dat->{ITEM_RESULTS} = \@items;
106 $dat->{MARCNOTES} = $marcnotesarray;
107 $dat->{MARCSUBJCTS} = $marcsubjctsarray;
108 $dat->{MARCAUTHORS} = $marcauthorsarray;
109 $dat->{MARCSERIES} = $marcseriesarray;
110 $dat->{MARCURLS} = $marcurlsarray;
111 $dat->{HASAUTHORS} = $hasauthors;
113 if ( C4::Context->preference("IntranetBiblioDefaultView") eq "normal" ) {
114 $dat->{dest} = "/cgi-bin/koha/catalogue/detail.pl";
116 elsif ( C4::Context->preference("IntranetBiblioDefaultView") eq "marc" ) {
117 $dat->{dest} = "/cgi-bin/koha/catalogue/MARCdetail.pl";
120 $dat->{dest} = "/cgi-bin/koha/catalogue/ISBDdetail.pl";
122 push( @results, $dat );
125 my $resultsarray = \@results;
127 # my $itemsarray=\@items;
130 BIBLIO_RESULTS => $resultsarray,
131 csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
132 bib_list => $bib_list,
135 output_html_with_http_headers $query, $cookie, $template->output;