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
30 use C4
::Acquisition
qw(GetOrdersByBiblionumber);
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');
41 $frameworkcode = GetFrameworkCode
( $biblionumber ) unless ($frameworkcode);
43 $query->param('popup')
44 ; # if set to 1, then don't insert links, it's just to show the biblio
47 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
49 template_name
=> "catalogue/labeledMARCdetail.tt",
53 flagsrequired
=> { catalogue
=> 1 },
58 my $record = GetMarcBiblio
({ biblionumber
=> $biblionumber });
59 if ( not defined $record ) {
60 # biblionumber invalid -> report and exit
61 $template->param( unknownbiblionumber
=> 1,
62 biblionumber
=> $biblionumber
64 output_html_with_http_headers
$query, $cookie, $template->output;
68 my $biblio_object = Koha
::Biblios
->find( $biblionumber ); # FIXME Should replace $biblio
69 my $tagslib = GetMarcStructure
(1,$frameworkcode);
70 my $biblio = GetBiblioData
($biblionumber);
72 if($query->cookie("holdfor")){
73 my $holdfor_patron = Koha
::Patrons
->find( $query->cookie("holdfor") );
75 holdfor
=> $query->cookie("holdfor"),
76 holdfor_surname
=> $holdfor_patron->surname,
77 holdfor_firstname
=> $holdfor_patron->firstname,
78 holdfor_cardnumber
=> $holdfor_patron->cardnumber,
83 my $itemcount = $biblio_object->items->count;
84 $template->param( count
=> $itemcount,
85 bibliotitle
=> $biblio->{title
}, );
87 my $frameworks = Koha
::BiblioFrameworks
->search({}, { order_by
=> ['frameworktext'] });
89 frameworks
=> $frameworks,
90 frameworkcode
=> $frameworkcode,
95 for my $field ($record->fields)
97 my $tag = $field->tag;
98 next if ! exists $tagslib->{$tag}->{lib
};
99 my $label = $tagslib->{$tag}->{lib
};
100 if ($label eq $prevlabel)
108 my $value = $tag < 10
110 : join ' ', map { $_->[1] } $field->subfields;
118 marc_data
=> \
@marc_data,
119 biblionumber
=> $biblionumber,
121 labeledmarcview
=> 1,
122 z3950_search_params
=> C4
::Search
::z3950_search_args
($biblio),
123 C4
::Search
::enabled_staff_search_views
,
124 searchid
=> scalar $query->param('searchid'),
127 my @allorders_using_biblio = GetOrdersByBiblionumber
($biblionumber);
128 my @deletedorders_using_biblio;
129 my @orders_using_biblio;
131 my @baskets_deletedorders;
133 foreach my $myorder (@allorders_using_biblio) {
134 my $basket = $myorder->{'basketno'};
135 if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){
136 push @deletedorders_using_biblio, $myorder;
137 unless (grep(/^$basket$/, @baskets_deletedorders)){
138 push @baskets_deletedorders,$myorder->{'basketno'};
142 push @orders_using_biblio, $myorder;
143 unless (grep(/^$basket$/, @baskets_orders)){
144 push @baskets_orders,$myorder->{'basketno'};
149 my $count_orders_using_biblio = scalar @orders_using_biblio ;
150 $template->param (countorders
=> $count_orders_using_biblio);
152 my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ;
153 $template->param (countdeletedorders
=> $count_deletedorders_using_biblio);
155 $biblio = Koha
::Biblios
->find( $biblionumber );
156 my $holds = $biblio->holds;
157 $template->param( holdcount
=> $holds->count );
159 output_html_with_http_headers
$query, $cookie, $template->output;