diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index c690dca55f..43b9c109f7 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -170,39 +170,21 @@ if ( $suggestion ) { } my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; -my @budget_loop; -my $periods = GetBudgetPeriods( ); -foreach my $period (@$periods) { - if ($period->{'budget_period_id'} == $budget->{'budget_period_id'}) { - $template->{'VARS'}->{'budget_period_description'} = $period->{'budget_period_description'}; - } - next if $period->{'budget_period_locked'} || !$period->{'budget_period_description'}; - my $budget_hierarchy = GetBudgetHierarchy( $period->{'budget_period_id'}, undef, undef, 1 ); - my @funds; - foreach my $r ( @{$budget_hierarchy} ) { - next unless ( CanUserUseBudget( $patron, $r, $userflags ) ); - if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) { - next; - } - push @funds, - { - b_id => $r->{budget_id}, - b_txt => $r->{budget_name}, - b_sel => ( $r->{budget_id} == $order->budget_id ) ? 1 : 0, - }; - } - - @funds = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @funds; - - push @budget_loop, - { - 'id' => $period->{'budget_period_id'}, - 'description' => $period->{'budget_period_description'}, - 'funds' => \@funds - }; +my $budget_loop = []; +my $budgets = GetBudgetHierarchy( undef, undef, undef, 1 ); +foreach my $r (@{$budgets}) { + next unless (CanUserUseBudget($patron, $r, $userflags)); + push @{$budget_loop}, { + b_id => $r->{budget_id}, + b_txt => $r->{budget_name}, + b_sort1_authcat => $r->{'sort1_authcat'}, + b_sort2_authcat => $r->{'sort2_authcat'}, + b_active => $r->{budget_period_active}, + b_sel => ( $r->{budget_id} == $order->budget_id ) ? 1 : 0, + b_level => $r->{budget_level}, + }; } - -$template->{'VARS'}->{'budget_loop'} = \@budget_loop; +$template->{'VARS'}->{'budget_loop'} = $budget_loop; my $op = $input->param('op'); if ($op and $op eq 'edit'){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 54cc5ea818..5626ecbb9d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -287,20 +287,43 @@
[% INCLUDE 'date-format.inc' %]
-
  • + + Required + + +
  • (Current: [% budget_period_description | html %] - [% bookfund | html %])
  • @@ -434,6 +457,7 @@ [% INCLUDE 'calendar.inc' %] [% Asset.js("js/additem.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %] + [% INCLUDE 'select2.inc' %]