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 ( HasChildren( $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 9437-9442 if ( CheckVersion($DBversion) ) { Link Here
9437
   print "Upgrade to $DBversion done (Bug 9043: Add system preference OpacAdvSearchOptions and OpacAdvSearchMoreOptions)\n";
9437
   print "Upgrade to $DBversion done (Bug 9043: Add system preference OpacAdvSearchOptions and OpacAdvSearchMoreOptions)\n";
9438
   SetVersion ($DBversion);
9438
   SetVersion ($DBversion);
9439
}
9439
}
9440
$DBversion = "3.17.00.XXX";
9441
if ( CheckVersion($DBversion) ) {
9442
    my $orphan_budgets = $dbh->selectall_arrayref(q|
9443
        SELECT budget_id, budget_name, budget_code
9444
        FROM aqbudgets
9445
        WHERE   budget_parent_id IS NOT NULL
9446
            AND budget_parent_id NOT IN (
9447
                SELECT DISTINCT budget_id FROM aqbudgets
9448
            )
9449
    |, { Slice => {} } );
9450
9451
    if ( @$orphan_budgets ) {
9452
        for my $b ( @$orphan_budgets ) {
9453
            print "Fund $b->{budget_name} (code:$b->{budget_code}, id:$b->{budget_id}) does not have a parent, it may cause problem\n";
9454
        }
9455
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: FAIL)\n";
9456
    } else {
9457
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: OK)\n";
9458
    }
9459
    SetVersion($DBversion);
9460
}
9461
9440
9462
9441
=head1 FUNCTIONS
9463
=head1 FUNCTIONS
9442
9464
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt (-2 / +10 lines)
Lines 218-223 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
218
        $("#filterbutton").click(function() {
218
        $("#filterbutton").click(function() {
219
            $("#fundfilters").slideToggle(0);
219
            $("#fundfilters").slideToggle(0);
220
        });
220
        });
221
222
        $(".deletefund-disabled").on("click", function(e){
223
            e.preventDefault();
224
            alert("This fund has children. It cannot be deleted.");
225
        });
221
    });
226
    });
222
//]]>
227
//]]>
223
</script>
228
</script>
Lines 391-397 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
391
                </a>
396
                </a>
392
                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]">
397
                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]">
393
                    <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>
398
                    <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>
394
                    <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>
399
                    [% IF budget.budget_has_children %]
400
                        <li class="disabled"><a href="#" class="deletefund-disabled" data-toggle="tooltip" data-placement="left" title="This fund has children">Delete</a></li>
401
                    [% ELSE %]
402
                        <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>
403
                    [% END %]
395
                    <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>
404
                    <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>
396
                </ul>
405
                </ul>
397
            </div>
406
            </div>
398
- 

Return to bug 12905