]> git.koha-community.org Git - koha.git/commit
Bug 28774: Don't store blank values for rental discount
authorNick Clemens <nick@bywatersolutions.com>
Wed, 28 Jul 2021 12:23:50 +0000 (12:23 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 3 Sep 2021 15:15:53 +0000 (11:15 -0400)
commit11ec644edfeb5342b5b9d8c8bc5469e9b980c58b
tree3be2a3bbc7dee1caef2b50c6aaa3a9cfab6ad6aa
parenta478eb1b4f52d3fb1fa2e8526511e5eb11df1619
Bug 28774: Don't store blank values for rental discount

This patch adds 'can_be_blank => 0' for the rentaldiscount rule to prevent
storing blank values in the database

Additionally, if there is no charge we do not need to check for a discount
and can simply return

To test:
1 - Set rental discount to "" to a rule in circulation rules
2 - Checkout an item that will follow this rule
3 - Check the intranet log:
    [WARN] Argument "" isn't numeric in subtraction (-) at /kohadevbox/koha/C4/Circulation.pm line 3385.
4 - Apply patch and restart all
5 - Update database
6 - Set the rule to "" again
7 - Check the DB, no rule is stored
    SELECT * FROM circulation_rules WHERE rule_name = 'rentaldiscount';
8 - Checkout the item again
9 - No warns in log

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Circulation.pm
Koha/CirculationRules.pm
installer/data/mysql/atomicupdate/bug_28774_remove_blank_rentaldiscount.perl [new file with mode: 0644]