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

(-)a/admin/aqbudgets.pl (+6 lines)
Lines 231-236 if ($op eq 'add_form') { Link Here
231
                                                    # END $OP eq DELETE_CONFIRM
231
                                                    # END $OP eq DELETE_CONFIRM
232
# called by delete_confirm, used to effectively confirm deletion of data in DB
232
# called by delete_confirm, used to effectively confirm deletion of data in DB
233
} elsif ( $op eq 'delete_confirmed' ) {
233
} elsif ( $op eq 'delete_confirmed' ) {
234
    if ( BudgetHasChildren( $budget_id ) ) {
235
        # We should never be here, the interface does not provide this action.
236
        die("Delete a fund with children is not possible");
237
    }
234
    my $rc = DelBudget($budget_id);
238
    my $rc = DelBudget($budget_id);
235
    $op = 'list';
239
    $op = 'list';
236
} elsif( $op eq 'add_validate' ) {
240
} elsif( $op eq 'add_validate' ) {
Lines 330-335 if ( $op eq 'list' ) { Link Here
330
        @budget_hierarchy = reverse(@budget_hierarchy);
334
        @budget_hierarchy = reverse(@budget_hierarchy);
331
335
332
        $budget->{budget_hierarchy} = \@budget_hierarchy;
336
        $budget->{budget_hierarchy} = \@budget_hierarchy;
337
338
        $budget->{budget_has_children} = BudgetHasChildren( $budget->{budget_id} );
333
    }
339
    }
334
340
335
    my $budget_period_total = $period->{budget_period_total};
341
    my $budget_period_total = $period->{budget_period_total};
(-)a/installer/data/mysql/updatedatabase.pl (+22 lines)
Lines 9585-9590 if ( CheckVersion($DBversion) ) { Link Here
9585
    SetVersion ($DBversion);
9585
    SetVersion ($DBversion);
9586
}
9586
}
9587
9587
9588
$DBversion = "3.18.00.001";
9589
if ( CheckVersion($DBversion) ) {
9590
    my $orphan_budgets = $dbh->selectall_arrayref(q|
9591
        SELECT budget_id, budget_name, budget_code
9592
        FROM aqbudgets
9593
        WHERE   budget_parent_id IS NOT NULL
9594
            AND budget_parent_id NOT IN (
9595
                SELECT DISTINCT budget_id FROM aqbudgets
9596
            )
9597
    |, { Slice => {} } );
9598
9599
    if ( @$orphan_budgets ) {
9600
        for my $b ( @$orphan_budgets ) {
9601
            print "Fund $b->{budget_name} (code:$b->{budget_code}, id:$b->{budget_id}) does not have a parent, it may cause problem\n";
9602
        }
9603
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: FAIL)\n";
9604
    } else {
9605
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: OK)\n";
9606
    }
9607
    SetVersion($DBversion);
9608
}
9609
9588
=head1 FUNCTIONS
9610
=head1 FUNCTIONS
9589
9611
9590
=head2 TableExists($table)
9612
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt (-2 / +10 lines)
Lines 225-230 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
225
        $("#filterbutton").click(function() {
225
        $("#filterbutton").click(function() {
226
            $("#fundfilters").slideToggle(0);
226
            $("#fundfilters").slideToggle(0);
227
        });
227
        });
228
229
        $(".deletefund-disabled").on("click", function(e){
230
            e.preventDefault();
231
            alert("This fund has children. It cannot be deleted.");
232
        });
228
    });
233
    });
229
//]]>
234
//]]>
230
</script>
235
</script>
Lines 398-404 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
398
                </a>
403
                </a>
399
                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]">
404
                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]">
400
                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]" >Edit</a></li>
405
                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]" >Edit</a></li>
401
                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]">Delete</a></li>
406
                    [% IF budget.budget_has_children %]
407
                        <li class="disabled"><a href="#" class="deletefund-disabled" data-toggle="tooltip" data-placement="left" title="This fund has children">Delete</a></li>
408
                    [% ELSE %]
409
                        <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]">Delete</a></li>
410
                    [% END %]
402
                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]">Add child fund</a></li>
411
                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]">Add child fund</a></li>
403
                </ul>
412
                </ul>
404
            </div>
413
            </div>
405
- 

Return to bug 12905