rel_3_0 moved to HEAD
[koha.git] / serials / serial-issues.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 with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA  02111-1307 USA
19
20 # $Id$
21
22 =head1 NAME
23
24 serial-issue.pl
25
26 =head1 DESCRIPTION
27
28 this script give more information about a susbcription given on input arg.
29
30 =head1 PARAMETERS
31
32 =over 4
33
34 =item selectview
35 can be equal to "full" or not.
36
37 =item biblionumber
38 the biblionumber this script has to give more infos.
39
40 =back
41
42
43 =cut
44
45 use strict;
46 use CGI;
47 use C4::Auth;
48 use C4::Koha;
49 use C4::Date;
50 use C4::Serials;
51 use C4::Output;
52 use C4::Interface::CGI::Output;
53 use C4::Context;
54
55
56 my $query = new CGI;
57 my $dbh = C4::Context->dbh;
58 my $selectview = $query->param('selectview');
59 $selectview = C4::Context->preference("SubscriptionHistory") unless $selectview;
60
61 my $sth;
62 # my $id;
63 my ($template, $loggedinuser, $cookie);
64 my $biblionumber = $query->param('biblionumber');
65 if ($selectview eq "full"){
66     my $subscriptions = GetFullSubscriptionsFromBiblionumber($biblionumber);
67
68     my $title = $subscriptions->[0]{bibliotitle};
69     my $yearmin=$subscriptions->[0]{year};
70     my $yearmax=$subscriptions->[scalar(@$subscriptions)-1]{year};
71
72     ($template, $loggedinuser, $cookie)
73      = get_template_and_user({template_name => "serials/serial-issues-full.tmpl",
74      query => $query,
75      type => "intranet",
76      authnotrequired => 0,
77          flagsrequired => {serials => 1},
78      debug => 1,
79      });
80  
81  # replace CR by <br> in librarian note
82  # $subscription->{opacnote} =~ s/\n/\<br\/\>/g;
83  
84     $template->param(
85         biblionumber => $query->param('biblionumber'),
86         years => $subscriptions,
87         yearmin => $yearmin,
88         yearmax =>$yearmax,
89         bibliotitle => $title,
90         suggestion => C4::Context->preference("suggestion"),
91         virtualshelves => C4::Context->preference("virtualshelves"),
92     );
93
94 } else {
95     my $subscriptions = GetSubscriptionsFromBiblionumber($biblionumber);
96     ($template, $loggedinuser, $cookie)
97     = get_template_and_user({template_name => "serials/serial-issues.tmpl",
98         query => $query,
99         type => "intranet",
100         authnotrequired => 1,
101         debug => 1,
102      });
103
104  # replace CR by <br> in librarian note
105  # $subscription->{opacnote} =~ s/\n/\<br\/\>/g;
106
107     $template->param(
108         biblionumber => "".$query->param('biblionumber'),
109         subscription_LOOP => $subscriptions,
110         suggestion => "".C4::Context->preference("suggestion"),
111         virtualshelves => "".C4::Context->preference("virtualshelves"),
112     );
113 }
114 output_html_with_http_headers $query, $cookie, $template->output;