3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with Koha; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 use C4
::Dates qw
/format_date format_date_in_iso/;
29 my $op = $query->param('op') || q{};
30 my $dbh = C4
::Context
->dbh;
31 my $subscriptionid = $query->param('subscriptionid');
32 my $auser = $query->param('user');
33 my $histstartdate = format_date_in_iso
($query->param('histstartdate'));
34 my $enddate = format_date_in_iso
($query->param('enddate'));
35 my $recievedlist = $query->param('recievedlist');
36 my $missinglist = $query->param('missinglist');
37 my $opacnote = $query->param('opacnote');
38 my $librariannote = $query->param('librariannote');
39 my @serialids = $query->param('serialid');
40 my @serialseqs = $query->param('serialseq');
41 my @planneddates = $query->param('planneddate');
42 my @notes = $query->param('notes');
43 my @status = $query->param('status');
45 my ($template, $loggedinuser, $cookie)
46 = get_template_and_user
({template_name
=> "serials/statecollection.tmpl",
50 flagsrequired
=> {serials
=> 1},
54 my $HasSubscriptionExpired = HasSubscriptionExpired
($subscriptionid);
55 my $subscription=GetSubscription
($subscriptionid);
56 if ($op eq 'modsubscriptionhistory') {
57 modsubscriptionhistory
($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote);
59 # change status except, if subscription has expired, for the "waited" issue.
60 if ($op eq 'serialchangestatus') {
61 my $sth = $dbh->prepare("select status from serial where serialid=?");
62 for (my $i=0;$i<=$#serialids;$i++) {
63 $sth->execute($serialids[$i]);
64 my ($oldstatus) = $sth->fetchrow;
66 serialchangestatus
($serialids[$i],$serialseqs[$i],format_date_in_iso
($planneddates[$i]),$status[$i],$notes[$i]) unless ($HasSubscriptionExpired && $oldstatus == 1);
69 if ($serialseqs[$i]) {
70 my $sub=getsubscription
($subscriptionid);
71 newissue
($serialseqs[$i],$subscriptionid,$sub->{biblionumber
},$status[$i], format_date_in_iso
($planneddates[$i]));
76 my $subs = &GetSubscription
($subscriptionid);
77 my ($totalissues,@serialslist) = GetSerials
($subscriptionid,10);
79 my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid = ?");
80 $sth->execute($subscriptionid);
81 my $solhistory = $sth->fetchrow_hashref;
84 serialslist
=> \
@serialslist,
85 biblionumber
=> $subscription->{biblionumber
},
86 histstartdate
=> format_date
($solhistory->{'histstartdate'}),
87 enddate
=> format_date
($solhistory->{'enddate'}),
88 recievedlist
=> $solhistory->{'recievedlist'},
89 missinglist
=> $solhistory->{'missinglist'},
90 opacnote
=> $solhistory->{'opacnote'},
91 librariannote
=> $solhistory->{'librariannote'},
92 subscriptionid
=> $subscriptionid,
93 bibliotitle
=> $subs->{bibliotitle
},
94 biblionumber
=> $subs->{biblionumber
},
95 hassubscriptionexpired
=>$HasSubscriptionExpired,
97 output_html_with_http_headers
$query, $cookie, $template->output;