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 9470-9475 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
9470
    SetVersion($DBversion);
9470
    SetVersion($DBversion);
9471
}
9471
}
9472
9472
9473
$DBversion = "3.17.00.XXX";
9474
if ( CheckVersion($DBversion) ) {
9475
    my $orphan_budgets = $dbh->selectall_arrayref(q|
9476
        SELECT budget_id, budget_name, budget_code
9477
        FROM aqbudgets
9478
        WHERE   budget_parent_id IS NOT NULL
9479
            AND budget_parent_id NOT IN (
9480
                SELECT DISTINCT budget_id FROM aqbudgets
9481
            )
9482
    |, { Slice => {} } );
9483
9484
    if ( @$orphan_budgets ) {
9485
        for my $b ( @$orphan_budgets ) {
9486
            print "Fund $b->{budget_name} (code:$b->{budget_code}, id:$b->{budget_id}) does not have a parent, it may cause problem\n";
9487
        }
9488
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: FAIL)\n";
9489
    } else {
9490
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: OK)\n";
9491
    }
9492
    SetVersion($DBversion);
9493
}
9494
9473
=head1 FUNCTIONS
9495
=head1 FUNCTIONS
9474
9496
9475
=head2 TableExists($table)
9497
=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