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 9579-9584 if ( CheckVersion($DBversion) ) { Link Here
9579
    SetVersion ($DBversion);
9579
    SetVersion ($DBversion);
9580
}
9580
}
9581
9581
9582
$DBversion = "3.18.00.001";
9583
if ( CheckVersion($DBversion) ) {
9584
    my $orphan_budgets = $dbh->selectall_arrayref(q|
9585
        SELECT budget_id, budget_name, budget_code
9586
        FROM aqbudgets
9587
        WHERE   budget_parent_id IS NOT NULL
9588
            AND budget_parent_id NOT IN (
9589
                SELECT DISTINCT budget_id FROM aqbudgets
9590
            )
9591
    |, { Slice => {} } );
9592
9593
    if ( @$orphan_budgets ) {
9594
        for my $b ( @$orphan_budgets ) {
9595
            print "Fund $b->{budget_name} (code:$b->{budget_code}, id:$b->{budget_id}) does not have a parent, it may cause problem\n";
9596
        }
9597
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: FAIL)\n";
9598
    } else {
9599
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: OK)\n";
9600
    }
9601
    SetVersion($DBversion);
9602
}
9603
9582
=head1 FUNCTIONS
9604
=head1 FUNCTIONS
9583
9605
9584
=head2 TableExists($table)
9606
=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