Lines 27-33
use C4::Dates qw/format_date format_date_in_iso/;
Link Here
|
27 |
use C4::Acquisition; |
27 |
use C4::Acquisition; |
28 |
use C4::Output; |
28 |
use C4::Output; |
29 |
use C4::Context; |
29 |
use C4::Context; |
30 |
use C4::Branch; # GetBranches |
30 |
use C4::Branch; # GetBranches |
31 |
use C4::Serials; |
31 |
use C4::Serials; |
32 |
use C4::Letters; |
32 |
use C4::Letters; |
33 |
use Carp; |
33 |
use Carp; |
Lines 43-205
my @budgets;
Link Here
|
43 |
|
43 |
|
44 |
# Permission needed if it is a modification : edit_subscription |
44 |
# Permission needed if it is a modification : edit_subscription |
45 |
# Permission needed otherwise (nothing or dup) : create_subscription |
45 |
# Permission needed otherwise (nothing or dup) : create_subscription |
46 |
my $permission = ($op eq "modify") ? "edit_subscription" : "create_subscription"; |
46 |
my $permission = |
47 |
|
47 |
( $op eq "modify" ) ? "edit_subscription" : "create_subscription"; |
48 |
my ($template, $loggedinuser, $cookie) |
|
|
49 |
= get_template_and_user({template_name => "serials/subscription-add.tmpl", |
50 |
query => $query, |
51 |
type => "intranet", |
52 |
authnotrequired => 0, |
53 |
flagsrequired => {serials => $permission}, |
54 |
debug => 1, |
55 |
}); |
56 |
|
57 |
|
48 |
|
|
|
49 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
50 |
{ |
51 |
template_name => "serials/subscription-add.tmpl", |
52 |
query => $query, |
53 |
type => "intranet", |
54 |
authnotrequired => 0, |
55 |
flagsrequired => { serials => $permission }, |
56 |
debug => 1, |
57 |
} |
58 |
); |
58 |
|
59 |
|
59 |
my $sub_on; |
60 |
my $sub_on; |
60 |
my @subscription_types = ( |
61 |
my @subscription_types = ( 'issues', 'weeks', 'months' ); |
61 |
'issues', 'weeks', 'months' |
|
|
62 |
); |
63 |
my @sub_type_data; |
62 |
my @sub_type_data; |
64 |
|
63 |
|
65 |
my $subs; |
64 |
my $subs; |
66 |
our $firstissuedate; |
65 |
our $firstissuedate; |
67 |
|
66 |
|
68 |
if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { |
67 |
if ( $op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription' ) { |
69 |
|
68 |
|
70 |
my $subscriptionid = $query->param('subscriptionid'); |
69 |
my $subscriptionid = $query->param('subscriptionid'); |
71 |
$subs = GetSubscription($subscriptionid); |
70 |
$subs = GetSubscription($subscriptionid); |
72 |
## FIXME : Check rights to edit if mod. Could/Should display an error message. |
71 |
## FIXME : Check rights to edit if mod. Could/Should display an error message. |
73 |
if ($subs->{'cannotedit'} && $op eq 'modify'){ |
72 |
if ( $subs->{'cannotedit'} && $op eq 'modify' ) { |
74 |
carp "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed"; |
73 |
carp "Attempt to modify subscription $subscriptionid by " |
75 |
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); |
74 |
. C4::Context->userenv->{'id'} |
|
|
75 |
. " not allowed"; |
76 |
print $query->redirect( |
77 |
"/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid" |
78 |
); |
76 |
} |
79 |
} |
77 |
$firstissuedate = $subs->{firstacquidate} || ''; # in iso format. |
80 |
$firstissuedate = $subs->{firstacquidate} || ''; # in iso format. |
78 |
for (qw(startdate firstacquidate histstartdate enddate histenddate)) { |
81 |
for (qw(startdate firstacquidate histstartdate enddate histenddate)) { |
79 |
next unless defined $subs->{$_}; |
82 |
next unless defined $subs->{$_}; |
80 |
# TODO : Handle date formats properly. |
83 |
|
81 |
if ($subs->{$_} eq '0000-00-00') { |
84 |
# TODO : Handle date formats properly. |
82 |
$subs->{$_} = '' |
85 |
if ( $subs->{$_} eq '0000-00-00' ) { |
83 |
} else { |
86 |
$subs->{$_} = ''; |
84 |
$subs->{$_} = format_date($subs->{$_}); |
|
|
85 |
} |
87 |
} |
86 |
} |
88 |
else { |
87 |
if (!defined $subs->{letter}) { |
89 |
$subs->{$_} = format_date( $subs->{$_} ); |
88 |
$subs->{letter}= q{}; |
90 |
} |
89 |
} |
91 |
} |
90 |
letter_loop($subs->{'letter'}, $template); |
92 |
if ( !defined $subs->{letter} ) { |
|
|
93 |
$subs->{letter} = q{}; |
94 |
} |
95 |
letter_loop( $subs->{'letter'}, $template ); |
91 |
my $nextexpected = GetNextExpected($subscriptionid); |
96 |
my $nextexpected = GetNextExpected($subscriptionid); |
92 |
$nextexpected->{'isfirstissue'} = $nextexpected->{planneddate}->output('iso') eq $firstissuedate ; |
97 |
$nextexpected->{'isfirstissue'} = |
93 |
$subs->{nextacquidate} = $nextexpected->{planneddate}->output() if($op eq 'modify'); |
98 |
$nextexpected->{planneddate}->output('iso') eq $firstissuedate; |
94 |
unless($op eq 'modsubscription') { |
99 |
$subs->{nextacquidate} = $nextexpected->{planneddate}->output() |
|
|
100 |
if ( $op eq 'modify' ); |
101 |
unless ( $op eq 'modsubscription' ) { |
95 |
foreach my $length_unit (qw(numberlength weeklength monthlength)) { |
102 |
foreach my $length_unit (qw(numberlength weeklength monthlength)) { |
96 |
if ($subs->{$length_unit}){ |
103 |
if ( $subs->{$length_unit} ) { |
97 |
$sub_length=$subs->{$length_unit}; |
104 |
$sub_length = $subs->{$length_unit}; |
98 |
$sub_on=$length_unit; |
105 |
$sub_on = $length_unit; |
99 |
last; |
106 |
last; |
100 |
} |
107 |
} |
101 |
} |
108 |
} |
102 |
|
109 |
|
103 |
$template->param( %{$subs} ); |
110 |
$template->param( %{$subs} ); |
104 |
$template->param("dow".$subs->{'dow'} => 1) if defined $subs->{'dow'}; |
111 |
$template->param( "dow" . $subs->{'dow'} => 1 ) |
|
|
112 |
if defined $subs->{'dow'}; |
105 |
$template->param( |
113 |
$template->param( |
106 |
$op => 1, |
114 |
$op => 1, |
107 |
"subtype_$sub_on" => 1, |
115 |
"subtype_$sub_on" => 1, |
108 |
sublength =>$sub_length, |
116 |
sublength => $sub_length, |
109 |
history => ($op eq 'modify'), |
117 |
history => ( $op eq 'modify' ), |
110 |
"periodicity".$subs->{'periodicity'} => 1, |
118 |
"periodicity" . $subs->{'periodicity'} => 1, |
111 |
"numberpattern".$subs->{'numberpattern'} => 1, |
119 |
"numberpattern" . $subs->{'numberpattern'} => 1, |
112 |
firstacquiyear => substr($firstissuedate,0,4), |
120 |
firstacquiyear => substr( $firstissuedate, 0, 4 ), |
113 |
); |
121 |
); |
114 |
} |
122 |
} |
115 |
|
123 |
|
116 |
if ( $op eq 'dup' ) { |
124 |
if ( $op eq 'dup' ) { |
117 |
my $dont_copy_fields = C4::Context->preference('SubscriptionDuplicateDroppedInput'); |
125 |
my $dont_copy_fields = |
|
|
126 |
C4::Context->preference('SubscriptionDuplicateDroppedInput'); |
118 |
my @fields_id = map { fieldid => $_ }, split '\|', $dont_copy_fields; |
127 |
my @fields_id = map { fieldid => $_ }, split '\|', $dont_copy_fields; |
119 |
$template->param( dont_export_field_loop => \@fields_id ); |
128 |
$template->param( dont_export_field_loop => \@fields_id ); |
120 |
} |
129 |
} |
121 |
} |
130 |
} |
122 |
|
131 |
|
123 |
my $onlymine=C4::Context->preference('IndependantBranches') && |
132 |
my $onlymine = |
124 |
C4::Context->userenv && |
133 |
C4::Context->preference('IndependantBranches') |
125 |
C4::Context->userenv->{flags} % 2 !=1 && |
134 |
&& C4::Context->userenv |
126 |
C4::Context->userenv->{branch}; |
135 |
&& C4::Context->userenv->{flags} % 2 != 1 |
|
|
136 |
&& C4::Context->userenv->{branch}; |
127 |
my $branches = GetBranches($onlymine); |
137 |
my $branches = GetBranches($onlymine); |
128 |
my $branchloop; |
138 |
my $branchloop; |
129 |
for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) { |
139 |
for my $thisbranch ( |
|
|
140 |
sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } |
141 |
keys %{$branches} ) |
142 |
{ |
130 |
my $selected = 0; |
143 |
my $selected = 0; |
131 |
$selected = 1 if (defined($subs) && $thisbranch eq $subs->{'branchcode'}); |
144 |
$selected = 1 if ( defined($subs) && $thisbranch eq $subs->{'branchcode'} ); |
132 |
push @{$branchloop}, { |
145 |
push @{$branchloop}, |
133 |
value => $thisbranch, |
146 |
{ |
134 |
selected => $selected, |
147 |
value => $thisbranch, |
|
|
148 |
selected => $selected, |
135 |
branchname => $branches->{$thisbranch}->{'branchname'}, |
149 |
branchname => $branches->{$thisbranch}->{'branchname'}, |
136 |
}; |
150 |
}; |
137 |
} |
151 |
} |
138 |
|
152 |
|
139 |
my $locations_loop = GetAuthorisedValues("LOC",$subs->{'location'}); |
153 |
my $locations_loop = GetAuthorisedValues( "LOC", $subs->{'location'} ); |
140 |
|
154 |
|
141 |
$template->param(branchloop => $branchloop, |
155 |
$template->param( |
142 |
locations_loop=>$locations_loop, |
156 |
branchloop => $branchloop, |
|
|
157 |
locations_loop => $locations_loop, |
143 |
); |
158 |
); |
|
|
159 |
|
144 |
# prepare template variables common to all $op conditions: |
160 |
# prepare template variables common to all $op conditions: |
145 |
if ($op!~/^mod/) { |
161 |
if ( $op !~ /^mod/ ) { |
146 |
letter_loop(q{}, $template); |
162 |
letter_loop( q{}, $template ); |
147 |
} |
163 |
} |
148 |
|
164 |
|
149 |
if ($op eq 'addsubscription') { |
165 |
if ( $op eq 'addsubscription' ) { |
150 |
redirect_add_subscription(); |
166 |
redirect_add_subscription(); |
151 |
} elsif ($op eq 'modsubscription') { |
167 |
} |
|
|
168 |
elsif ( $op eq 'modsubscription' ) { |
152 |
redirect_mod_subscription(); |
169 |
redirect_mod_subscription(); |
153 |
} else { |
170 |
} |
154 |
while (@subscription_types) { |
171 |
else { |
155 |
my $sub_type = shift @subscription_types; |
172 |
while (@subscription_types) { |
156 |
my %row = ( 'name' => $sub_type ); |
173 |
my $sub_type = shift @subscription_types; |
157 |
if ( defined $sub_on and $sub_on eq $sub_type ) { |
174 |
my %row = ( 'name' => $sub_type ); |
158 |
$row{'selected'} = ' selected'; |
175 |
if ( defined $sub_on and $sub_on eq $sub_type ) { |
159 |
} else { |
176 |
$row{'selected'} = ' selected'; |
160 |
$row{'selected'} = ''; |
|
|
161 |
} |
162 |
push( @sub_type_data, \%row ); |
163 |
} |
177 |
} |
164 |
$template->param(subtype => \@sub_type_data); |
178 |
else { |
|
|
179 |
$row{'selected'} = ''; |
180 |
} |
181 |
push( @sub_type_data, \%row ); |
182 |
} |
183 |
$template->param( subtype => \@sub_type_data ); |
165 |
|
184 |
|
166 |
letter_loop( '', $template ) if ($op ne 'modsubscription' && $op ne 'dup' && $op ne 'modify'); |
185 |
letter_loop( '', $template ) |
|
|
186 |
if ( $op ne 'modsubscription' && $op ne 'dup' && $op ne 'modify' ); |
167 |
|
187 |
|
168 |
my $new_biblionumber = $query->param('biblionumber_for_new_subscription'); |
188 |
my $new_biblionumber = $query->param('biblionumber_for_new_subscription'); |
169 |
if (defined $new_biblionumber) { |
189 |
if ( defined $new_biblionumber ) { |
170 |
my $bib = GetBiblioData($new_biblionumber); |
190 |
my $bib = GetBiblioData($new_biblionumber); |
171 |
if (defined $bib) { |
191 |
if ( defined $bib ) { |
172 |
$template->param(bibnum => $new_biblionumber); |
192 |
$template->param( bibnum => $new_biblionumber ); |
173 |
$template->param(bibliotitle => $bib->{title}); |
193 |
$template->param( bibliotitle => $bib->{title} ); |
174 |
} |
194 |
} |
175 |
} |
195 |
} |
176 |
$template->param((uc(C4::Context->preference("marcflavour"))) => 1); |
196 |
$template->param( ( uc( C4::Context->preference("marcflavour") ) ) => 1 ); |
177 |
output_html_with_http_headers $query, $cookie, $template->output; |
197 |
output_html_with_http_headers $query, $cookie, $template->output; |
178 |
} |
198 |
} |
179 |
|
199 |
|
180 |
sub letter_loop { |
200 |
sub letter_loop { |
181 |
my ($selected_letter, $templte) = @_; |
201 |
my ( $selected_letter, $templte ) = @_; |
182 |
my $letters = GetLetters('serial'); |
202 |
my $letters = GetLetters('serial'); |
183 |
my $letterloop; |
203 |
my $letterloop; |
184 |
foreach my $thisletter (keys %{$letters}) { |
204 |
foreach my $thisletter ( keys %{$letters} ) { |
185 |
push @{$letterloop}, { |
205 |
push @{$letterloop}, |
186 |
value => $thisletter, |
206 |
{ |
187 |
selected => $thisletter eq $selected_letter, |
207 |
value => $thisletter, |
|
|
208 |
selected => $thisletter eq $selected_letter, |
188 |
lettername => $letters->{$thisletter}, |
209 |
lettername => $letters->{$thisletter}, |
189 |
}; |
210 |
}; |
190 |
} |
211 |
} |
191 |
$templte->param(letterloop => $letterloop); |
212 |
$templte->param( letterloop => $letterloop ); |
192 |
return; |
213 |
return; |
193 |
} |
214 |
} |
194 |
|
215 |
|
195 |
sub _get_sub_length { |
216 |
sub _get_sub_length { |
196 |
my ($type, $length) = @_; |
217 |
my ( $type, $length ) = @_; |
197 |
return |
218 |
return ( |
198 |
( |
219 |
$type eq 'numberlength' ? $length : 0, |
199 |
$type eq 'numberlength' ? $length : 0, |
220 |
$type eq 'weeklength' ? $length : 0, |
200 |
$type eq 'weeklength' ? $length : 0, |
221 |
$type eq 'monthlength' ? $length : 0, |
201 |
$type eq 'monthlength' ? $length : 0, |
222 |
); |
202 |
); |
|
|
203 |
} |
223 |
} |
204 |
|
224 |
|
205 |
sub redirect_add_subscription { |
225 |
sub redirect_add_subscription { |
Lines 214-221
sub redirect_add_subscription {
Link Here
|
214 |
my $numberpattern = $query->param('numbering_pattern'); |
234 |
my $numberpattern = $query->param('numbering_pattern'); |
215 |
my $graceperiod = $query->param('graceperiod') || 0; |
235 |
my $graceperiod = $query->param('graceperiod') || 0; |
216 |
|
236 |
|
217 |
my ( $numberlength, $weeklength, $monthlength ) |
237 |
my ( $numberlength, $weeklength, $monthlength ) = |
218 |
= _get_sub_length( $query->param('subtype'), $query->param('sublength') ); |
238 |
_get_sub_length( $query->param('subtype'), $query->param('sublength') ); |
219 |
my $add1 = $query->param('add1'); |
239 |
my $add1 = $query->param('add1'); |
220 |
my $every1 = $query->param('every1'); |
240 |
my $every1 = $query->param('every1'); |
221 |
my $whenmorethan1 = $query->param('whenmorethan1'); |
241 |
my $whenmorethan1 = $query->param('whenmorethan1'); |
Lines 247-357
sub redirect_add_subscription {
Link Here
|
247 |
my $staffdisplaycount = $query->param('staffdisplaycount'); |
267 |
my $staffdisplaycount = $query->param('staffdisplaycount'); |
248 |
my $opacdisplaycount = $query->param('opacdisplaycount'); |
268 |
my $opacdisplaycount = $query->param('opacdisplaycount'); |
249 |
my $location = $query->param('location'); |
269 |
my $location = $query->param('location'); |
250 |
my $startdate = format_date_in_iso( $query->param('startdate') ); |
270 |
my $startdate = format_date_in_iso( $query->param('startdate') ); |
251 |
my $enddate = format_date_in_iso( $query->param('enddate') ); |
271 |
my $enddate = format_date_in_iso( $query->param('enddate') ); |
252 |
my $firstacquidate = format_date_in_iso($query->param('firstacquidate')); |
272 |
my $firstacquidate = format_date_in_iso( $query->param('firstacquidate') ); |
253 |
my $histenddate = format_date_in_iso($query->param('histenddate')); |
273 |
my $histenddate = format_date_in_iso( $query->param('histenddate') ); |
254 |
my $histstartdate = format_date_in_iso($query->param('histstartdate')); |
274 |
my $histstartdate = format_date_in_iso( $query->param('histstartdate') ); |
255 |
my $recievedlist = $query->param('recievedlist'); |
275 |
my $recievedlist = $query->param('recievedlist'); |
256 |
my $missinglist = $query->param('missinglist'); |
276 |
my $missinglist = $query->param('missinglist'); |
257 |
my $opacnote = $query->param('opacnote'); |
277 |
my $opacnote = $query->param('opacnote'); |
258 |
my $librariannote = $query->param('librariannote'); |
278 |
my $librariannote = $query->param('librariannote'); |
259 |
my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, |
279 |
my $subscriptionid = NewSubscription( |
260 |
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength, |
280 |
$auser, $branchcode, |
261 |
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1, |
281 |
$aqbooksellerid, $cost, |
262 |
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2, |
282 |
$aqbudgetid, $biblionumber, |
263 |
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3, |
283 |
$startdate, $periodicity, |
264 |
$numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity), |
284 |
$dow, $numberlength, |
265 |
$numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes, |
285 |
$weeklength, $monthlength, |
266 |
$serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate |
286 |
$add1, $every1, |
267 |
); |
287 |
$whenmorethan1, $setto1, |
268 |
ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote); |
288 |
$lastvalue1, $innerloop1, |
269 |
|
289 |
$add2, $every2, |
270 |
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); |
290 |
$whenmorethan2, $setto2, |
|
|
291 |
$lastvalue2, $innerloop2, |
292 |
$add3, $every3, |
293 |
$whenmorethan3, $setto3, |
294 |
$lastvalue3, $innerloop3, |
295 |
$numberingmethod, $status, |
296 |
$notes, $letter, |
297 |
$firstacquidate, join( ",", @irregularity ), |
298 |
$numberpattern, $callnumber, |
299 |
$hemisphere, ( $manualhistory ? $manualhistory : 0 ), |
300 |
$internalnotes, $serialsadditems, |
301 |
$staffdisplaycount, $opacdisplaycount, |
302 |
$graceperiod, $location, |
303 |
$enddate |
304 |
); |
305 |
ModSubscriptionHistory( |
306 |
$subscriptionid, $histstartdate, $histenddate, $recievedlist, |
307 |
$missinglist, $opacnote, $librariannote |
308 |
); |
309 |
|
310 |
print $query->redirect( |
311 |
"/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid" |
312 |
); |
271 |
return; |
313 |
return; |
272 |
} |
314 |
} |
273 |
|
315 |
|
274 |
sub redirect_mod_subscription { |
316 |
sub redirect_mod_subscription { |
275 |
my $subscriptionid = $query->param('subscriptionid'); |
317 |
my $subscriptionid = $query->param('subscriptionid'); |
276 |
my @irregularity = $query->param('irregularity_select'); |
318 |
my @irregularity = $query->param('irregularity_select'); |
277 |
my $auser = $query->param('user'); |
319 |
my $auser = $query->param('user'); |
278 |
my $librarian => $query->param('librarian'), |
320 |
my $librarian => $query->param('librarian'), |
279 |
my $branchcode = $query->param('branchcode'); |
321 |
my $branchcode = $query->param('branchcode'); |
280 |
my $cost = $query->param('cost'); |
322 |
my $cost = $query->param('cost'); |
281 |
my $aqbooksellerid = $query->param('aqbooksellerid'); |
323 |
my $aqbooksellerid = $query->param('aqbooksellerid'); |
282 |
my $biblionumber = $query->param('biblionumber'); |
324 |
my $biblionumber = $query->param('biblionumber'); |
283 |
my $aqbudgetid = $query->param('aqbudgetid'); |
325 |
my $aqbudgetid = $query->param('aqbudgetid'); |
284 |
my $startdate = format_date_in_iso($query->param('startdate')); |
326 |
my $startdate = format_date_in_iso( $query->param('startdate') ); |
285 |
my $nextacquidate = $query->param('nextacquidate') ? |
327 |
my $nextacquidate = |
286 |
format_date_in_iso($query->param('nextacquidate')): |
328 |
$query->param('nextacquidate') |
287 |
format_date_in_iso($query->param('startdate')); |
329 |
? format_date_in_iso( $query->param('nextacquidate') ) |
288 |
my $enddate = format_date_in_iso($query->param('enddate')); |
330 |
: format_date_in_iso( $query->param('startdate') ); |
|
|
331 |
my $enddate = format_date_in_iso( $query->param('enddate') ); |
289 |
my $periodicity = $query->param('periodicity'); |
332 |
my $periodicity = $query->param('periodicity'); |
290 |
my $dow = $query->param('dow'); |
333 |
my $dow = $query->param('dow'); |
291 |
|
334 |
|
292 |
my ($numberlength, $weeklength, $monthlength) |
335 |
my ( $numberlength, $weeklength, $monthlength ) = |
293 |
= _get_sub_length( $query->param('subtype'), $query->param('sublength') ); |
336 |
_get_sub_length( $query->param('subtype'), $query->param('sublength') ); |
294 |
my $numberpattern = $query->param('numbering_pattern'); |
337 |
my $numberpattern = $query->param('numbering_pattern'); |
295 |
my $add1 = $query->param('add1'); |
338 |
my $add1 = $query->param('add1'); |
296 |
my $every1 = $query->param('every1'); |
339 |
my $every1 = $query->param('every1'); |
297 |
my $whenmorethan1 = $query->param('whenmorethan1'); |
340 |
my $whenmorethan1 = $query->param('whenmorethan1'); |
298 |
my $setto1 = $query->param('setto1'); |
341 |
my $setto1 = $query->param('setto1'); |
299 |
my $lastvalue1 = $query->param('lastvalue1'); |
342 |
my $lastvalue1 = $query->param('lastvalue1'); |
300 |
my $innerloop1 = $query->param('innerloop1'); |
343 |
my $innerloop1 = $query->param('innerloop1'); |
301 |
my $add2 = $query->param('add2'); |
344 |
my $add2 = $query->param('add2'); |
302 |
my $every2 = $query->param('every2'); |
345 |
my $every2 = $query->param('every2'); |
303 |
my $whenmorethan2 = $query->param('whenmorethan2'); |
346 |
my $whenmorethan2 = $query->param('whenmorethan2'); |
304 |
my $setto2 = $query->param('setto2'); |
347 |
my $setto2 = $query->param('setto2'); |
305 |
my $lastvalue2 = $query->param('lastvalue2'); |
348 |
my $lastvalue2 = $query->param('lastvalue2'); |
306 |
my $innerloop2 = $query->param('innerloop2'); |
349 |
my $innerloop2 = $query->param('innerloop2'); |
307 |
my $add3 = $query->param('add3'); |
350 |
my $add3 = $query->param('add3'); |
308 |
my $every3 = $query->param('every3'); |
351 |
my $every3 = $query->param('every3'); |
309 |
my $whenmorethan3 = $query->param('whenmorethan3'); |
352 |
my $whenmorethan3 = $query->param('whenmorethan3'); |
310 |
my $setto3 = $query->param('setto3'); |
353 |
my $setto3 = $query->param('setto3'); |
311 |
my $lastvalue3 = $query->param('lastvalue3'); |
354 |
my $lastvalue3 = $query->param('lastvalue3'); |
312 |
my $innerloop3 = $query->param('innerloop3'); |
355 |
my $innerloop3 = $query->param('innerloop3'); |
313 |
my $numberingmethod = $query->param('numberingmethod'); |
356 |
my $numberingmethod = $query->param('numberingmethod'); |
314 |
my $status = 1; |
357 |
my $status = 1; |
315 |
my $callnumber = $query->param('callnumber'); |
358 |
my $callnumber = $query->param('callnumber'); |
316 |
my $notes = $query->param('notes'); |
359 |
my $notes = $query->param('notes'); |
317 |
my $internalnotes = $query->param('internalnotes'); |
360 |
my $internalnotes = $query->param('internalnotes'); |
318 |
my $hemisphere = $query->param('hemisphere'); |
361 |
my $hemisphere = $query->param('hemisphere'); |
319 |
my $letter = $query->param('letter'); |
362 |
my $letter = $query->param('letter'); |
320 |
my $manualhistory = $query->param('manualhist'); |
363 |
my $manualhistory = $query->param('manualhist'); |
321 |
my $serialsadditems = $query->param('serialsadditems'); |
364 |
my $serialsadditems = $query->param('serialsadditems'); |
|
|
365 |
|
322 |
# subscription history |
366 |
# subscription history |
323 |
my $histenddate = format_date_in_iso($query->param('histenddate')); |
367 |
my $histenddate = format_date_in_iso( $query->param('histenddate') ); |
324 |
my $histstartdate = format_date_in_iso($query->param('histstartdate')); |
368 |
my $histstartdate = format_date_in_iso( $query->param('histstartdate') ); |
325 |
my $recievedlist = $query->param('recievedlist'); |
369 |
my $recievedlist = $query->param('recievedlist'); |
326 |
my $missinglist = $query->param('missinglist'); |
370 |
my $missinglist = $query->param('missinglist'); |
327 |
my $opacnote = $query->param('opacnote'); |
371 |
my $opacnote = $query->param('opacnote'); |
328 |
my $librariannote = $query->param('librariannote'); |
372 |
my $librariannote = $query->param('librariannote'); |
329 |
my $staffdisplaycount = $query->param('staffdisplaycount'); |
373 |
my $staffdisplaycount = $query->param('staffdisplaycount'); |
330 |
my $opacdisplaycount = $query->param('opacdisplaycount'); |
374 |
my $opacdisplaycount = $query->param('opacdisplaycount'); |
331 |
my $graceperiod = $query->param('graceperiod') || 0; |
375 |
my $graceperiod = $query->param('graceperiod') || 0; |
332 |
my $location = $query->param('location'); |
376 |
my $location = $query->param('location'); |
333 |
my $nextexpected = GetNextExpected($subscriptionid); |
377 |
my $nextexpected = GetNextExpected($subscriptionid); |
334 |
# If it's a mod, we need to check the current 'expected' issue, and mod it in the serials table if necessary. |
378 |
|
|
|
379 |
# If it's a mod, we need to check the current 'expected' issue, and mod it in the serials table if necessary. |
335 |
if ( $nextacquidate ne $nextexpected->{planneddate}->output('iso') ) { |
380 |
if ( $nextacquidate ne $nextexpected->{planneddate}->output('iso') ) { |
336 |
ModNextExpected($subscriptionid,C4::Dates->new($nextacquidate,'iso')); |
381 |
ModNextExpected( $subscriptionid, |
337 |
# if we have not received any issues yet, then we also must change the firstacquidate for the subs. |
382 |
C4::Dates->new( $nextacquidate, 'iso' ) ); |
338 |
$firstissuedate = $nextacquidate if($nextexpected->{isfirstissue}); |
383 |
|
|
|
384 |
# if we have not received any issues yet, then we also must change the firstacquidate for the subs. |
385 |
$firstissuedate = $nextacquidate if ( $nextexpected->{isfirstissue} ); |
339 |
} |
386 |
} |
340 |
|
387 |
|
341 |
ModSubscription( |
388 |
ModSubscription( |
342 |
$auser, $branchcode, $aqbooksellerid, $cost, |
389 |
$auser, $branchcode, |
343 |
$aqbudgetid, $startdate, $periodicity, $firstissuedate, |
390 |
$aqbooksellerid, $cost, |
344 |
$dow, join(q{,},@irregularity), $numberpattern, $numberlength, |
391 |
$aqbudgetid, $startdate, |
345 |
$weeklength, $monthlength, $add1, $every1, |
392 |
$periodicity, $firstissuedate, |
346 |
$whenmorethan1, $setto1, $lastvalue1, $innerloop1, |
393 |
$dow, join( q{,}, @irregularity ), |
347 |
$add2, $every2, $whenmorethan2, $setto2, |
394 |
$numberpattern, $numberlength, |
348 |
$lastvalue2, $innerloop2, $add3, $every3, |
395 |
$weeklength, $monthlength, |
349 |
$whenmorethan3, $setto3, $lastvalue3, $innerloop3, |
396 |
$add1, $every1, |
350 |
$numberingmethod, $status, $biblionumber, $callnumber, |
397 |
$whenmorethan1, $setto1, |
351 |
$notes, $letter, $hemisphere, $manualhistory,$internalnotes, |
398 |
$lastvalue1, $innerloop1, |
352 |
$serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid |
399 |
$add2, $every2, |
353 |
); |
400 |
$whenmorethan2, $setto2, |
354 |
ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote); |
401 |
$lastvalue2, $innerloop2, |
355 |
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); |
402 |
$add3, $every3, |
|
|
403 |
$whenmorethan3, $setto3, |
404 |
$lastvalue3, $innerloop3, |
405 |
$numberingmethod, $status, |
406 |
$biblionumber, $callnumber, |
407 |
$notes, $letter, |
408 |
$hemisphere, $manualhistory, |
409 |
$internalnotes, $serialsadditems, |
410 |
$staffdisplaycount, $opacdisplaycount, |
411 |
$graceperiod, $location, |
412 |
$enddate, $subscriptionid |
413 |
); |
414 |
ModSubscriptionHistory( |
415 |
$subscriptionid, $histstartdate, $histenddate, $recievedlist, |
416 |
$missinglist, $opacnote, $librariannote |
417 |
); |
418 |
print $query->redirect( |
419 |
"/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid" |
420 |
); |
356 |
return; |
421 |
return; |
357 |
} |
422 |
} |
358 |
- |
|
|