Bugzilla – Attachment 66160 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: [FOLLOW-UP] Prevent deletion if funds are added after clicking 'Delete' and before confirming delete
Bug-18351-FOLLOW-UP-Prevent-deletion-if-funds-are-.patch (text/plain), 2.51 KB, created by
Aleisha Amohia
on 2017-08-18 02:00:35 UTC
(
hide
)
Description:
Bug 18351: [FOLLOW-UP] Prevent deletion if funds are added after clicking 'Delete' and before confirming delete
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-08-18 02:00:35 UTC
Size:
2.51 KB
patch
obsolete
>From 26874d7b52ea2e8218b57ad460f7f3bd324ff49b Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Fri, 18 Aug 2017 01:58:10 +0000 >Subject: [PATCH] Bug 18351: [FOLLOW-UP] Prevent deletion if funds are added > after clicking 'Delete' and before confirming delete > >To test: >1) Create a budget with no fund >2) Click Delete but do not confirm >3) In another tab, add a fund to this budget >4) Go back to original tab and click 'Yes, delete' >5) Confirm budget is not deleted and an appropriate error message shows >--- > admin/aqbudgetperiods.pl | 15 ++++++++++----- > .../prog/en/modules/admin/aqbudgetperiods.tt | 4 ++++ > 2 files changed, 14 insertions(+), 5 deletions(-) > >diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl >index cdd2788..fbe1938 100755 >--- a/admin/aqbudgetperiods.pl >+++ b/admin/aqbudgetperiods.pl >@@ -127,7 +127,6 @@ elsif ( $op eq 'add_validate' ) { > #-------------------------------------------------- > elsif ( $op eq 'delete_confirm' ) { > ## delete a budget period (preparation) >- my $dbh = C4::Context->dbh; > my $funds = GetBudgets({ budget_period_id => $budget_period_id }); > my $fund_count = scalar @$funds; > if ( $fund_count > 0 ) { >@@ -143,10 +142,16 @@ elsif ( $op eq 'delete_confirm' ) { > } > > elsif ( $op eq 'delete_confirmed' ) { >-## delete the budget period record >- >- my $data = GetBudgetPeriod( $budget_period_id); >- DelBudgetPeriod($budget_period_id); >+ ## confirm no funds have been added to budget >+ my $funds = GetBudgets({ budget_period_id => $budget_period_id }); >+ my $fund_count = scalar @$funds; >+ if ( $fund_count > 0 ) { >+ $template->param( failed_delete_funds_exist => 1 ); >+ } else { >+ ## delete the budget period record >+ my $data = GetBudgetPeriod( $budget_period_id); >+ DelBudgetPeriod($budget_period_id); >+ } > $op='else'; > } > >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 fa4e050..3323b17 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >@@ -542,6 +542,10 @@ > [% IF ( else ) %] > <h2>Budgets administration</h2> > >+ [% IF ( failed_delete_funds_exist ) %] >+ <div class="dialog message">Failed to delete budget because funds exist.</div> >+ [% END %] >+ > [% INCLUDE 'budgets-active-currency.inc' %] > > <div id="budgetsTabs" class="toptabs"> >-- >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