@@ -, +, @@
menu used when placing a new order
|____ Book
|_____ Adult fiction
Adult fiction
---
C4/Budgets.pm | 5 +++--
acqui/neworderempty.pl | 4 +---
.../intranet-tmpl/prog/en/modules/acqui/neworderempty.tt | 12 +++++++++---
3 files changed, 13 insertions(+), 8 deletions(-)
--- a/C4/Budgets.pm
+++ a/C4/Budgets.pm
@@ -541,7 +541,7 @@ sub GetBudgetHierarchy {
my @sort = ();
foreach my $first_parent (@first_parents) {
- _add_budget_children(\@sort, $first_parent);
+ _add_budget_children(\@sort, $first_parent, 0);
}
foreach my $budget (@sort) {
@@ -557,11 +557,12 @@ sub GetBudgetHierarchy {
sub _add_budget_children {
my $res = shift;
my $budget = shift;
+ $budget->{budget_level} = shift;
push @$res, $budget;
my $children = $budget->{'children'} || [];
return unless @$children; # break recursivity
foreach my $child (@$children) {
- _add_budget_children($res, $child);
+ _add_budget_children($res, $child, $budget->{budget_level} + 1);
}
}
--- a/acqui/neworderempty.pl
+++ a/acqui/neworderempty.pl
@@ -248,12 +248,10 @@ foreach my $r (@{$budgets}) {
b_sort2_authcat => $r->{'sort2_authcat'},
b_active => $r->{budget_period_active},
b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
+ b_level => $r->{budget_level},
};
}
-@{$budget_loop} =
- sort { uc( $a->{b_txt}) cmp uc( $b->{b_txt}) } @{$budget_loop};
-
if ($close) {
$budget_id = $data->{'budget_id'};
$budget_name = $budget->{'budget_name'};
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
@@ -500,12 +500,18 @@ $(document).ready(function()
[% FOREACH budget_loo IN budget_loop %]
[% IF ( budget_loo.b_sel ) %]
[% active_count = 0 #select no other fund %]
-
--