Fix for Bug 3319 - Need error message when adding patron and libraries are defined
[koha.git] / catalogue / ISBDdetail.pl
1 #!/usr/bin/perl
2
3 # Copyright 2000-2002 Katipo Communications
4 #
5 # This file is part of Koha.
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 =head1 NAME
21
22 ISBDdetail.pl : script to show a biblio in ISBD format
23
24 =head1 SYNOPSIS
25
26 =cut
27
28 =head1 DESCRIPTION
29
30 This script needs a biblionumber as parameter 
31
32 =head1 FUNCTIONS
33
34 =cut
35
36 use strict;
37 #use warnings; FIXME - Bug 2505
38
39 use C4::Auth;
40 use C4::Context;
41 use C4::Output;
42 use CGI;
43 use C4::Koha;
44 use C4::Biblio;
45 use C4::Items;
46 use C4::Branch;     # GetBranchDetail
47 use C4::Serials;    # CountSubscriptionFromBiblionumber
48 use C4::Search;         # enabled_staff_search_views
49
50 #---- Internal function
51
52
53 my $query = new CGI;
54 my $dbh = C4::Context->dbh;
55
56 my $biblionumber = $query->param('biblionumber');
57
58 # open template
59 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
60     {
61         template_name => "catalogue/ISBDdetail.tmpl",
62         query         => $query,
63         type          => "intranet",
64         authnotrequired => 0,
65         flagsrequired   => { catalogue => 1 },
66     }
67 );
68
69 # my @blocs = split /\@/,$ISBD;
70 # my @fields = $record->fields();
71 my $res = GetISBDView($biblionumber, "intranet");
72
73 # count of item linked with biblio
74 my $itemcount = GetItemsCount($biblionumber);
75 $template->param( count => $itemcount);
76 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
77  
78 if ($subscriptionsnumber) {
79     my $subscriptions     = GetSubscriptionsFromBiblionumber($biblionumber);
80     my $subscriptiontitle = $subscriptions->[0]{'bibliotitle'};
81     $template->param(
82         subscriptionsnumber => $subscriptionsnumber,
83         subscriptiontitle   => $subscriptiontitle,
84     );
85 }
86
87 $template->param (
88     ISBD                => $res,
89     biblionumber        => $biblionumber,
90         isbdview => 1,
91         z3950_search_params     => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
92         C4::Search::enabled_staff_search_views,
93 );
94
95 output_html_with_http_headers $query, $cookie, $template->output;
96