Bug 21033: Remove few warns in acqui/basket.pl
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 3 Jul 2018 13:52:05 +0000 (15:52 +0200)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 9 Aug 2018 11:31:44 +0000 (11:31 +0000)
Resolve (line numbers based on 16.11.x):
Use of uninitialized value in hash element at acqui/basket.pl line 337.
Use of uninitialized value in hash element at acqui/basket.pl line 338.
Use of uninitialized value in hash element at acqui/basket.pl line 340.
Use of uninitialized value in hash element at acqui/basket.pl line 342.
Use of uninitialized value in hash element at acqui/basket.pl line 344.

Argument "" isn't numeric in multiplication (*) at koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt line 486.
Argument "" isn't numeric in multiplication (*) at koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt line 591.

Test plan:
If you have older acq data, you may have records in aqorders with field
tax_rate_on_ordering is NULL. These orders will trigger the above warns.
If you do not have, you could simulate by setting this field to NULL.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

acqui/basket.pl

index 92fae60..9f2ffdf 100755 (executable)
@@ -340,8 +340,8 @@ if ( $op eq 'list' ) {
             $template->param( uncertainprices => 1 );
         }
 
-        $line->{tax_rate} = $line->{tax_rate_on_ordering};
-        $line->{tax_value} = $line->{tax_value_on_ordering};
+        $line->{tax_rate} = $line->{tax_rate_on_ordering} // 0;
+        $line->{tax_value} = $line->{tax_value_on_ordering} // 0;
 
         push @books_loop, $line;