View | Details | Raw Unified | Return to bug 24669
Collapse All | Expand All

(-)a/admin/smart-rules.pl (-25 / +17 lines)
Lines 261-268 elsif ($op eq 'add') { Link Here
261
    my $firstremind  = $input->param('firstremind');
261
    my $firstremind  = $input->param('firstremind');
262
    my $chargeperiod = $input->param('chargeperiod');
262
    my $chargeperiod = $input->param('chargeperiod');
263
    my $chargeperiod_charge_at = $input->param('chargeperiod_charge_at');
263
    my $chargeperiod_charge_at = $input->param('chargeperiod_charge_at');
264
    my $maxissueqty  = $input->param('maxissueqty');
264
    my $maxissueqty  = strip_non_numeric($input->param('maxissueqty'));
265
    my $maxonsiteissueqty  = $input->param('maxonsiteissueqty');
265
    my $maxonsiteissueqty  = strip_non_numeric($input->param('maxonsiteissueqty'));
266
    my $renewalsallowed  = $input->param('renewalsallowed');
266
    my $renewalsallowed  = $input->param('renewalsallowed');
267
    my $renewalperiod    = $input->param('renewalperiod');
267
    my $renewalperiod    = $input->param('renewalperiod');
268
    my $norenewalbefore  = $input->param('norenewalbefore');
268
    my $norenewalbefore  = $input->param('norenewalbefore');
Lines 273-288 elsif ($op eq 'add') { Link Here
273
    my $no_auto_renewal_after_hard_limit = $input->param('no_auto_renewal_after_hard_limit') || '';
273
    my $no_auto_renewal_after_hard_limit = $input->param('no_auto_renewal_after_hard_limit') || '';
274
    $no_auto_renewal_after_hard_limit = eval { dt_from_string( $input->param('no_auto_renewal_after_hard_limit') ) } if ( $no_auto_renewal_after_hard_limit );
274
    $no_auto_renewal_after_hard_limit = eval { dt_from_string( $input->param('no_auto_renewal_after_hard_limit') ) } if ( $no_auto_renewal_after_hard_limit );
275
    $no_auto_renewal_after_hard_limit = output_pref( { dt => $no_auto_renewal_after_hard_limit, dateonly => 1, dateformat => 'iso' } ) if ( $no_auto_renewal_after_hard_limit );
275
    $no_auto_renewal_after_hard_limit = output_pref( { dt => $no_auto_renewal_after_hard_limit, dateonly => 1, dateformat => 'iso' } ) if ( $no_auto_renewal_after_hard_limit );
276
    my $reservesallowed  = $input->param('reservesallowed');
276
    my $reservesallowed  = strip_non_numeric($input->param('reservesallowed'));
277
    my $holds_per_record = $input->param('holds_per_record');
277
    my $holds_per_record = strip_non_numeric($input->param('holds_per_record'));
278
    my $holds_per_day    = $input->param('holds_per_day');
278
    my $holds_per_day    = strip_non_numeric($input->param('holds_per_day'));
279
    $holds_per_day =~ s/\s//g;
280
    $holds_per_day = '' if $holds_per_day !~ /^\d+/;
281
    my $onshelfholds     = $input->param('onshelfholds') || 0;
279
    my $onshelfholds     = $input->param('onshelfholds') || 0;
282
    $maxissueqty =~ s/\s//g;
283
    $maxissueqty = '' if $maxissueqty !~ /^\d+/;
284
    $maxonsiteissueqty =~ s/\s//g;
285
    $maxonsiteissueqty = '' if $maxonsiteissueqty !~ /^\d+/;
286
    my $issuelength  = $input->param('issuelength');
280
    my $issuelength  = $input->param('issuelength');
287
    $issuelength = $issuelength eq q{} ? undef : $issuelength;
281
    $issuelength = $issuelength eq q{} ? undef : $issuelength;
288
    my $lengthunit  = $input->param('lengthunit');
282
    my $lengthunit  = $input->param('lengthunit');
Lines 342-361 elsif ($op eq 'add') { Link Here
342
}
336
}
343
elsif ($op eq "set-branch-defaults") {
337
elsif ($op eq "set-branch-defaults") {
344
    my $categorycode  = $input->param('categorycode');
338
    my $categorycode  = $input->param('categorycode');
345
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
339
    my $patron_maxissueqty   = strip_non_numeric($input->param('patron_maxissueqty'));
346
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
340
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
341
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
347
    my $holdallowed   = $input->param('holdallowed');
342
    my $holdallowed   = $input->param('holdallowed');
348
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
343
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
349
    my $returnbranch  = $input->param('returnbranch');
344
    my $returnbranch  = $input->param('returnbranch');
350
    my $max_holds = $input->param('max_holds');
345
    my $max_holds = strip_non_numeric($input->param('max_holds'));
351
    $patron_maxissueqty =~ s/\s//g;
352
    $patron_maxissueqty = '' if $patron_maxissueqty !~ /^\d+/;
353
    $patron_maxonsiteissueqty =~ s/\s//g;
354
    $patron_maxonsiteissueqty = '' if $patron_maxonsiteissueqty !~ /^\d+/;
355
    $holdallowed =~ s/\s//g;
346
    $holdallowed =~ s/\s//g;
356
    $holdallowed = undef if $holdallowed !~ /^\d+/;
347
    $holdallowed = undef if $holdallowed !~ /^\d+/;
357
    $max_holds =~ s/\s//g;
358
    $max_holds = '' if $max_holds !~ /^\d+/;
359
348
360
    if ($branch eq "*") {
349
    if ($branch eq "*") {
361
        Koha::CirculationRules->set_rules(
350
        Koha::CirculationRules->set_rules(
Lines 413-425 elsif ($op eq "set-branch-defaults") { Link Here
413
}
402
}
414
elsif ($op eq "add-branch-cat") {
403
elsif ($op eq "add-branch-cat") {
415
    my $categorycode  = $input->param('categorycode');
404
    my $categorycode  = $input->param('categorycode');
416
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
405
    my $patron_maxissueqty = strip_non_numeric($input->param('patron_maxissueqty'));
417
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
406
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
407
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
418
    my $max_holds = $input->param('max_holds');
408
    my $max_holds = $input->param('max_holds');
419
    $patron_maxissueqty =~ s/\s//g;
420
    $patron_maxissueqty = '' if $patron_maxissueqty !~ /^\d+/;
421
    $patron_maxonsiteissueqty =~ s/\s//g;
422
    $patron_maxonsiteissueqty = '' if $patron_maxonsiteissueqty !~ /^\d+/;
423
    $max_holds =~ s/\s//g;
409
    $max_holds =~ s/\s//g;
424
    $max_holds = undef if $max_holds !~ /^\d+/;
410
    $max_holds = undef if $max_holds !~ /^\d+/;
425
411
Lines 620-622 sub by_itemtype { Link Here
620
        return lc $a->{'translated_description'} cmp lc $b->{'translated_description'};
606
        return lc $a->{'translated_description'} cmp lc $b->{'translated_description'};
621
    }
607
    }
622
}
608
}
623
- 
609
610
sub strip_non_numeric {
611
    my $string = shift;
612
    $string =~ s/\s//g;
613
    $string = '' if $string !~ /^\d+/;
614
    return $string;
615
}

Return to bug 24669