View | Details | Raw Unified | Return to bug 18351
Collapse All | Expand All

(-)a/admin/aqbudgetperiods.pl (-5 / +10 lines)
Lines 127-133 elsif ( $op eq 'add_validate' ) { Link Here
127
#--------------------------------------------------
127
#--------------------------------------------------
128
elsif ( $op eq 'delete_confirm' ) {
128
elsif ( $op eq 'delete_confirm' ) {
129
## delete a budget period (preparation)
129
## delete a budget period (preparation)
130
    my $dbh = C4::Context->dbh;
131
    my $funds = GetBudgets({ budget_period_id => $budget_period_id });
130
    my $funds = GetBudgets({ budget_period_id => $budget_period_id });
132
    my $fund_count = scalar @$funds;
131
    my $fund_count = scalar @$funds;
133
    if ( $fund_count > 0 ) {
132
    if ( $fund_count > 0 ) {
Lines 143-152 elsif ( $op eq 'delete_confirm' ) { Link Here
143
}
142
}
144
143
145
elsif ( $op eq 'delete_confirmed' ) {
144
elsif ( $op eq 'delete_confirmed' ) {
146
## delete the budget period record
145
    ## confirm no funds have been added to budget
147
146
    my $funds = GetBudgets({ budget_period_id => $budget_period_id });
148
    my $data = GetBudgetPeriod( $budget_period_id);
147
    my $fund_count = scalar @$funds;
149
    DelBudgetPeriod($budget_period_id);
148
    if ( $fund_count > 0 ) {
149
        $template->param( failed_delete_funds_exist => 1 );
150
    } else {
151
        ## delete the budget period record
152
        my $data = GetBudgetPeriod( $budget_period_id);
153
        DelBudgetPeriod($budget_period_id);
154
    }
150
	$op='else';
155
	$op='else';
151
}
156
}
152
157
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-1 / +4 lines)
Lines 542-547 Link Here
542
[% IF ( else ) %]
542
[% IF ( else ) %]
543
  <h2>Budgets administration</h2>
543
  <h2>Budgets administration</h2>
544
544
545
    [% IF ( failed_delete_funds_exist ) %]
546
        <div class="dialog message">Failed to delete budget because funds exist.</div>
547
    [% END %]
548
545
  [% INCLUDE 'budgets-active-currency.inc' %]
549
  [% INCLUDE 'budgets-active-currency.inc' %]
546
550
547
  <div id="budgetsTabs" class="toptabs">
551
  <div id="budgetsTabs" class="toptabs">
548
- 

Return to bug 18351