Bug 17175: Typo in patron card images error message
[koha.git] / catalogue / ISBDdetail.pl
blob4e64484b254fd20342a98751f13fb7783d70ca44
1 #!/usr/bin/perl
3 # Copyright 2000-2002 Katipo Communications
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>.
20 =head1 NAME
22 ISBDdetail.pl : script to show a biblio in ISBD format
24 =head1 SYNOPSIS
26 =cut
28 =head1 DESCRIPTION
30 This script needs a biblionumber as parameter
32 =head1 FUNCTIONS
34 =cut
36 use strict;
37 #use warnings; FIXME - Bug 2505
39 use HTML::Entities;
40 use C4::Auth;
41 use C4::Context;
42 use C4::Output;
43 use CGI qw ( -utf8 );
44 use C4::Koha;
45 use C4::Biblio;
46 use C4::Items;
47 use C4::Members; # to use GetMember
48 use C4::Serials; # CountSubscriptionFromBiblionumber
49 use C4::Search; # enabled_staff_search_views
50 use C4::Acquisition qw(GetOrdersByBiblionumber);
53 #---- Internal function
56 my $query = new CGI;
57 my $dbh = C4::Context->dbh;
59 my $biblionumber = $query->param('biblionumber');
60 $biblionumber = HTML::Entities::encode($biblionumber);
62 # open template
63 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
65 template_name => "catalogue/ISBDdetail.tt",
66 query => $query,
67 type => "intranet",
68 authnotrequired => 0,
69 flagsrequired => { catalogue => 1 },
73 my $res = GetISBDView($biblionumber, "intranet");
74 if ( not defined $res ) {
75 # biblionumber invalid -> report and exit
76 $template->param( unknownbiblionumber => 1,
77 biblionumber => $biblionumber
79 output_html_with_http_headers $query, $cookie, $template->output;
80 exit;
83 if($query->cookie("holdfor")){
84 my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
85 $template->param(
86 holdfor => $query->cookie("holdfor"),
87 holdfor_surname => $holdfor_patron->{'surname'},
88 holdfor_firstname => $holdfor_patron->{'firstname'},
89 holdfor_cardnumber => $holdfor_patron->{'cardnumber'},
93 # count of item linked with biblio
94 my $itemcount = GetItemsCount($biblionumber);
95 $template->param( count => $itemcount);
96 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
98 if ($subscriptionsnumber) {
99 my $subscriptions = GetSubscriptionsFromBiblionumber($biblionumber);
100 my $subscriptiontitle = $subscriptions->[0]{'bibliotitle'};
101 $template->param(
102 subscriptionsnumber => $subscriptionsnumber,
103 subscriptiontitle => $subscriptiontitle,
106 my $record = GetMarcBiblio($biblionumber);
108 $template->param (
109 ISBD => $res,
110 biblionumber => $biblionumber,
111 isbdview => 1,
112 z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
113 ocoins => GetCOinSBiblio($record),
114 C4::Search::enabled_staff_search_views,
115 searchid => scalar $query->param('searchid'),
118 my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber);
119 my @deletedorders_using_biblio;
120 my @orders_using_biblio;
121 my @baskets_orders;
122 my @baskets_deletedorders;
124 foreach my $myorder (@allorders_using_biblio) {
125 my $basket = $myorder->{'basketno'};
126 if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){
127 push @deletedorders_using_biblio, $myorder;
128 unless (grep(/^$basket$/, @baskets_deletedorders)){
129 push @baskets_deletedorders,$myorder->{'basketno'};
132 else {
133 push @orders_using_biblio, $myorder;
134 unless (grep(/^$basket$/, @baskets_orders)){
135 push @baskets_orders,$myorder->{'basketno'};
140 my $count_orders_using_biblio = scalar @orders_using_biblio ;
141 $template->param (countorders => $count_orders_using_biblio);
143 my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ;
144 $template->param (countdeletedorders => $count_deletedorders_using_biblio);
146 my $holds = C4::Reserves::GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dates => 1 });
147 my $holdcount = scalar( @$holds );
148 $template->param( holdcount => scalar ( @$holds ) );
150 output_html_with_http_headers $query, $cookie, $template->output;