https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33608
--- Comment #63 from Marcel de Rooy <[email protected]> --- 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. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
