7 use C4::Interface::CGI::Output;
13 my $op = $query->param('op');
14 my $dbh = C4::Context->dbh;
15 if ($op eq 'addsubscription')
17 my $auser = $query->param('user');
18 my $supplier = $query->param('supplier');
19 my $cost = $query->param('cost');
20 my $budget = $query->param('budget');
21 my $begin = $query->param('begin');
22 my $frequency = $query->param('frequency');
23 my $dow = $query->param('arrival');
24 my $numberlength = $query->param('numberlength');
25 my $weeklength = $query->param('weeklength');
26 my $monthlength = $query->param('monthlength');
27 my $X = $query->param('X');
28 my $Xstate = $query->param('Xstate');
29 my $Xfreq = $query->param('Xfreq');
30 my $Xstep = $query->param('Xstep');
31 my $Y = $query->param('Y');
32 my $Ystate = $query->param('Ystate');
33 my $Yfreq = $query->param('Yfreq');
34 my $Ystep = $query->param('Ystep');
35 my $Z = $query->param('Z');
36 my $Zstate = $query->param('Zstate');
37 my $Zfreq = $query->param('Zfreq');
38 my $Zstep = $query->param('Zstep');
39 my $sequence = $query->param('sequence');
40 my $arrivalplanified = $query->param('arrivalplanified');
42 my $perioid = $query->param('biblioid');
43 my $notes = $query->param('notes');
45 my $sth=$dbh->prepare("insert into subscription (librarian, aqbooksellerid,cost,aqbudgetid,startdate, periodicity,dow,numberlength,weeklength,monthlength,seqnum1,startseqnum1,seqtype1,freq1,step1,seqnum2,startseqnum2,seqtype2,freq2, step2, seqnum3,startseqnum3,seqtype3, freq3, step3,numberingmethod, arrivalplanified, status, perioid, notes, pos1, pos2, pos3) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, 0, 0, 0)");
46 $sth->execute($auser,$supplier,$cost,$budget,$begin,$frequency,$dow,$numberlength,$weeklength,$monthlength,$X,$X,$Xstate,$Xfreq, $Xstep,$Y,$Y,$Ystate,$Yfreq, $Ystep,$Z,$Z,$Zstate,$Zfreq, $Zstep, $sequence, $arrivalplanified, $status, $perioid, $notes);
47 $sth = $dbh->prepare("select subscriptionid from subscription where perioid = ? and numberingmethod = ?");
48 $sth->execute($perioid, $sequence);
49 my $subid = $sth->fetchrow;
51 $sth = $dbh->prepare("insert into subscriptionhistory (biblioid, subscriptionid, startdate, enddate, missinglist, recievedlist, opacnote, librariannote) values (?,?,?,?,?,?,?,?)");
52 $sth->execute($perioid, $subid, $begin, 0, "", "", 0, $notes);
53 $sth = $dbh->prepare("insert into serial (biblionumber, subscriptionid, serialseq, status, planneddate) values (?,?,?,?,?)");
55 $sth->execute($perioid, $subid, Initialize_Sequence($sequence, $X, $Xstate, $Xfreq, $Xstep, $Y, $Ystate, $Yfreq, $Ystep, $Z, $Zstate, $Zfreq, $Zstep), $status, C4::Bull::Find_Next_Date());
68 my ($template, $loggedinuser, $cookie)
69 = get_template_and_user({template_name => "bull/subscription-add.tmpl",
73 flagsrequired => {catalogue => 1},
77 my ($user, $cookie, $sessionID, $flags)
78 = checkauth($query, 0, {catalogue => 1}, "intranet");
82 output_html_with_http_headers $query, $cookie, $template->output;