[Koha-bugs] [Bug 33608] Allow to get statistics about found/recovered books

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jul 20 11:20:36 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33608

--- Comment #63 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
diff --git a/Koha/Statistic.pm b/Koha/Statistic.pm
index 2aa4044ce9..479c6472a2 100644
--- a/Koha/Statistic.pm
+++ b/Koha/Statistic.pm
@@ -73,7 +73,7 @@ sub new {
     Koha::Exceptions::BadParameter->throw( parameter => $params ) if !$params
|| ref($params) ne 'HASH';
     Koha::Exceptions::WrongParameter->throw( name => 'type', value =>
$params->{type} ) if !$params->{type};

-    if ( $params->{amount} ) {
+    if ( exists $params->{amount} ) {
         $params->{value} //= delete $params->{amount}; # legacy amount
parameter supported
     }

diff --git a/t/db_dependent/Koha/Statistics.t
b/t/db_dependent/Koha/Statistics.t
index 999d1b8567..a7f2c20d4e 100755
--- a/t/db_dependent/Koha/Statistics.t
+++ b/t/db_dependent/Koha/Statistics.t
@@ -73,7 +73,7 @@ subtest 'Basic Koha object tests' => sub {
 };

 subtest 'Test exceptions in ->new' => sub {
-    plan tests => 5;
+    plan tests => 6;
     $schema->storage->txn_begin;

     throws_ok { Koha::Statistic->new } 'Koha::Exceptions::BadParameter',
'->new called without params';
@@ -93,6 +93,8 @@ subtest 'Test exceptions in ->new' => sub {
     $params->{type} = 'payment';
     delete $params->{amount};
     throws_ok { Koha::Statistic->new($params) }
'Koha::Exceptions::MissingParameter', '->new called for accounts without
amount';
+    $params->{amount} = 0;
+    lives_ok { Koha::Statistic->new($params) } '->new accepts zero amount';
     $params->{type} = 'issue';
     delete $params->{itemnumber};
     throws_ok { Koha::Statistic->new($params) }
'Koha::Exceptions::MissingParameter', '->new called for circulation without
itemnumber';

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list