Bug 21268: Don't remove 0 allocated funds from fund list
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 28 Jul 2020 07:23:35 +0000 (09:23 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 30 Jul 2020 15:44:27 +0000 (17:44 +0200)
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>

acqui/addorderiso2709.pl
acqui/basket.pl
acqui/booksellers.pl
acqui/duplicate_orders.pl
acqui/invoice.pl
acqui/neworderempty.pl
acqui/orderreceive.pl
acqui/parcels.pl

index 1caee77..8d394d3 100755 (executable)
@@ -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},
index 4ef5fac..88abf24 100755 (executable)
@@ -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;
index 0b69feb..78b36a9 100755 (executable)
@@ -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;
index eb975da..7f03221 100755 (executable)
@@ -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},
index fa6dc26..0a9f38f 100755 (executable)
@@ -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},
index cf2e7ee..dfa9ebe 100755 (executable)
@@ -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},
index d73f61b..dea4f43 100755 (executable)
@@ -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},
index c0a330b..69aeb78 100755 (executable)
@@ -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},