LP#1923076: ensure length of empty array is treated as a number when retrieving hold...
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Thu, 8 Apr 2021 02:41:49 +0000 (19:41 -0700)
committerMike Rylander <mrylander@gmail.com>
Fri, 13 Aug 2021 22:38:41 +0000 (18:38 -0400)
Thanks to Jason Stephenson for suggesting this solution.

Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm

index 72251e4..0faeea2 100644 (file)
@@ -2232,17 +2232,17 @@ sub hold_request_count {
 
     my $resp = {
         total => scalar(@$holds),
-        ready => scalar(@ready)
+        ready => int(scalar(@ready))
     };
 
     if ($ctx_org) {
         # count of holds ready at pickup lib with behind_desk true.
-        $resp->{behind_desk} = scalar(
+        $resp->{behind_desk} = int(scalar(
             grep {
                 $_->{pickup_lib} == $ctx_org and
                 $U->is_true($_->{behind_desk})
             } @ready
-        );
+        ));
     }
 
     return $resp;