From 251ff13a6069febffa3c9ce32fea59cd7fb99a28 Mon Sep 17 00:00:00 2001 From: Blou Date: Wed, 19 Aug 2015 17:03:57 -0400 Subject: [PATCH] Bug 16126 - Display base-level amounts on the acquisition module home page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch will display on the acquisition module home page the information already displayed on the "manage fund" page (aqbudgets.pl). Currently, Koha display the base-level amounts only. This patch will : 1. rename the column "ordered", "spent" and "available" to "base-level [ordered|spent|available]" 2. add the column "ordered", "spent" and available with the same calculation from the "manage fund" page. TEST PLAN : 1. Go to the Administration module 2. Add a new budget (ie : Budget 2016) 3. Add a fund to this budget (ie : Book) 4. Add a child fund (ie : Adult fiction) You will have this hierarchy : Budget 2016 |____ Book |_____ Adult fiction 5. Go to the Acquisition module 6. Place an order and use the "Adult fiction" budget 7. Go back the Acquisition home page and compare the table with the table from the aqbudgets.pl page (Administration > Budget > Fund) 8. You will see : BEFORE PATCH : the base level amounts only AFTER PATCH : the base level and the total amounts Followed test plan, works as expected. Signed-off-by: Marc VĂ©ron Signed-off-by: Tomas Cohen Arazi I tested the functionality and it works as expected. It also passes the QA script. It basically adds 'base-level' information to the acquisitions page. The only difference with what is displayed on the funds page is that it doesn't add the base-level available amounts. So the table is more compact and easy to follow. I think this is a useful enhancement even if it makes this table closer to the funds one. I checked it totalizes correctly on each scenario and respects the acq workflow exactly as the funds table. --- acqui/acqui-home.pl | 8 +++++++- .../intranet-tmpl/prog/en/modules/acqui/acqui-home.tt | 16 +++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 9c70773..0959bbc 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -78,6 +78,12 @@ foreach my $budget ( @{$budget_arr} ) { if ( !defined $budget->{budget_amount} ) { $budget->{budget_amount} = 0; } + + $budget->{'budget_ordered'} = GetBudgetOrdered( $budget->{'budget_id'} ); + $budget->{'budget_spent'} = GetBudgetSpent( $budget->{'budget_id'} ); + $budget->{'total_spent'} = GetBudgetHierarchySpent( $budget->{'budget_id'} ) // 0; + $budget->{'total_ordered'} = GetBudgetHierarchyOrdered( $budget->{'budget_id'} ) // 0; + if ( !defined $budget->{budget_spent} ) { $budget->{budget_spent} = 0; } @@ -85,7 +91,7 @@ foreach my $budget ( @{$budget_arr} ) { $budget->{budget_ordered} = 0; } $budget->{'budget_avail'} = - $budget->{'budget_amount'} - ( $budget->{'budget_spent'} + $budget->{'budget_ordered'} ); + $budget->{'budget_amount'} - ( $budget->{'total_spent'} + $budget->{'total_ordered'} ); $total += $budget->{'budget_amount'}; $totspent += $budget->{'budget_spent'}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt index 087d238..cb21a67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt @@ -85,8 +85,10 @@ Owner Library Amount - Ordered - Spent + Base-level ordered + Total ordered + Base-level spent + Total spent Total available @@ -97,7 +99,9 @@ Total + [% totordered_active | $Price %] + [% totspent_active | $Price %] @@ -143,7 +147,10 @@ - + [% loop_budge.total_ordered | $Price %] + + + [% IF loop_budge.budget_parent_id %] [% loop_budge.budget_spent | $Price %] [% ELSE %] @@ -152,6 +159,9 @@ + [% loop_budge.total_spent | $Price %] + + [% IF loop_budge.budget_parent_id %] [% loop_budge.budget_avail | $Price %] [% ELSE %] -- 2.7.4