Bug 40371: Remove warnings from Budgets.t output

t/db_dependent/Budgets.t .. 153/156 Use of uninitialized value in multiplication (*) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 543.
Use of uninitialized value in numeric eq (==) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 554.
t/db_dependent/Budgets.t .. 154/156 Use of uninitialized value in multiplication (*) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 543.
Use of uninitialized value in numeric eq (==) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 554.
t/db_dependent/Budgets.t .. 155/156 Use of uninitialized value in addition (+) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 510.

This change seems correct, but I am not 100% sure it won't introduce a
regression. What about 0 vs undef?

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-07-15 10:58:52 +02:00 committed by Lucas Gass
parent 1835ced4c0
commit 15a8f0444d
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 6 additions and 4 deletions

View File

@ -503,12 +503,13 @@ sub populate_with_prices_for_ordering {
my $discount = $self->discount || 0;
$discount /= 100 if $discount > 1;
my $unitprice = $self->unitprice // 0;
if ( $bookseller->listincgst ) {
# The user entered the prices tax included
$self->unitprice( $self->unitprice + 0 );
$self->unitprice_tax_included( $self->unitprice );
$self->unitprice($unitprice);
$self->unitprice_tax_included($unitprice);
$self->rrp_tax_included( $self->rrp );
# price tax excluded = price tax included / ( 1 + tax rate )
@ -536,7 +537,7 @@ sub populate_with_prices_for_ordering {
} else {
# The user entered the prices tax excluded
$self->unitprice_tax_excluded( $self->unitprice );
$self->unitprice_tax_excluded($unitprice);
$self->rrp_tax_excluded( $self->rrp );
# price tax included = price tax excluded * ( 1 - tax rate )

View File

@ -1,6 +1,7 @@
#!/usr/bin/perl
use Modern::Perl;
use Test::More tests => 156;
use Test::More tests => 157;
use Test::NoWarnings;
use JSON;
BEGIN {