Bug 21268: Don't remove 0 allocated funds from fund list

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 <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-07-28 09:23:35 +02:00
parent ab015f04dc
commit 8ecaedc22d
8 changed files with 1 additions and 25 deletions

View File

@ -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},

View File

@ -385,9 +385,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;

View File

@ -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;

View File

@ -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},

View File

@ -229,10 +229,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},

View File

@ -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},

View File

@ -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},

View File

@ -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},