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>.
29 use C4
::Search
; # enabled_staff_search_views
33 use Koha
::BiblioFrameworks
;
37 my $dbh = C4
::Context
->dbh;
38 my $biblionumber = $query->param('biblionumber');
39 $biblionumber = HTML
::Entities
::encode
($biblionumber);
40 my $frameworkcode = $query->param('frameworkcode') // GetFrameworkCode
( $biblionumber );
42 $query->param('popup')
43 ; # if set to 1, then don't insert links, it's just to show the biblio
46 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
48 template_name
=> "catalogue/labeledMARCdetail.tt",
51 flagsrequired
=> { catalogue
=> 1 },
56 my $record = GetMarcBiblio
({ biblionumber
=> $biblionumber });
57 if ( not defined $record ) {
58 # biblionumber invalid -> report and exit
59 $template->param( unknownbiblionumber
=> 1,
60 biblionumber
=> $biblionumber
62 output_html_with_http_headers
$query, $cookie, $template->output;
66 my $biblio_object = Koha
::Biblios
->find( $biblionumber ); # FIXME Should replace $biblio
67 my $tagslib = GetMarcStructure
(1,$frameworkcode);
68 my $biblio = GetBiblioData
($biblionumber);
70 if($query->cookie("holdfor")){
71 my $holdfor_patron = Koha
::Patrons
->find( $query->cookie("holdfor") );
73 holdfor
=> $query->cookie("holdfor"),
74 holdfor_surname
=> $holdfor_patron->surname,
75 holdfor_firstname
=> $holdfor_patron->firstname,
76 holdfor_cardnumber
=> $holdfor_patron->cardnumber,
80 if( $query->cookie("searchToOrder") ){
81 my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") );
83 searchtoorder_basketno
=> $basketno,
84 searchtoorder_vendorid
=> $vendorid
89 my $itemcount = $biblio_object->items->count;
90 $template->param( count
=> $itemcount,
91 bibliotitle
=> $biblio->{title
}, );
93 my $frameworks = Koha
::BiblioFrameworks
->search({}, { order_by
=> ['frameworktext'] });
95 frameworks
=> $frameworks,
96 frameworkcode
=> $frameworkcode,
101 for my $field ($record->fields)
103 my $tag = $field->tag;
104 next if ! exists $tagslib->{$tag}->{lib
};
105 my $label = $tagslib->{$tag}->{lib
};
106 if ($label eq $prevlabel)
114 my $value = $tag < 10
116 : join ' ', map { $_->[1] } $field->subfields;
124 marc_data
=> \
@marc_data,
125 biblionumber
=> $biblionumber,
127 labeledmarcview
=> 1,
128 z3950_search_params
=> C4
::Search
::z3950_search_args
($biblio),
129 C4
::Search
::enabled_staff_search_views
,
130 subscriptionsnumber
=> CountSubscriptionFromBiblionumber
($biblionumber),
131 searchid
=> scalar $query->param('searchid'),
134 $biblio = Koha
::Biblios
->find( $biblionumber );
135 my $holds = $biblio->holds;
136 $template->param( biblio
=> $biblio, holdcount
=> $holds->count );
138 output_html_with_http_headers
$query, $cookie, $template->output;