11 use C4::Interface::CGI::Output;
17 my $op = $query->param('op');
18 my $dbh = C4::Context->dbh;
19 my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
20 $dow, $numberlength, $weeklength, $monthlength,
21 $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
22 $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
23 $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
24 $numberingmethod, $arrivalplanified, $status, $biblionumber,
25 $bibliotitle, $notes);
28 my ($template, $loggedinuser, $cookie)
29 = get_template_and_user({template_name => "bull/subscription-add.tmpl",
33 flagsrequired => {catalogue => 1},
39 my $subscriptionid = $query->param('subscriptionid');
40 my $subs = &getsubscription($subscriptionid);
41 $auser = $subs->{'user'};
42 $librarian => $subs->{'librarian'},
43 $cost = $subs->{'cost'};
44 $aqbooksellerid = $subs->{'aqbooksellerid'};
45 $aqbooksellername = $subs->{'aqbooksellername'};
46 $bookfundid = $subs->{'bookfundid'};
47 $aqbudgetid = $subs->{'aqbudgetid'};
48 $startdate = $subs->{'startdate'};
49 $periodicity = $subs->{'periodicity'};
50 $dow = $subs->{'dow'};
51 $numberlength = $subs->{'numberlength'};
52 $weeklength = $subs->{'weeklength'};
53 $monthlength = $subs->{'monthlength'};
54 $add1 = $subs->{'add1'};
55 $every1 = $subs->{'every1'};
56 $whenmorethan1 = $subs->{'whenmorethan1'};
57 $setto1 = $subs->{'setto1'};
58 $lastvalue1 = $subs->{'lastvalue1'};
59 $add2 = $subs->{'add2'};
60 $every2 = $subs->{'every2'};
61 $whenmorethan2 = $subs->{'whenmorethan2'};
62 $setto2 = $subs->{'setto2'};
63 $lastvalue2 = $subs->{'lastvalue2'};
64 $add3 = $subs->{'add3'};
65 $every3 = $subs->{'every3'};
66 $whenmorethan3 = $subs->{'whenmorethan3'};
67 $setto3 = $subs->{'setto3'};
68 $lastvalue3 = $subs->{'lastvalue3'};
69 $numberingmethod = $subs->{'numberingmethod'};
70 $arrivalplanified = $subs->{'arrivalplanified'};
71 $status = $subs->{status};
72 $biblionumber = $subs->{'biblionumber'};
73 $bibliotitle = $subs->{'bibliotitle'},
74 $notes = $subs->{'notes'};
78 librarian => $librarian,
79 aqbooksellerid => $aqbooksellerid,
80 aqbooksellername => $aqbooksellername,
82 aqbudgetid => $aqbudgetid,
83 bookfundid => $bookfundid,
84 startdate => format_date($startdate),
85 periodicity => $periodicity,
87 numberlength => $numberlength,
88 weeklength => $weeklength,
89 monthlength => $monthlength,
92 whenmorethan1 => $whenmorethan1,
94 lastvalue1 => $lastvalue1,
97 whenmorethan2 => $whenmorethan2,
99 lastvalue2 => $lastvalue2,
102 whenmorethan3 => $whenmorethan3,
104 lastvalue3 => $lastvalue3,
105 numberingmethod => $numberingmethod,
106 arrivalplanified => format_date($arrivalplanified),
108 biblionumber => $biblionumber,
109 bibliotitle => $bibliotitle,
111 subscriptionid => $subscriptionid,
114 "periodicity$periodicity" => 1,
118 (my $temp,@budgets) = bookfunds();
119 # find default value & set it for the template
120 for (my $i=0;$i<=$#budgets;$i++) {
121 if ($budgets[$i]->{'aqbudgetid'} eq $aqbudgetid) {
122 $budgets[$i]->{'selected'}=1;
125 $template->param(budgets => \@budgets);
127 if ($op eq 'addsubscription') {
128 my $auser = $query->param('user');
129 my $aqbooksellerid = $query->param('aqbooksellerid');
130 my $cost = $query->param('cost');
131 my $aqbudgetid = $query->param('aqbudgetid');
132 my $startdate = $query->param('startdate');
133 my $periodicity = $query->param('periodicity');
134 my $dow = $query->param('dow');
135 my $numberlength = $query->param('numberlength');
136 my $weeklength = $query->param('weeklength');
137 my $monthlength = $query->param('monthlength');
138 my $add1 = $query->param('add1');
139 my $every1 = $query->param('every1');
140 my $whenmorethan1 = $query->param('whenmorethan1');
141 my $setto1 = $query->param('setto1');
142 my $lastvalue1 = $query->param('lastvalue1');
143 my $add2 = $query->param('add2');
144 my $every2 = $query->param('every2');
145 my $whenmorethan2 = $query->param('whenmorethan2');
146 my $setto2 = $query->param('setto2');
147 my $lastvalue2 = $query->param('lastvalue2');
148 my $add3 = $query->param('add3');
149 my $every3 = $query->param('every3');
150 my $whenmorethan3 = $query->param('whenmorethan3');
151 my $setto3 = $query->param('setto3');
152 my $lastvalue3 = $query->param('lastvalue3');
153 my $numberingmethod = $query->param('numberingmethod');
154 my $arrivalplanified = $query->param('arrivalplanified');
156 my $biblionumber = $query->param('biblionumber');
157 my $notes = $query->param('notes');
158 newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
159 $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
160 $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
161 $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
162 $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
163 $numberingmethod, $arrivalplanified, $status, $notes
168 output_html_with_http_headers $query, $cookie, $template->output;