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