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