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

(-)a/admin/smart-rules.pl (-14 / +17 lines)
Lines 255-261 elsif ($op eq 'add') { Link Here
255
    my $itemtype  = $input->param('itemtype');     # item type
255
    my $itemtype  = $input->param('itemtype');     # item type
256
    my $fine = $input->param('fine');
256
    my $fine = $input->param('fine');
257
    my $finedays     = $input->param('finedays');
257
    my $finedays     = $input->param('finedays');
258
    my $maxsuspensiondays = $input->param('maxsuspensiondays') || q{};
258
    my $maxsuspensiondays = $input->param('maxsuspensiondays') || '';
259
    my $suspension_chargeperiod = $input->param('suspension_chargeperiod') || 1;
259
    my $suspension_chargeperiod = $input->param('suspension_chargeperiod') || 1;
260
    my $firstremind  = $input->param('firstremind');
260
    my $firstremind  = $input->param('firstremind');
261
    my $chargeperiod = $input->param('chargeperiod');
261
    my $chargeperiod = $input->param('chargeperiod');
Lines 263-276 elsif ($op eq 'add') { Link Here
263
    my $maxissueqty = strip_non_numeric( scalar $input->param('maxissueqty') );
263
    my $maxissueqty = strip_non_numeric( scalar $input->param('maxissueqty') );
264
    my $maxonsiteissueqty = strip_non_numeric( scalar $input->param('maxonsiteissueqty') );
264
    my $maxonsiteissueqty = strip_non_numeric( scalar $input->param('maxonsiteissueqty') );
265
    my $renewalsallowed  = $input->param('renewalsallowed');
265
    my $renewalsallowed  = $input->param('renewalsallowed');
266
    my $unseen_renewals_allowed  = strip_non_numeric( scalar $input->param('unseen_renewals_allowed') ) // q{};
266
    my $unseen_renewals_allowed  = strip_non_numeric( scalar $input->param('unseen_renewals_allowed') ) // '';
267
    my $renewalperiod    = $input->param('renewalperiod');
267
    my $renewalperiod    = $input->param('renewalperiod');
268
    my $norenewalbefore  = $input->param('norenewalbefore');
268
    my $norenewalbefore  = $input->param('norenewalbefore');
269
    $norenewalbefore = q{} if $norenewalbefore =~ /^\s*$/;
269
    $norenewalbefore = '' if $norenewalbefore =~ /^\s*$/;
270
    my $auto_renew = $input->param('auto_renew') eq 'yes' ? 1 : 0;
270
    my $auto_renew = $input->param('auto_renew') eq 'yes' ? 1 : 0;
271
    my $no_auto_renewal_after = $input->param('no_auto_renewal_after');
271
    my $no_auto_renewal_after = $input->param('no_auto_renewal_after');
272
    $no_auto_renewal_after = q{} if $no_auto_renewal_after =~ /^\s*$/;
272
    $no_auto_renewal_after = '' if $no_auto_renewal_after =~ /^\s*$/;
273
    my $no_auto_renewal_after_hard_limit = $input->param('no_auto_renewal_after_hard_limit') || q{};
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( scalar $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 );
274
    my $reservesallowed  = strip_non_numeric( scalar $input->param('reservesallowed') );
276
    my $reservesallowed  = strip_non_numeric( scalar $input->param('reservesallowed') );
275
    my $holds_per_record = strip_non_numeric( scalar $input->param('holds_per_record') );
277
    my $holds_per_record = strip_non_numeric( scalar $input->param('holds_per_record') );
276
    my $holds_per_day    = strip_non_numeric( scalar $input->param('holds_per_day') );
278
    my $holds_per_day    = strip_non_numeric( scalar $input->param('holds_per_day') );
Lines 278-292 elsif ($op eq 'add') { Link Here
278
    my $issuelength  = $input->param('issuelength') || 0;
280
    my $issuelength  = $input->param('issuelength') || 0;
279
    my $daysmode = $input->param('daysmode');
281
    my $daysmode = $input->param('daysmode');
280
    my $lengthunit  = $input->param('lengthunit');
282
    my $lengthunit  = $input->param('lengthunit');
281
    my $hardduedate = $input->param('hardduedate') || q{};
283
    my $hardduedate = $input->param('hardduedate') || '';
284
    $hardduedate = eval { dt_from_string( scalar $hardduedate ) } if ( $hardduedate );
285
    $hardduedate = output_pref( { dt => $hardduedate, dateonly => 1, dateformat => 'iso' } ) if ( $hardduedate );
282
    my $hardduedatecompare = $input->param('hardduedatecompare');
286
    my $hardduedatecompare = $input->param('hardduedatecompare');
283
    my $rentaldiscount = $input->param('rentaldiscount') || 0;
287
    my $rentaldiscount = $input->param('rentaldiscount') || 0;
284
    my $opacitemholds = $input->param('opacitemholds') || 0;
288
    my $opacitemholds = $input->param('opacitemholds') || 0;
285
    my $article_requests = $input->param('article_requests') || 'no';
289
    my $article_requests = $input->param('article_requests') || 'no';
286
    my $overduefinescap = $input->param('overduefinescap') || q{};
290
    my $overduefinescap = $input->param('overduefinescap') || '';
287
    my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || q{}) eq 'on';
291
    my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on';
288
    my $note = $input->param('note');
292
    my $note = $input->param('note');
289
    my $decreaseloanholds = $input->param('decreaseloanholds') || q{};
293
    my $decreaseloanholds = $input->param('decreaseloanholds') || '';
290
    my $recalls_allowed = $input->param('recalls_allowed');
294
    my $recalls_allowed = $input->param('recalls_allowed');
291
    my $recalls_per_record = $input->param('recalls_per_record');
295
    my $recalls_per_record = $input->param('recalls_per_record');
292
    my $on_shelf_recalls = $input->param('on_shelf_recalls');
296
    my $on_shelf_recalls = $input->param('on_shelf_recalls');
Lines 476-482 elsif ( $op eq "add-open-article-requests-limit" ) { Link Here
476
480
477
    Koha::Exception->throw("No value passed for article request limit")
481
    Koha::Exception->throw("No value passed for article request limit")
478
      if not defined $open_article_requests_limit # There is a JS check for that
482
      if not defined $open_article_requests_limit # There is a JS check for that
479
      || $open_article_requests_limit eq q{};
483
      || $open_article_requests_limit eq '';
480
484
481
    if ( $branch eq "*" ) {
485
    if ( $branch eq "*" ) {
482
        if ( $categorycode eq "*" ) {
486
        if ( $categorycode eq "*" ) {
Lines 550-556 elsif ( $op eq "set-article-request-fee" ) { Link Here
550
554
551
    Koha::Exception->throw("No value passed for article request fee")
555
    Koha::Exception->throw("No value passed for article request fee")
552
      if not defined $fee # There is a JS check for that
556
      if not defined $fee # There is a JS check for that
553
      || $fee eq q{};
557
      || $fee eq '';
554
558
555
    Koha::CirculationRules->set_rules(
559
    Koha::CirculationRules->set_rules(
556
        {   categorycode => ( $category  eq '*' ) ? undef : $category,
560
        {   categorycode => ( $category  eq '*' ) ? undef : $category,
Lines 708-714 my $definedbranch = $all_rules->count ? 1 : 0; Link Here
708
my $rules = {};
712
my $rules = {};
709
while ( my $r = $all_rules->next ) {
713
while ( my $r = $all_rules->next ) {
710
    $r = $r->unblessed;
714
    $r = $r->unblessed;
711
    $rules->{ $r->{categorycode} // q{} }->{ $r->{itemtype} // q{} }->{ $r->{rule_name} } = $r->{rule_value};
715
    $rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->{ $r->{rule_name} } = $r->{rule_value};
712
}
716
}
713
717
714
$template->param(show_branch_cat_rule_form => 1);
718
$template->param(show_branch_cat_rule_form => 1);
Lines 758-763 sub by_itemtype { Link Here
758
sub strip_non_numeric {
762
sub strip_non_numeric {
759
    my $string = shift;
763
    my $string = shift;
760
    $string =~ s/\s//g;
764
    $string =~ s/\s//g;
761
    $string = q{} if $string !~ /^\d+/;
765
    $string = '' if $string !~ /^\d+/;
762
    return $string;
766
    return $string;
763
}
767
}
764
- 

Return to bug 29012