12 use C4::Interface::CGI::Output;
18 my $op = $query->param('op');
19 my $dbh = C4::Context->dbh;
20 my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
21 $dow, $numberlength, $weeklength, $monthlength,
22 $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
23 $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
24 $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
25 $numberingmethod, $status, $biblionumber,
26 $bibliotitle, $notes);
29 my ($template, $loggedinuser, $cookie)
30 = get_template_and_user({template_name => "bull/subscription-add.tmpl",
34 flagsrequired => {catalogue => 1},
40 my $subscriptionid = $query->param('subscriptionid');
41 my $subs = &getsubscription($subscriptionid);
42 $auser = $subs->{'user'};
43 $librarian => $subs->{'librarian'},
44 $cost = $subs->{'cost'};
45 $aqbooksellerid = $subs->{'aqbooksellerid'};
46 $aqbooksellername = $subs->{'aqbooksellername'};
47 $bookfundid = $subs->{'bookfundid'};
48 $aqbudgetid = $subs->{'aqbudgetid'};
49 $startdate = $subs->{'startdate'};
50 $periodicity = $subs->{'periodicity'};
51 $dow = $subs->{'dow'};
52 $numberlength = $subs->{'numberlength'};
53 $weeklength = $subs->{'weeklength'};
54 $monthlength = $subs->{'monthlength'};
55 $add1 = $subs->{'add1'};
56 $every1 = $subs->{'every1'};
57 $whenmorethan1 = $subs->{'whenmorethan1'};
58 $setto1 = $subs->{'setto1'};
59 $lastvalue1 = $subs->{'lastvalue1'};
60 $innerloop1 = $subs->{'innerloop1'};
61 $add2 = $subs->{'add2'};
62 $every2 = $subs->{'every2'};
63 $whenmorethan2 = $subs->{'whenmorethan2'};
64 $setto2 = $subs->{'setto2'};
65 $lastvalue2 = $subs->{'lastvalue2'};
66 $innerloop2 = $subs->{'innerloop2'};
67 $add3 = $subs->{'add3'};
68 $every3 = $subs->{'every3'};
69 $whenmorethan3 = $subs->{'whenmorethan3'};
70 $setto3 = $subs->{'setto3'};
71 $lastvalue3 = $subs->{'lastvalue3'};
72 $innerloop3 = $subs->{'innerloop3'};
73 $numberingmethod = $subs->{'numberingmethod'};
74 $status = $subs->{status};
75 $biblionumber = $subs->{'biblionumber'};
76 $bibliotitle = $subs->{'bibliotitle'},
77 $notes = $subs->{'notes'};
81 librarian => $librarian,
82 aqbooksellerid => $aqbooksellerid,
83 aqbooksellername => $aqbooksellername,
85 aqbudgetid => $aqbudgetid,
86 bookfundid => $bookfundid,
87 startdate => format_date($startdate),
88 periodicity => $periodicity,
90 numberlength => $numberlength,
91 weeklength => $weeklength,
92 monthlength => $monthlength,
95 whenmorethan1 => $whenmorethan1,
97 lastvalue1 => $lastvalue1,
98 innerloop1 => $innerloop1,
101 whenmorethan2 => $whenmorethan2,
103 lastvalue2 => $lastvalue2,
104 innerloop2 => $innerloop2,
107 whenmorethan3 => $whenmorethan3,
109 lastvalue3 => $lastvalue3,
110 innerloop3 => $innerloop3,
111 numberingmethod => $numberingmethod,
113 biblionumber => $biblionumber,
114 bibliotitle => $bibliotitle,
116 subscriptionid => $subscriptionid,
119 "periodicity$periodicity" => 1,
123 (my $temp,@budgets) = bookfunds();
124 # find default value & set it for the template
125 for (my $i=0;$i<=$#budgets;$i++) {
126 if ($budgets[$i]->{'aqbudgetid'} eq $aqbudgetid) {
127 $budgets[$i]->{'selected'}=1;
130 $template->param(budgets => \@budgets);
132 if ($op eq 'addsubscription') {
133 my $auser = $query->param('user');
134 my $aqbooksellerid = $query->param('aqbooksellerid');
135 my $cost = $query->param('cost');
136 my $aqbudgetid = $query->param('aqbudgetid');
137 my $startdate = $query->param('startdate');
138 my $periodicity = $query->param('periodicity');
139 my $dow = $query->param('dow');
140 my $numberlength = $query->param('numberlength');
141 my $weeklength = $query->param('weeklength');
142 my $monthlength = $query->param('monthlength');
143 my $add1 = $query->param('add1');
144 my $every1 = $query->param('every1');
145 my $whenmorethan1 = $query->param('whenmorethan1');
146 my $setto1 = $query->param('setto1');
147 my $lastvalue1 = $query->param('lastvalue1');
148 my $add2 = $query->param('add2');
149 my $every2 = $query->param('every2');
150 my $whenmorethan2 = $query->param('whenmorethan2');
151 my $setto2 = $query->param('setto2');
152 my $lastvalue2 = $query->param('lastvalue2');
153 my $add3 = $query->param('add3');
154 my $every3 = $query->param('every3');
155 my $whenmorethan3 = $query->param('whenmorethan3');
156 my $setto3 = $query->param('setto3');
157 my $lastvalue3 = $query->param('lastvalue3');
158 my $numberingmethod = $query->param('numberingmethod');
160 my $biblionumber = $query->param('biblionumber');
161 my $notes = $query->param('notes');
162 my $subscriptionid = newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
163 $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
164 $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
165 $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
166 $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
167 $numberingmethod, $status, $notes
169 print $query->redirect("/cgi-bin/koha/bull/subscription-detail.pl?subscriptionid=$subscriptionid");
171 output_html_with_http_headers $query, $cookie, $template->output;