Lines 289-327
sub _guess_enddate {
Link Here
|
289 |
} |
289 |
} |
290 |
|
290 |
|
291 |
sub manage_subscription_numbering_pattern_id { |
291 |
sub manage_subscription_numbering_pattern_id { |
292 |
my $numberpattern; |
292 |
my $params; |
293 |
if ( $query->param('numbering_pattern') eq 'mana' ) { |
293 |
if ( $query->param('numbering_pattern') eq 'mana' ) { |
294 |
my $subscription_np = Koha::Subscription::Numberpattern->new()->set( |
294 |
foreach (qw/numberingmethod label1 add1 every1 whenmorethan1 setto1 |
295 |
{ |
295 |
numbering1 label2 add2 every2 whenmorethan2 setto2 numbering2 |
296 |
label => $query->param('patternname'), |
296 |
label3 add3 every3 whenmorethan3 setto3 numbering3/) { |
297 |
description => $query->param('sndescription'), |
297 |
$params->{$_} = $query->param($_) if $query->param($_); |
298 |
numberingmethod => $query->param('numberingmethod'), |
298 |
} |
299 |
label1 => $query->param('label1'), |
299 |
|
300 |
add1 => $query->param('add1'), |
300 |
my $existing = Koha::Subscription::Numberpatterns->search($params)->next(); |
301 |
every1 => $query->param('every1'), |
301 |
|
302 |
whenmorethan1 => $query->param('whenmorethan1'), |
302 |
if ($existing) { |
303 |
setto1 => $query->param('setto1'), |
303 |
return $existing->id; |
304 |
numbering1 => $query->param('numbering1'), |
304 |
} |
305 |
label2 => $query->param('label2'), |
305 |
|
306 |
add2 => $query->param('add2'), |
306 |
$params->{label} = Koha::Subscription::Numberpattern->uniqueLabel($query->param('patternname')); |
307 |
every2 => $query->param('every2'), |
307 |
$params->{description} = $query->param('sndescription'); |
308 |
whenmorethan2 => $query->param('whenmorethan2'), |
308 |
|
309 |
setto2 => $query->param('setto2'), |
309 |
|
310 |
numbering2 => $query->param('numbering2'), |
310 |
my $subscription_np = Koha::Subscription::Numberpattern->new()->set($params)->store(); |
311 |
label3 => $query->param('label3'), |
311 |
return $subscription_np->id; |
312 |
add3 => $query->param('add3'), |
|
|
313 |
every3 => $query->param('every3'), |
314 |
whenmorethan3 => $query->param('whenmorethan3'), |
315 |
setto3 => $query->param('setto3'), |
316 |
numbering3 => $query->param('numbering3'), |
317 |
} |
318 |
)->store(); |
319 |
$numberpattern = $subscription_np->id; |
320 |
} |
321 |
else { |
322 |
$numberpattern = $query->param('numbering_pattern'); |
323 |
} |
312 |
} |
324 |
return $numberpattern; |
313 |
|
|
|
314 |
return $query->param('numbering_pattern'); |
325 |
} |
315 |
} |
326 |
|
316 |
|
327 |
sub manage_subscription_frequencies_id { |
317 |
sub manage_subscription_frequencies_id { |
328 |
- |
|
|