From 5db86430625f2e9eb891aebc2fc409c33ac31320 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 30 Mar 2017 04:15:54 +0000 Subject: [PATCH] [SIGNED-OFF] Bug 18351: Able to delete budget with funds To test: 1) Create a budget, add a fund 2) Delete budget. Notice this is successful and triggers no warning message etc. 3) Go to Funds. Notice the funds appear as if they are not there 4) Go into mysql and view the aqbudgetperiods table - notice the funds are still there and are now inaccessible. 5) Apply patch 6) Create a budget, add a fund 7) Attempt to delete budget. Notice you can't click Delete button. Confirm number of funds in hover message is correct. 8) Delete fund 9) Confirm you can now delete budget. Sponsored-by: Catalyst IT Signed-off-by: Felix Hemme Signed-off-by: Owen Leonard --- admin/aqbudgetperiods.pl | 4 ++++ .../prog/en/modules/admin/aqbudgetperiods.tt | 28 +++++++++++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl index ca2171f..d953658 100755 --- a/admin/aqbudgetperiods.pl +++ b/admin/aqbudgetperiods.pl @@ -263,6 +263,8 @@ my @period_active_loop; foreach my $result ( @{$results} ) { my $budgetperiod = $result; $budgetperiod->{budget_active} = 1; + my @funds = Koha::Database->new()->schema->resultset('Aqbudget')->search({ budget_period_id => $budgetperiod->{budget_period_id} }); + $budgetperiod->{count} = scalar @funds; push( @period_active_loop, $budgetperiod ); } @@ -276,6 +278,8 @@ my @period_inactive_loop; foreach my $result ( @{$results} ) { my $budgetperiod = $result; $budgetperiod->{budget_active} = 1; + my @funds = Koha::Database->new()->schema->resultset('Aqbudget')->search({ budget_period_id => $budgetperiod->{budget_period_id} }); + $budgetperiod->{count} = scalar @funds; push( @period_inactive_loop, $budgetperiod ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt index 76f0701..5150da1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt @@ -3,24 +3,30 @@ [%- BLOCK action_menu %] @@ -566,7 +572,7 @@ [% period_active.budget_period_total | $Price %] - [% PROCESS action_menu block_budget_id=period_active.budget_period_id %] + [% PROCESS action_menu block_budget=period_active %] [% END %] @@ -598,7 +604,7 @@ [% IF ( period_loo.budget_period_locked ) %]Locked [% ELSE %][% END %] [% period_loo.budget_period_total | $Price %] - [% PROCESS action_menu block_budget_id=period_loo.budget_period_id %] + [% PROCESS action_menu block_budget=period_loo %] [% END %] -- 2.1.4