@@ -, +, @@ [WARN] Argument "" isn't numeric in subtraction (-) at /kohadevbox/koha/C4/Circulation.pm line 3385. SELECT * FROM circulation_rules WHERE rule_name = 'rentaldiscount'; --- C4/Circulation.pm | 24 +++++++++---------- Koha/CirculationRules.pm | 1 + ...bug_28774_remove_blank_rentaldiscount.perl | 8 +++++++ 3 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_28774_remove_blank_rentaldiscount.perl --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -3372,19 +3372,19 @@ sub GetIssuingCharges { if ( my $item_data = $sth->fetchrow_hashref ) { $item_type = $item_data->{itemtype}; $charge = $item_data->{rentalcharge}; - # FIXME This should follow CircControl - my $branch = C4::Context::mybranch(); - my $patron = Koha::Patrons->find( $borrowernumber ); - my $discount = Koha::CirculationRules->get_effective_rule({ - categorycode => $patron->categorycode, - branchcode => $branch, - itemtype => $item_type, - rule_name => 'rentaldiscount' - }); - if ($discount) { - $charge = ( $charge * ( 100 - $discount->rule_value ) ) / 100; - } if ($charge) { + # FIXME This should follow CircControl + my $branch = C4::Context::mybranch(); + my $patron = Koha::Patrons->find( $borrowernumber ); + my $discount = Koha::CirculationRules->get_effective_rule({ + categorycode => $patron->categorycode, + branchcode => $branch, + itemtype => $item_type, + rule_name => 'rentaldiscount' + }); + if ($discount) { + $charge = ( $charge * ( 100 - $discount->rule_value ) ) / 100; + } $charge = sprintf '%.2f', $charge; # ensure no fractions of a penny returned } } --- a/Koha/CirculationRules.pm +++ a/Koha/CirculationRules.pm @@ -156,6 +156,7 @@ our $RULE_KINDS = { }, rentaldiscount => { scope => [ 'branchcode', 'categorycode', 'itemtype' ], + can_be_blank => 0, }, reservesallowed => { scope => [ 'branchcode', 'categorycode', 'itemtype' ], --- a/installer/data/mysql/atomicupdate/bug_28774_remove_blank_rentaldiscount.perl +++ a/installer/data/mysql/atomicupdate/bug_28774_remove_blank_rentaldiscount.perl @@ -0,0 +1,8 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + DELETE FROM circulation_rules + WHERE rule_name = 'rentaldiscount' AND rule_value='' + }); + NewVersion( $DBversion, 28774, "Delete blank rental discounts"); +} --