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 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
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.
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
33 my $op = $query->param('op');
34 my $dbh = C4::Context->dbh;
38 my ($template, $loggedinuser, $cookie);
39 ($template, $loggedinuser, $cookie)
40 = get_template_and_user({template_name => "serials/serials-collection.tmpl",
44 flagsrequired => {serials => 1},
47 my $biblionumber = $query->param('biblionumber');
48 my @subscriptionid = $query->param('subscriptionid');
50 my $subscriptiondescs ;
53 my @subscriptioninformation=();
54 foreach my $subscriptionid (@subscriptionid){
55 my $subs= GetSubscription($subscriptionid);
56 $subs->{opacnote} =~ s/\n/\<br\/\>/g;
57 $subs->{missinglist} =~ s/\n/\<br\/\>/g;
58 $subs->{recievedlist} =~ s/\n/\<br\/\>/g;
59 ##these are display information
60 $subs->{ "periodicity" . $subs->{periodicity} } = 1;
61 $subs->{ "numberpattern" . $subs->{numberpattern} } = 1;
62 $subs->{ "status" . $subs->{'status'} } = 1;
63 $subs->{startdate} = format_date( $subs->{startdate} );
64 $subs->{histstartdate} = format_date( $subs->{histstartdate} );
65 if ( $subs->{enddate} eq '0000-00-00' ) {
66 $subs->{enddate} = '';
69 $subs->{enddate} = format_date( $subs->{enddate} );
71 $subs->{'abouttoexpire'}=abouttoexpire($subs->{'subscriptionid'});
72 $subs->{'subscriptionexpired'}=HasSubscriptionExpired($subs->{'subscriptionid'});
73 push @$subscriptiondescs,$subs;
74 my $tmpsubscription= GetFullSubscription($subscriptionid);
75 @subscriptioninformation=(@$tmpsubscription,@subscriptioninformation);
77 $subscriptions=PrepareSerialsData(\@subscriptioninformation);
79 $subscriptiondescs = GetSubscriptionsFromBiblionumber($biblionumber) ;
80 my $subscriptioninformation = GetFullSubscriptionsFromBiblionumber($biblionumber);
81 $subscriptions=PrepareSerialsData($subscriptioninformation);
84 my $title = $subscriptiondescs->[0]{bibliotitle};
85 my $yearmax=($subscriptions->[0]{year} eq "manage" && scalar(@$subscriptions)>1)? $subscriptions->[1]{year} :$subscriptions->[0]{year};
86 my $yearmin=$subscriptions->[scalar(@$subscriptions)-1]{year};
87 my $subscriptionidlist="";
88 foreach my $subscription (@$subscriptiondescs){
89 $subscriptionidlist.=$subscription->{'subscriptionid'}."," ;
90 $biblionumber = $subscription->{'bibnum'} unless ($biblionumber);
93 # warn "title : $title yearmax : $yearmax nombre d'elements dans le tableau :".scalar(@$subscriptions);
94 # use Data::Dumper; warn Dumper($subscriptions);
95 chop $subscriptionidlist;
97 onesubscription => (scalar(@$subscriptiondescs)==1),
98 subscriptionidlist => $subscriptionidlist,
99 biblionumber => $biblionumber,
100 subscriptions => $subscriptiondescs,
101 years => $subscriptions,
104 bibliotitle => $title,
105 suggestion => C4::Context->preference("suggestion"),
106 virtualshelves => C4::Context->preference("virtualshelves"),
107 subscr=>$query->param('subscriptionid'),
110 output_html_with_http_headers $query, $cookie, $template->output;