Bug 16123 - Display budget hierarchy in the budget dropdown menu used when placing a new order
When placing a new order, the budget dropdown will display the budget hierarchy.
TEST PLAN :
1. Go to the Administration module
2. Add a new budget (ie : Budget 2016)
3. Add a fund to this budget (ie : Book)
4. Add a child fund (ie : Adult fiction)
You will have this hierarchy :
Budget 2016
|____ Book
|_____ Adult fiction
5. Go to the Acquisition module
6. Select a vendor and create a new basket
7. Place an order
8. Check the budget dropdown menu
BEFORE PATCH
Book
Adult fiction
AFTER PATCH
Book
Adult fiction
Dropbown menu is hierarchical as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
e54186a4dd
commit
73d9557b13
|
|
@ -547,7 +547,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) {
|
||||
|
|
@ -563,11 +563,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -229,12 +229,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'};
|
||||
|
|
|
|||
|
|
@ -505,12 +505,18 @@ $(document).ready(function()
|
|||
[% FOREACH budget_loo IN budget_loop %]
|
||||
[% IF ( budget_loo.b_sel ) %]
|
||||
[% active_count = 0 #select no other fund %]
|
||||
<option value="[% budget_loo.b_id %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">
|
||||
<option value="[% budget_loo.b_id %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]"
|
||||
style="[% IF ( budget_loo.b_level == 0 ) %]font-weight:bold;[% END %] padding-left:[% budget_loo.b_level %]em;"
|
||||
>
|
||||
[% ELSIF active_count==1 && budget_loo.b_active %]
|
||||
<option value="[% budget_loo.b_id %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">
|
||||
<option value="[% budget_loo.b_id %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]"
|
||||
style="[% IF ( budget_loo.b_level == 0 ) %]font-weight:bold;[% END %] padding-left:[% budget_loo.b_level %]em;"
|
||||
>
|
||||
[% ELSE %]
|
||||
[% bdgclass=budget_loo.b_active? "": "b_inactive" %]
|
||||
<option value="[% budget_loo.b_id %]" class="[% bdgclass %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">
|
||||
<option value="[% budget_loo.b_id %]" class="[% bdgclass %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]"
|
||||
style="[% IF ( budget_loo.b_level == 0 ) %]font-weight:bold;[% END %] padding-left:[% budget_loo.b_level %]em;"
|
||||
>
|
||||
[% END %]
|
||||
[% budget_loo.b_txt %][% IF !budget_loo.b_active %] (inactive)[% END %]
|
||||
</option>
|
||||
|
|
|
|||
Loading…
Reference in New Issue