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

(-)a/admin/aqbudgetperiods.pl (-5 / +10 lines)
Lines 128-139 elsif ( $op eq 'add_validate' ) { Link Here
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;
130
    my $dbh = C4::Context->dbh;
131
    ## $total = number of records linked to the record that must be deleted
131
    my $funds = GetBudgets({ budget_period_id => $budget_period_id });
132
    my $fund_count = scalar @$funds;
133
    if ( $fund_count > 0 ) {
134
        $template->param( funds_exist => 1 );
135
    }
136
137
    #$total = number of records linked to the record that must be deleted
132
    my $total = 0;
138
    my $total = 0;
133
    my $data = GetBudgetPeriod( $budget_period_id);
139
    my $data = GetBudgetPeriod( $budget_period_id);
134
135
    $template->param(
140
    $template->param(
136
		%$data
141
        %$data
137
    );
142
    );
138
}
143
}
139
144
Lines 278-285 my @period_inactive_loop; Link Here
278
foreach my $result ( @{$results} ) {
283
foreach my $result ( @{$results} ) {
279
    my $budgetperiod = $result;
284
    my $budgetperiod = $result;
280
    $budgetperiod->{budget_active} = 1;
285
    $budgetperiod->{budget_active} = 1;
281
    my @funds = GetBudgets({ budget_period_id => $budgetperiod->{budget_period_id} });
286
    my $funds = GetBudgets({ budget_period_id => $budgetperiod->{budget_period_id} });
282
    $budgetperiod->{count} = scalar @funds;
287
    $budgetperiod->{count} = scalar @$funds;
283
    push( @period_inactive_loop, $budgetperiod );
288
    push( @period_inactive_loop, $budgetperiod );
284
}
289
}
285
290
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-3 / +6 lines)
Lines 231-237 Link Here
231
    [% END %]
231
    [% END %]
232
    [% IF ( delete_confirm ) %]
232
    [% IF ( delete_confirm ) %]
233
        <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo;
233
        <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo;
234
        [% IF ( total ) %]
234
        [% IF ( total || funds_exist ) %]
235
            <span>Cannot delete budget '[% budget_period_description %]'</span>
235
            <span>Cannot delete budget '[% budget_period_description %]'</span>
236
        [% ELSE %]
236
        [% ELSE %]
237
            <span>Delete budget '[% budget_period_description %]'?</span>
237
            <span>Delete budget '[% budget_period_description %]'?</span>
Lines 407-416 Link Here
407
        <h3>Cannot delete budget</h3>
407
        <h3>Cannot delete budget</h3>
408
        <p><strong>This record is used [% total %] times</strong>
408
        <p><strong>This record is used [% total %] times</strong>
409
        . Deletion is not possible.</p>
409
        . Deletion is not possible.</p>
410
    [% ELSIF ( funds_exist ) %]
411
        <div class="dialog message">
412
        <h3>Cannot delete budget</h3>
413
        <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
410
    [% ELSE %]
414
    [% ELSE %]
411
        <div class="dialog alert">
415
        <div class="dialog alert">
412
        <h3>Delete budget '[% budget_period_description %]'?</h3>
416
        <h3>Delete budget '[% budget_period_description %]'?</h3>
413
    [% END %]
414
417
415
    <!-- ############################################################# -->
418
    <!-- ############################################################# -->
416
    <!-- "delete" and "cancel" buttons    -->
419
    <!-- "delete" and "cancel" buttons    -->
Lines 424-429 Link Here
424
    <form action="[% script_name %]" method="post">
427
    <form action="[% script_name %]" method="post">
425
        <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
428
        <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
426
    </form>
429
    </form>
430
    [% END %]
427
431
428
    </div>
432
    </div>
429
[% END %]
433
[% END %]
430
- 

Return to bug 18351