@@ -, +, @@ basket --- acqui/orderreceive.pl | 46 +++++--------- .../prog/en/modules/acqui/orderreceive.tt | 62 +++++++++++++++---- 2 files changed, 64 insertions(+), 44 deletions(-) --- a/acqui/orderreceive.pl +++ a/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'){ --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -280,20 +280,43 @@
[% INCLUDE 'date-format.inc' %]
-
  • + [% FOREACH budget_loo IN budget_loop %] + [% level_indent_cnt = 0 %] + [% level_indent = "" %] + [% WHILE level_indent_cnt < budget_loo.b_level %] + [% level_indent = level_indent _ " -- " %] + [% level_indent_cnt = level_indent_cnt +1 %] + [% END %] + + [% IF ( budget_loo.b_sel ) %] + [% active_count = 0 #select no other fund %] + [% END %] -
  • + + Required + + +
  • (Current: [% budget_period_description | html %] - [% bookfund | html %])
  • @@ -427,6 +450,7 @@ [% INCLUDE 'calendar.inc' %] [% Asset.js("js/additem.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %] + [% INCLUDE 'select2.inc' %]