reordering code & debugging
[wip/koha-chris_n.git] / bull / statecollection.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use CGI;
5 use C4::Auth;
6 use C4::Output;
7 use C4::Interface::CGI::Output;
8 use C4::Context;
9 use C4::Bull;
10 use HTML::Template;
11
12 my $query = new CGI;
13 my $op = $query->param('op');
14 my $dbh = C4::Context->dbh;
15 my $subscriptionid = $query->param('subscriptionid');
16 # warn "$ser la valeur du nom du formulaire";
17 my $auser = $query->param('user');
18 my $startdate = $query->param('startdate');
19 my $enddate = $query->param('enddate');
20 my $recievedlist = $query->param('recievedlist');
21 my $missinglist = $query->param('missinglist');
22 my $opacnote = $query->param('opacnote');
23 my $librariannote = $query->param('librariannote');
24 my @serialids = $query->param('serialid');
25 my @serialseqs = $query->param('serialseq');
26 my @planneddates = $query->param('planneddate');
27 my @status = $query->param('status');
28 if ($op eq 'modsubscriptionhistory') {
29         modsubscriptionhistory($subscriptionid,$startdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote);
30 }
31 if ($op eq 'serialchangestatus') {
32         for (my $i=0;$i<=$#serialids;$i++) {
33                 serialchangestatus($serialids[$i],$serialseqs[$i],$planneddates[$i],$status[$i]);
34         }
35 }
36 my @serialslist = getserials($subscriptionid);
37
38 my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid = ?");
39 $sth->execute($subscriptionid);
40 my $solhistory = $sth->fetchrow_hashref;
41 my ($template, $loggedinuser, $cookie)
42 = get_template_and_user({template_name => "bull/statecollection.tmpl",
43                                 query => $query,
44                                 type => "intranet",
45                                 authnotrequired => 0,
46                                 flagsrequired => {catalogue => 1},
47                                 debug => 1,
48                                 });
49
50         $template->param(
51 #                       user => $user,
52                         serialslist => \@serialslist,
53 #                       status  => $sol->{'status'},
54 #                       waited  => $sol->{'serialseq'},
55                         startdate => $solhistory->{'startdate'},
56                         enddate => $solhistory->{'enddate'},
57                         recievedlist => $solhistory->{'recievedlist'},
58                         missinglist => $solhistory->{'missinglist'},
59                         opacnote => $solhistory->{'opacnote'},
60                         librariannote => $solhistory->{'librariannote'},
61                         subscriptionid => $subscriptionid,
62                 );
63 output_html_with_http_headers $query, $cookie, $template->output;