3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
24 subscription-details.pl
28 this script display the detail of a subscription given on input arg.
35 op use to know the operation to do on this template.
36 * modsubscription : to modify the subscription.
37 * del : to delete this subscription.
39 Note that if op = modsubscription there are a lot of other parameters.
42 The subscription this script has to dislay
56 use C4::Interface::CGI::Output;
61 my $op = $query->param('op') || '';
62 my $dbh = C4::Context->dbh;
65 my ($template, $loggedinuser, $cookie, $subs, $user, $sessionID, $flags);
66 my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
67 $dow, $numberlength, $weeklength, $monthlength,
68 $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
69 $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
70 $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
71 $numberingmethod, $status, $biblionumber, $bibliotitle, $notes,$letter);
73 $subscriptionid = $query->param('subscriptionid');
75 if ($op eq 'modsubscription') {
76 $auser = $query->param('user');
77 $librarian = $query->param('librarian');
78 $cost = $query->param('cost');
79 $aqbooksellerid = $query->param('aqbooksellerid');
80 $biblionumber = $query->param('biblionumber');
81 $aqbudgetid = $query->param('aqbudgetid');
82 $startdate = format_date_in_iso($query->param('startdate'));
83 $periodicity = $query->param('periodicity');
84 $dow = $query->param('dow');
85 $numberlength = $query->param('numberlength');
86 $weeklength = $query->param('weeklength');
87 $monthlength = $query->param('monthlength');
88 $add1 = $query->param('add1');
89 $every1 = $query->param('every1');
90 $whenmorethan1 = $query->param('whenmorethan1');
91 $setto1 = $query->param('setto1');
92 $lastvalue1 = $query->param('lastvalue1');
93 $innerloop1 = $query->param('innerloop1');
94 $add2 = $query->param('add2');
95 $every2 = $query->param('every2');
96 $whenmorethan2 = $query->param('whenmorethan2');
97 $setto2 = $query->param('setto2');
98 $lastvalue2 = $query->param('lastvalue2');
99 $innerloop2 = $query->param('innerloop2');
100 $add3 = $query->param('add3');
101 $every3 = $query->param('every3');
102 $whenmorethan3 = $query->param('whenmorethan3');
103 $setto3 = $query->param('setto3');
104 $lastvalue3 = $query->param('lastvalue3');
105 $innerloop3 = $query->param('innerloop3');
106 $numberingmethod = $query->param('numberingmethod');
108 $notes = $query->param('notes');
109 $letter = $query->param('letter');
111 &ModSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
112 $periodicity,$dow,$numberlength,$weeklength,$monthlength,
113 $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
114 $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
115 $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
116 $numberingmethod, $status, $biblionumber, $notes, $letter, $subscriptionid);
120 &DelSubscription($subscriptionid);
121 print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=../serials-home.pl\"></html>";
124 $subs = &GetSubscription($subscriptionid);
125 # html'ize distributedto
126 $subs->{distributedto}=~ s/\n/<br \/>/g;
127 my ($totalissues,@serialslist) = GetSerials($subscriptionid);
128 $totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscription (only 1 issue)
130 ($template, $loggedinuser, $cookie)
131 = get_template_and_user({template_name => "serials/subscription-detail.tmpl",
134 authnotrequired => 0,
135 flagsrequired => {catalogue => 1},
139 ($user, $cookie, $sessionID, $flags) = checkauth($query, 0, {catalogue => 1}, "intranet");
142 user => $subs->{auser},
143 librarian => $subs->{librarian},
144 aqbooksellerid => $subs->{aqbooksellerid},
145 aqbooksellername => $subs->{aqbooksellername},
146 cost => $subs->{cost},
147 aqbudgetid => $subs->{aqbudgetid},
148 bookfundid => $subs->{bookfundid},
149 startdate => format_date($subs->{startdate}),
150 periodicity => $subs->{periodicity},
152 numberlength => $subs->{numberlength},
153 weeklength => $subs->{weeklength},
154 monthlength => $subs->{monthlength},
155 add1 => $subs->{add1},
156 every1 => $subs->{every1},
157 whenmorethan1 => $subs->{whenmorethan1},
158 innerloop1 => $subs->{innerloop1},
159 setto1 => $subs->{setto1},
160 lastvalue1 => $subs->{lastvalue1},
161 add2 => $subs->{add2},
162 every2 => $subs->{every2},
163 whenmorethan2 => $subs->{whenmorethan2},
164 setto2 => $subs->{setto2},
165 lastvalue2 => $subs->{lastvalue2},
166 innerloop2 => $subs->{innerloop2},
167 add3 => $subs->{add3},
168 every3 => $subs->{every3},
169 whenmorethan3 => $subs->{whenmorethan3},
170 setto3 => $subs->{setto3},
171 lastvalue3 => $subs->{lastvalue3},
172 innerloop3 => $subs->{innerloop3},
173 numberingmethod => $subs->{numberingmethod},
174 status => $subs->{status},
175 biblionumber => $subs->{biblionumber},
176 bibliotitle => $subs->{bibliotitle},
177 notes => $subs->{notes},
178 letter => $subs->{letter},
179 distributedto => $subs->{distributedto},
180 subscriptionid => $subs->{subscriptionid},
181 serialslist => \@serialslist,
182 totalissues => $totalissues,
183 "periodicity$subs->{periodicity}" => 1,
184 "arrival$subs->{dow}" => 1
188 output_html_with_http_headers $query, $cookie, $template->output;