Bugzilla – Attachment 65440 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 from forcing URL
Bug-18351-FOLLOW-UP-Prevent-deletion-from-forcing-.patch (text/plain), 3.40 KB, created by
Aleisha Amohia
on 2017-08-03 02:06:49 UTC
(
hide
)
Description:
Bug 18351: [FOLLOW-UP] Prevent deletion from forcing URL
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-08-03 02:06:49 UTC
Size:
3.40 KB
patch
obsolete
>From ef0a264fcda367f4b1b2010640328bb55296e2c4 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 3 Aug 2017 02:05:03 +0000 >Subject: [PATCH] Bug 18351: [FOLLOW-UP] Prevent deletion from forcing URL > >This patch adds a check in the script for existing funds so that the >budget cannot be deleted when forcing the URL and has other small fixes. >--- > admin/aqbudgetperiods.pl | 15 ++++++++++----- > .../prog/en/modules/admin/aqbudgetperiods.tt | 8 ++++++-- > 2 files changed, 16 insertions(+), 7 deletions(-) > >diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl >index 2668b4c..cdd2788 100755 >--- a/admin/aqbudgetperiods.pl >+++ b/admin/aqbudgetperiods.pl >@@ -128,12 +128,17 @@ elsif ( $op eq 'add_validate' ) { > elsif ( $op eq 'delete_confirm' ) { > ## delete a budget period (preparation) > my $dbh = C4::Context->dbh; >- ## $total = number of records linked to the record that must be deleted >+ my $funds = GetBudgets({ budget_period_id => $budget_period_id }); >+ my $fund_count = scalar @$funds; >+ if ( $fund_count > 0 ) { >+ $template->param( funds_exist => 1 ); >+ } >+ >+ #$total = number of records linked to the record that must be deleted > my $total = 0; > my $data = GetBudgetPeriod( $budget_period_id); >- > $template->param( >- %$data >+ %$data > ); > } > >@@ -278,8 +283,8 @@ my @period_inactive_loop; > foreach my $result ( @{$results} ) { > my $budgetperiod = $result; > $budgetperiod->{budget_active} = 1; >- my @funds = GetBudgets({ budget_period_id => $budgetperiod->{budget_period_id} }); >- $budgetperiod->{count} = scalar @funds; >+ my $funds = GetBudgets({ 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 5150da1..fa4e050 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >@@ -231,7 +231,7 @@ > [% END %] > [% IF ( delete_confirm ) %] > <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> › >- [% IF ( total ) %] >+ [% IF ( total || funds_exist ) %] > <span>Cannot delete budget '[% budget_period_description %]'</span> > [% ELSE %] > <span>Delete budget '[% budget_period_description %]'?</span> >@@ -407,10 +407,13 @@ > <h3>Cannot delete budget</h3> > <p><strong>This record is used [% total %] times</strong> > . Deletion is not possible.</p> >+ [% ELSIF ( funds_exist ) %] >+ <div class="dialog message"> >+ <h3>Cannot delete budget</h3> >+ <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p> > [% ELSE %] > <div class="dialog alert"> > <h3>Delete budget '[% budget_period_description %]'?</h3> >- [% END %] > > <!-- ############################################################# --> > <!-- "delete" and "cancel" buttons --> >@@ -424,6 +427,7 @@ > <form action="[% script_name %]" method="post"> > <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button> > </form> >+ [% END %] > > </div> > [% 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