From f40f434a79339d476de00f1f91edc8de40e7ca79 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sat, 22 Jul 2017 19:19:44 +0000 Subject: [PATCH] Bug 18999- Modified SQL query in GetBudgetSpent() in C4/Budgets.pm Removed the SQL select condition 'AND closedate IS NOT NULL' because this was not returning shippingcost values and it does not exist in the SQL query to return the shipping cost in spent.pl Also removed the retrieval of shipping cost and the associated addition of item(s) cost and shipping cost in GetBudgetOrdered() in C4/Budgets.pm to prevent the shipping costs being subtracted off the fund total twice Test plan: 1. Go to Acquisition and create a currency, budget (make this value of 100), fund ( make this the value of 50), vendor (if neccessary) 2. Create a basket and click 'Add to basket' 3. Add 2 items with the vendor price of 10 4. Click 'Receive shipment' and write in the shipment cost of 6 5. Click 'Finish receiving' and go back to Acquisitions 6. Notice the spent column value is 0.00 but if you click on the value then the spent.pl page is displayed and shows that the shipment cost was 6.00 7. On the acquisition page also notice that the ordered column value is 26.00 8. Click on the name of the fund and notice the spent column value is 0.00 in the fund page table 9. Apply patch 10. Refresh acquisition page and notice that 6.00 is the value in the Spent column and 20.00 is the value in the ordered column. Both of which match the subtotal of the full-list tables displayed when you click on these values 11. Also notice the spent value in the fund page table is 6.00 12 Observe the changes to GetBudgetSpent() and GetBudgetOrdered() C4/Budgets.pm and check they make sense Sponsored-by: Catalyst IT Signed-off-by: Katrin Fischer Signed-off-by: Josef Moravec --- C4/Budgets.pm | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 1c0c201..10f5147 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -343,8 +343,8 @@ sub GetBudgetSpent { SELECT SUM(shipmentcost) AS sum FROM aqinvoices WHERE shipmentcost_budgetid = ? - AND closedate IS NOT NULL |); + $sth->execute($budget_id); my ($shipmentcost_sum) = $sth->fetchrow_array; $sum += $shipmentcost_sum; @@ -365,16 +365,6 @@ sub GetBudgetOrdered { $sth->execute($budget_id); my $sum = $sth->fetchrow_array; - $sth = $dbh->prepare(qq| - SELECT SUM(shipmentcost) AS sum - FROM aqinvoices - WHERE shipmentcost_budgetid = ? - AND closedate IS NULL - |); - $sth->execute($budget_id); - my ($shipmentcost_sum) = $sth->fetchrow_array; - $sum += $shipmentcost_sum; - return $sum; } -- 2.1.4