diff --git a/acqui/parcels.pl b/acqui/parcels.pl
index 405ff64fe8..e180be1175 100755
--- a/acqui/parcels.pl
+++ b/acqui/parcels.pl
@@ -161,13 +161,25 @@ if ($count_parcels) {
$template->param( searchresults => $loopres, count => $count_parcels );
}
-my $budgets = GetBudgets();
-my @budgets_loop;
-foreach my $budget (@$budgets) {
- next unless CanUserUseBudget($loggedinuser, $budget, $flags);
- push @budgets_loop, $budget;
+# build budget list
+my $budget_loop = [];
+my $budgets = GetBudgetHierarchy;
+foreach my $r (@{$budgets}) {
+ next unless (CanUserUseBudget($loggedinuser, $r, $flags));
+ if (!defined $r->{budget_amount} || $r->{budget_amount} == 0) {
+ next;
+ }
+ push @{$budget_loop}, {
+ b_id => $r->{budget_id},
+ b_txt => $r->{budget_name},
+ b_active => $r->{budget_period_active},
+ };
}
+@{$budget_loop} =
+ sort { uc( $a->{b_txt}) cmp uc( $b->{b_txt}) } @{$budget_loop};
+
+
$template->param(
orderby => $order,
filter => $code,
@@ -178,7 +190,7 @@ $template->param(
shipmentdate_today => C4::Dates->new()->output(),
booksellerid => $booksellerid,
GST => C4::Context->preference('gist'),
- budgets => \@budgets_loop,
+ budgets => $budget_loop,
);
output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
index 915713697d..cf72d5e88f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
@@ -422,7 +422,7 @@ $(document).ready(function()
[% ELSE %]
[% IF ( budget_loo.b_active ) %]
- [% ELSE %]
+ [% ELSE %]
[% END %]
[% END %]
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt
index 39c53e2202..48e4f281b0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt
@@ -15,6 +15,20 @@
var parcelst = $("#parcelst").dataTable($.extend(true, {}, dataTablesDefaults, {
"sPaginationType": "four_button"
} ) );
+
+ //keep a copy of all budgets before removing the inactives
+ var budgetId = $("#shipmentcost_budgetid");
+ var disabledBudgetsCopy = budgetId.html();
+ $('.b_inactive').remove();
+
+ $('#showallfunds').click(function() {
+ if ($(this).is(":checked")) {
+ budgetId.html(disabledBudgetsCopy); //Puts back all the funds
+ }
+ else {
+ $('.b_inactive').remove();
+ }
+ });
});
//]]>
@@ -143,9 +157,16 @@
+
+
+