From f35bb624868d9f3549ed71f8fdf513de7c4ce4d9 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Tue, 21 Feb 2023 22:02:03 +0000 Subject: [PATCH] Bug 31631: (follow-up) Fixes for QA test tool --- C4/Budgets.pm | 16 ++++++++-------- acqui/spent.pl | 2 +- t/db_dependent/Budgets.t | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/C4/Budgets.pm b/C4/Budgets.pm index d22e32245c..26e4c49143 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -352,7 +352,7 @@ sub GetBudgetSpent { quantityreceived > 0 AND datecancellationprinted IS NULL |); - $sth->execute($budget_id); + $sth->execute($budget_id); my $sum = ( $sth->fetchrow_array || 0 ) + 0; $sth = $dbh->prepare(qq| @@ -370,24 +370,24 @@ sub GetBudgetSpent { $sum += $adj->adjustment; } - return $sum; + return $sum; } # ------------------------------------------------------------------- sub GetBudgetOrdered { - my ($budget_id) = @_; - my $dbh = C4::Context->dbh; + my ($budget_id) = @_; + my $dbh = C4::Context->dbh; # Get correct unitprice and ecost prices as possible my ( $unitprice_field, $ecost_field ) = FieldsForCalculatingFundValues(); - my $sth = $dbh->prepare(qq| + my $sth = $dbh->prepare(qq| SELECT SUM(| . C4::Acquisition::get_rounding_sql(qq|$ecost_field|) . qq| * quantity) AS sum FROM aqorders WHERE budget_id = ? AND quantityreceived = 0 AND datecancellationprinted IS NULL |); - $sth->execute($budget_id); + $sth->execute($budget_id); my $sum = ( $sth->fetchrow_array || 0 ) + 0; my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $budget_id, encumber_open => 1, closedate => undef},{ join => 'invoiceid' }); @@ -395,7 +395,7 @@ sub GetBudgetOrdered { $sum += $adj->adjustment; } - return $sum; + return $sum; } =head2 GetBudgetName @@ -1414,7 +1414,7 @@ sub MoveOrders { my ( $unitprice_field, $ecost_field ) = FieldsForCalculatingFundValues(); -Fetch the tax inclusive or tax exclusive database fields for caclulating fund values based +Fetch the tax inclusive or tax exclusive database fields for calculating fund values based on the value of the CalculateFundValuesIncludingTax system preference. =cut diff --git a/acqui/spent.pl b/acqui/spent.pl index 25a5622a02..dfa3a041ae 100755 --- a/acqui/spent.pl +++ b/acqui/spent.pl @@ -21,7 +21,7 @@ =head1 NAME - spent.pl + acqui/spent.pl =head1 DESCRIPTION diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t index 5124e088ac..3c667e2634 100755 --- a/t/db_dependent/Budgets.t +++ b/t/db_dependent/Budgets.t @@ -1221,7 +1221,7 @@ subtest 'FieldsForCalculatingFundValues with a vendor NOT including tax in their t::lib::Mocks::mock_preference('CalculateFundValuesIncludingTax', '1'); my ( $unitprice_field, $ecost_field ) = C4::Budgets->FieldsForCalculatingFundValues(); is ( $unitprice_field, 'unitprice_tax_included', "We expect this to be unitprice_tax_included" ); - is ( $ecost_field, 'ecost_tax_included', "We expect this to be ecost_tax_included" ); + is ( $ecost_field, 'ecost_tax_included', "We expect this to be ecost_tax_included" ); t::lib::Mocks::mock_preference('CalculateFundValuesIncludingTax', '0'); ( $unitprice_field, $ecost_field ) = C4::Budgets->FieldsForCalculatingFundValues(); is ( $unitprice_field, 'unitprice_tax_excluded', "We expect this to be unitprice_tax_excluded" ); @@ -1229,7 +1229,7 @@ subtest 'FieldsForCalculatingFundValues with a vendor NOT including tax in their # Test GetBudgetOrdered() # ----------------------- - + # Build an order t::lib::Mocks::mock_preference('OrderPriceRounding','nearest_cent'); my $item_1 = $builder->build_sample_item; @@ -1325,7 +1325,7 @@ subtest 'FieldsForCalculatingFundValues with a vendor that IS including tax in t t::lib::Mocks::mock_preference('CalculateFundValuesIncludingTax', '1'); my ( $unitprice_field, $ecost_field ) = C4::Budgets->FieldsForCalculatingFundValues(); is ( $unitprice_field, 'unitprice_tax_included', "We expect this to be unitprice_tax_included" ); - is ( $ecost_field, 'ecost_tax_included', "We expect this to be ecost_tax_included" ); + is ( $ecost_field, 'ecost_tax_included', "We expect this to be ecost_tax_included" ); t::lib::Mocks::mock_preference('CalculateFundValuesIncludingTax', '0'); ( $unitprice_field, $ecost_field ) = C4::Budgets->FieldsForCalculatingFundValues(); is ( $unitprice_field, 'unitprice_tax_excluded', "We expect this to be unitprice_tax_excluded" ); -- 2.20.1