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>.
30 use C4::Items qw( GetItemsInfo );
31 use C4::Auth qw( get_template_and_user );
32 use C4::Output qw( output_html_with_http_headers );
34 use Koha::AuthorisedValues;
36 use Koha::CsvProfiles;
40 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
42 template_name => "basket/basket.tt",
45 flagsrequired => { catalogue => 1 },
49 my $bib_list = $query->param('bib_list');
50 my $verbose = $query->param('verbose');
52 if ($verbose) { $template->param( verbose => 1 ); }
54 my @bibs = split( /\//, $bib_list );
58 my $marcflavour = C4::Context->preference('marcflavour');
59 if (C4::Context->preference('TagsEnabled')) {
60 $template->param(TagsEnabled => 1);
61 foreach (qw(TagsShowOnList TagsInputOnList)) {
62 C4::Context->preference($_) and $template->param($_ => 1);
67 foreach my $biblionumber ( @bibs ) {
68 $template->param( biblionumber => $biblionumber );
70 my $dat = &GetBiblioData($biblionumber);
72 my $biblio = Koha::Biblios->find( $biblionumber );
73 my $record = &GetMarcBiblio({ biblionumber => $biblionumber });
74 my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour });
75 my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
76 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
77 my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
78 my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
79 my @items = GetItemsInfo( $biblionumber );
82 if($dat->{'author'} || @$marcauthorsarray) {
87 { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.location' } ) };
89 for my $itm (@items) {
90 if ($itm->{'location'}){
91 $itm->{'location_description'} = $shelflocations->{$itm->{'location'} };
94 # COinS format FIXME: for books Only
95 my $fmt = substr $record->leader(), 6,2;
97 $fmts->{'am'} = 'book';
98 $dat->{ocoins_format} = $fmts->{$fmt};
100 if ( $num % 2 == 1 ) {
105 $dat->{biblionumber} = $biblionumber;
106 $dat->{ITEM_RESULTS} = \@items;
107 $dat->{MARCNOTES} = $marcnotesarray;
108 $dat->{MARCSUBJCTS} = $marcsubjctsarray;
109 $dat->{MARCAUTHORS} = $marcauthorsarray;
110 $dat->{MARCSERIES} = $marcseriesarray;
111 $dat->{MARCURLS} = $marcurlsarray;
112 $dat->{HASAUTHORS} = $hasauthors;
114 if ( C4::Context->preference("IntranetBiblioDefaultView") eq "normal" ) {
115 $dat->{dest} = "/cgi-bin/koha/catalogue/detail.pl";
117 elsif ( C4::Context->preference("IntranetBiblioDefaultView") eq "marc" ) {
118 $dat->{dest} = "/cgi-bin/koha/catalogue/MARCdetail.pl";
121 $dat->{dest} = "/cgi-bin/koha/catalogue/ISBDdetail.pl";
123 push( @results, $dat );
126 my $resultsarray = \@results;
128 # my $itemsarray=\@items;
131 BIBLIO_RESULTS => $resultsarray,
132 csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
133 bib_list => $bib_list,
136 output_html_with_http_headers $query, $cookie, $template->output;