Code to allow the associated borrowers to work
[koha.git] / serials / serial-issues.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use CGI;
5 use C4::Auth;
6 use C4::Koha;
7 use C4::Date;
8 use C4::Bull;
9 use C4::Output;
10 use C4::Interface::CGI::Output;
11 use C4::Context;
12 use HTML::Template;
13
14 my $query = new CGI;
15 my $op = $query->param('op');
16 my $dbh = C4::Context->dbh;
17 my $selectview = $query->param('selectview');
18 $selectview = C4::Context->preference("SubscriptionHistory") unless $selectview;
19
20 my $sth;
21 # my $id;
22 my ($template, $loggedinuser, $cookie);
23 my $biblionumber = $query->param('biblionumber');
24 if ($selectview eq "full"){
25         my $subscriptions = get_full_subscription_list_from_biblionumber($biblionumber);
26         
27         my $title = $subscriptions->[0]{bibliotitle};
28         my $yearmin=$subscriptions->[0]{year};
29         my $yearmax=$subscriptions->[scalar(@$subscriptions)-1]{year};
30
31         ($template, $loggedinuser, $cookie)
32         = get_template_and_user({template_name => "serials/serial-issues-full.tmpl",
33                                         query => $query,
34                                         type => "intranet",
35                                         authnotrequired => 1,
36                                         debug => 1,
37                                         });
38         
39         # replace CR by <br> in librarian note
40         # $subscription->{opacnote} =~ s/\n/\<br\/\>/g;
41         
42         $template->param(
43                 biblionumber => $query->param('biblionumber'),
44                 years => $subscriptions,
45                 yearmin => $yearmin,
46                 yearmax =>$yearmax,
47                 bibliotitle => $title,
48                 suggestion => C4::Context->preference("suggestion"),
49                 virtualshelves => C4::Context->preference("virtualshelves"),
50                 );
51
52 } else {
53         my $subscriptions = get_subscription_list_from_biblionumber($biblionumber);
54         
55         ($template, $loggedinuser, $cookie)
56         = get_template_and_user({template_name => "serials/serial-issues.tmpl",
57                                         query => $query,
58                                         type => "intranet",
59                                         authnotrequired => 1,
60                                         debug => 1,
61                                         });
62         
63         # replace CR by <br> in librarian note
64         # $subscription->{opacnote} =~ s/\n/\<br\/\>/g;
65         
66         $template->param(
67                 biblionumber => $query->param('biblionumber'),
68                 subscription_LOOP => $subscriptions,
69                 suggestion => C4::Context->preference("suggestion"),
70                 virtualshelves => C4::Context->preference("virtualshelves"),
71                 );
72 }
73 output_html_with_http_headers $query, $cookie, $template->output;