From fe19488c2299c46fc50608d15bb30017cd720ec5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 28 Jul 2020 09:23:35 +0200 Subject: [PATCH] Bug 21268: Don't remove 0 allocated funds from fund list MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If a fund is created with a amount of 0, it will not appear in the fund list (when a new order is created for instance). 0 allocated funds can be used to track donations and other situations where there is not an expected amount for the year. Test plan: 0. Do not apply the patch 1. Create 1 active and 1 inactive budgets 2. Create some funds for each budgets, with amount > 0 and amount == 0 3. Add orders to basket => Note that the funds with amount == 0 are not displayed 4. Apply the patch 5. Add orders to basket (using the different possible ways we have) => Note that the funds with amount == 0 are displayed This change is applied to the different views of the acquisition module. Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart (cherry picked from commit 8ecaedc22db5a25db6ffa98e6a7fc2e7039656c7) Signed-off-by: Lucas Gass --- acqui/addorderiso2709.pl | 3 --- acqui/basket.pl | 3 --- acqui/booksellers.pl | 3 --- acqui/duplicate_orders.pl | 4 +--- acqui/invoice.pl | 4 ---- acqui/neworderempty.pl | 3 --- acqui/orderreceive.pl | 3 --- acqui/parcels.pl | 3 --- 8 files changed, 1 insertion(+), 25 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 1caee77950..8d394d3ca5 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -411,9 +411,6 @@ my $budget_loop = []; my $budgets_hierarchy = GetBudgetHierarchy; foreach my $r ( @{$budgets_hierarchy} ) { next unless (CanUserUseBudget($patron, $r, $userflags)); - if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) { - next; - } push @{$budget_loop}, { b_id => $r->{budget_id}, b_txt => $r->{budget_name}, diff --git a/acqui/basket.pl b/acqui/basket.pl index 92f3614676..61bd8ad9a8 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -379,9 +379,6 @@ if ( $op eq 'list' ) { my $budgets = GetBudgetHierarchy; my $has_budgets = 0; foreach my $r (@{$budgets}) { - if (!defined $r->{budget_amount} || $r->{budget_amount} == 0) { - next; - } next unless (CanUserUseBudget($loggedinuser, $r, $userflags)); $has_budgets = 1; diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index 0b69feb497..78b36a9691 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -114,9 +114,6 @@ my $userbranch = $userenv->{branch}; my $budgets = GetBudgetHierarchy; my $has_budgets = 0; foreach my $r (@{$budgets}) { - if (!defined $r->{budget_amount} || $r->{budget_amount} == 0) { - next; - } next unless (CanUserUseBudget($loggedinuser, $r, $userflags)); $has_budgets = 1; diff --git a/acqui/duplicate_orders.pl b/acqui/duplicate_orders.pl index eb975da035..7f03221c5b 100755 --- a/acqui/duplicate_orders.pl +++ b/acqui/duplicate_orders.pl @@ -104,9 +104,7 @@ elsif ( $op eq 'batch_edit' ) { foreach my $r ( @{$budgets_hierarchy} ) { next unless ( C4::Budgets::CanUserUseBudget( $patron, $r, $userflags ) ); - if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) { - next; - } + push @{$budget_loop}, { b_id => $r->{budget_id}, diff --git a/acqui/invoice.pl b/acqui/invoice.pl index 26717e99fe..60724aa5f4 100755 --- a/acqui/invoice.pl +++ b/acqui/invoice.pl @@ -195,10 +195,6 @@ my $budgets = GetBudgetHierarchy(); foreach my $r ( @{$budgets} ) { next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) ); - if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) { - next; - } - my $selected = $shipmentcost_budgetid ? $r->{budget_id} eq $shipmentcost_budgetid : 0; push @{$budget_loop}, diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index cf2e7ee945..dfa9ebe9ff 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -320,9 +320,6 @@ my $budget_loop = []; my $budgets = GetBudgetHierarchy; foreach my $r (@{$budgets}) { next unless (CanUserUseBudget($patron, $r, $userflags)); - if (!defined $r->{budget_amount} || $r->{budget_amount} <0) { - next; - } push @{$budget_loop}, { b_id => $r->{budget_id}, b_txt => $r->{budget_name}, diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index d73f61b6d3..dea4f439be 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -270,9 +270,6 @@ foreach my $period (@$periods) { 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}, diff --git a/acqui/parcels.pl b/acqui/parcels.pl index c0a330b479..69aeb78939 100755 --- a/acqui/parcels.pl +++ b/acqui/parcels.pl @@ -182,9 +182,6 @@ 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}, -- 2.39.5