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 Koha::RecordProcessor;
33 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
35 template_name => "opac-basket.tt",
38 authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
42 my $bib_list = $query->param('bib_list');
43 my $print_basket = $query->param('print');
44 my $verbose = $query->param('verbose');
46 if ($verbose) { $template->param( verbose => 1 ); }
47 if ($print_basket) { $template->param( print_basket => 1 ); }
49 my @bibs = split( /\//, $bib_list );
53 my $marcflavour = C4::Context->preference('marcflavour');
54 if (C4::Context->preference('TagsEnabled')) {
55 $template->param(TagsEnabled => 1);
56 foreach (qw(TagsShowOnList TagsInputOnList)) {
57 C4::Context->preference($_) and $template->param($_ => 1);
61 my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
62 foreach my $biblionumber ( @bibs ) {
63 $template->param( biblionumber => $biblionumber );
65 my $dat = &GetBiblioData($biblionumber);
67 my $record_unfiltered = &GetMarcBiblio($biblionumber);
68 my $record_filtered = $record_unfiltered->clone();
69 my $record = $record_processor->process($record_filtered);
71 my $marcnotesarray = GetMarcNotes( $record, $marcflavour );
72 my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
73 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
74 my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
75 my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
76 my @items = &GetItemsInfo( $biblionumber );
77 my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
80 if($dat->{'author'} || @$marcauthorsarray) {
83 my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
84 my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
86 # COinS format FIXME: for books Only
88 my $fmt = substr $record->leader(), 6,2;
90 $fmts->{'am'} = 'book';
91 $dat->{ocoins_format} = $fmts->{$fmt};
93 if ( $num % 2 == 1 ) {
97 my $branches = GetBranches();
98 for my $itm (@items) {
99 if ($itm->{'location'}){
100 $itm->{'location_opac'} = $shelflocations->{$itm->{'location'} };
102 my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
103 if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
104 $itm->{transfertwhen} = $transfertwhen;
105 $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
106 $itm->{transfertto} = $branches->{$transfertto}{branchname};
110 $dat->{biblionumber} = $biblionumber;
111 $dat->{ITEM_RESULTS} = \@items;
112 $dat->{MARCNOTES} = $marcnotesarray;
113 $dat->{MARCSUBJCTS} = $marcsubjctsarray;
114 $dat->{MARCAUTHORS} = $marcauthorsarray;
115 $dat->{MARCSERIES} = $marcseriesarray;
116 $dat->{MARCURLS} = $marcurlsarray;
117 $dat->{HASAUTHORS} = $hasauthors;
118 $dat->{subtitle} = $subtitle;
120 if ( C4::Context->preference("BiblioDefaultView") eq "normal" ) {
121 $dat->{dest} = "opac-detail.pl";
123 elsif ( C4::Context->preference("BiblioDefaultView") eq "marc" ) {
124 $dat->{dest} = "opac-MARCdetail.pl";
127 $dat->{dest} = "opac-ISBDdetail.pl";
129 push( @results, $dat );
132 my $resultsarray = \@results;
134 # my $itemsarray=\@items;
137 bib_list => $bib_list,
138 BIBLIO_RESULTS => $resultsarray,
141 output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };