Bug 23104: (bug 18925 follow-up): Fix null/empty behavior, again
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 12 Jun 2019 14:12:27 +0000 (09:12 -0500)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 18 Jun 2019 09:01:50 +0000 (10:01 +0100)
Not kidding, it's again, and will certainly appear more.
The problem is that we should have a NULL value in DB to make things
more readable and logical. Now we need a quick fix.

Test plan:
Set "Current checkouts allowed" to unlimited (empty string)
Try to check an item out
=> Without this patch we are blocked with a "too many" message
=> With this patch applied the correct behavior is back!

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/Circulation.pm

index 9dd1a23..3061a8e 100644 (file)
@@ -412,7 +412,7 @@ sub TooMany {
     # if a rule is found and has a loan limit set, count
     # how many loans the patron already has that meet that
     # rule
-    if (defined($maxissueqty_rule) and defined($maxissueqty_rule->rule_value)) {
+    if (defined($maxissueqty_rule) and $maxissueqty_rule->rule_value ne '') {
         my @bind_params;
         my $count_query = q|
             SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts