Bugzilla – Attachment 61846 Details for
Bug 18351
No warning when deleting budgets that have funds attached
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18351: Able to delete budget with funds
Bug-18351-Able-to-delete-budget-with-funds.patch (text/plain), 5.93 KB, created by
Aleisha Amohia
on 2017-04-04 20:46:50 UTC
(
hide
)
Description:
Bug 18351: Able to delete budget with funds
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-04-04 20:46:50 UTC
Size:
5.93 KB
patch
obsolete
>From 908b935748c5e6b2c860cfa45be1788896ed6f11 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 30 Mar 2017 04:15:54 +0000 >Subject: [PATCH] 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 >--- > 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 7ce5783..e7aedda 100755 >--- a/admin/aqbudgetperiods.pl >+++ b/admin/aqbudgetperiods.pl >@@ -265,6 +265,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 ); > } > >@@ -278,6 +280,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 %] > <div class="dropdown"> >- <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget_id %]" role="button" data-toggle="dropdown" href="#"> >+ <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#"> > Actions <b class="caret"></b> > </a> >- <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetmenu_[% block_budget_id %]"> >+ <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetmenu_[% block_budget.budget_period_id %]"> > <li> >- <a href="[% script_name %]?op=add_form&budget_period_id=[% block_budget_id |html %]"><i class="fa fa-pencil"></i> Edit</a> >- </li> >- <li> >- <a href="[% script_name %]?op=delete_confirm&budget_period_id=[% block_budget_id %]"><i class="fa fa-trash"></i> Delete</a> >+ <a href="[% script_name %]?op=add_form&budget_period_id=[% block_budget.budget_period_id |html %]"><i class="fa fa-pencil"></i> Edit</a> > </li> >+ [% IF block_budget.count %] >+ <li class="disabled"> >+ <a data-toggle="tooltip" data-placement="left" title="[% block_budget.count %] fund(s) are attached to this budget. You must delete all attached funds before deleting this budget." href="#"><i class="fa fa-trash"></i> Delete</a> >+ </li> >+ [% ELSE %] >+ <li> >+ <a href="[% script_name %]?op=delete_confirm&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-trash"></i> Delete</a> >+ </li> >+ [% END %] > <li> >- <a href="[% script_name %]?op=duplicate_form&budget_period_id=[% block_budget_id %]"><i class="fa fa-copy"></i> Duplicate</a> >+ <a href="[% script_name %]?op=duplicate_form&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-copy"></i> Duplicate</a> > </li> > <li> >- <a href="[% script_name %]?op=close_form&budget_period_id=[% block_budget_id %]"><i class="fa fa-times-circle"></i> Close</a> >+ <a href="[% script_name %]?op=close_form&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-times-circle"></i> Close</a> > </li> > <li> >- <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% block_budget_id %]"><i class="fa fa-plus"></i> Add fund</a> >+ <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-plus"></i> Add fund</a> > </li> > </ul> > </div> >@@ -566,7 +572,7 @@ > </td> > <td class="data">[% period_active.budget_period_total | $Price %]</td> > <td> >- [% PROCESS action_menu block_budget_id=period_active.budget_period_id %] >+ [% PROCESS action_menu block_budget=period_active %] > </td> > </tr> > [% END %] >@@ -598,7 +604,7 @@ > <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td> > <td class="data">[% period_loo.budget_period_total | $Price %]</td> > <td> >- [% PROCESS action_menu block_budget_id=period_loo.budget_period_id %] >+ [% PROCESS action_menu block_budget=period_loo %] > </td> > </tr> > [% END %] >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18351
:
61846
|
61871
|
64251
|
64405
|
64664
|
65440
|
65569
|
65570
|
65571
|
65572
|
66160
|
66304
|
66791
|
66974