Bugzilla – Attachment 184074 Details for
Bug 40371
t/db_dependent/Budgets.t generates warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40371: Remove warnings from Budgets.t output
Bug-40371-Remove-warnings-from-Budgetst-output.patch (text/plain), 2.50 KB, created by
Jonathan Druart
on 2025-07-15 08:59:47 UTC
(
hide
)
Description:
Bug 40371: Remove warnings from Budgets.t output
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-15 08:59:47 UTC
Size:
2.50 KB
patch
obsolete
>From e53ba5fd65020e80ec7600081df108750b902a30 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 15 Jul 2025 10:58:52 +0200 >Subject: [PATCH] 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? >--- > Koha/Acquisition/Order.pm | 7 ++++--- > t/db_dependent/Budgets.t | 3 ++- > 2 files changed, 6 insertions(+), 4 deletions(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index 289e4a31153..7f097cc596d 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -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 ) >diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t >index 309c949ddf3..590c8673f24 100755 >--- a/t/db_dependent/Budgets.t >+++ b/t/db_dependent/Budgets.t >@@ -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 { >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40371
:
184074
|
184126