3 # Copyright 2008-2009 LibLime
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 use C4::Auth qw( get_template_and_user );
25 use C4::Output qw( output_html_with_http_headers );
32 use C4::Search qw( z3950_search_args enabled_staff_search_views );
33 use C4::Serials qw( CountSubscriptionFromBiblionumber );
36 use Koha::BiblioFrameworks;
38 use Koha::Virtualshelves;
41 my $dbh = C4::Context->dbh;
42 my $biblionumber = $query->param('biblionumber');
43 $biblionumber = HTML::Entities::encode($biblionumber);
44 my $frameworkcode = $query->param('frameworkcode') // GetFrameworkCode( $biblionumber );
46 $query->param('popup')
47 ; # if set to 1, then don't insert links, it's just to show the biblio
50 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
52 template_name => "catalogue/labeledMARCdetail.tt",
55 flagsrequired => { catalogue => 1 },
59 my $record = GetMarcBiblio({ biblionumber => $biblionumber });
60 if ( not defined $record ) {
61 # biblionumber invalid -> report and exit
62 $template->param( unknownbiblionumber => 1,
63 biblionumber => $biblionumber
65 output_html_with_http_headers $query, $cookie, $template->output;
69 my $biblio_object = Koha::Biblios->find( $biblionumber ); # FIXME Should replace $biblio
70 my $tagslib = GetMarcStructure(1,$frameworkcode);
71 my $biblio = GetBiblioData($biblionumber);
73 if($query->cookie("holdfor")){
74 my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
76 holdfor => $query->cookie("holdfor"),
77 holdfor_patron => $holdfor_patron,
78 holdfor_cardnumber => $holdfor_patron->cardnumber,
82 if( $query->cookie("searchToOrder") ){
83 my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") );
85 searchtoorder_basketno => $basketno,
86 searchtoorder_vendorid => $vendorid
91 my $itemcount = $biblio_object->items->count;
92 $template->param( count => $itemcount,
93 bibliotitle => $biblio->{title}, );
95 my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
97 frameworks => $frameworks,
98 frameworkcode => $frameworkcode,
103 for my $field ($record->fields)
105 my $tag = $field->tag;
106 next if ! exists $tagslib->{$tag}->{lib};
107 my $label = $tagslib->{$tag}->{lib};
108 if ($label eq $prevlabel)
116 my $value = $tag < 10
118 : join ' ', map { $_->[1] } $field->subfields;
125 # get biblionumbers stored in the cart
128 if($query->cookie("intranet_bib_list")){
129 my $cart_list = $query->cookie("intranet_bib_list");
130 @cart_list = split(/\//, $cart_list);
131 if ( grep {$_ eq $biblionumber} @cart_list) {
132 $template->param( incart => 1 );
136 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
138 borrowernumber => $loggedinuser,
143 my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
145 borrowernumber => $loggedinuser,
153 add_to_some_private_shelves => $some_private_shelves,
154 add_to_some_public_shelves => $some_public_shelves,
158 marc_data => \@marc_data,
159 biblionumber => $biblionumber,
161 labeledmarcview => 1,
162 z3950_search_params => C4::Search::z3950_search_args($biblio),
163 C4::Search::enabled_staff_search_views,
164 subscriptionsnumber => CountSubscriptionFromBiblionumber($biblionumber),
165 searchid => scalar $query->param('searchid'),
168 $biblio = Koha::Biblios->find( $biblionumber );
169 my $holds = $biblio->holds;
170 $template->param( biblio => $biblio, holdcount => $holds->count );
172 output_html_with_http_headers $query, $cookie, $template->output;