Before formatting and doing arithmetic with them we should
ensure undefined numeric elements are numbers
(This should be enforced in the db)
---
 acqui/acqui-home.pl |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl
index 0193492..8ce7d00 100755
--- a/acqui/acqui-home.pl
+++ b/acqui/acqui-home.pl
@@ -149,6 +149,16 @@ foreach my $result (@results) {
 
     my $member      = GetMember( borrowernumber => $result->{budget_owner_id} 
);
     my $member_full = $member->{'firstname'} . ' ' . $member->{'surname'} if 
$member;
+    # as we are going to treat these as numbers let's ensure they are not NULL
+    if (!defined $result->{budget_amount} ) {
+        $result->{budget_amount} = 0;
+    }
+    if (!defined $result->{budget_spent} ) {
+        $result->{budget_spent} = 0;
+    }
+    if (!defined $result->{budget_ordered} ) {
+        $result->{budget_ordered} = 0;
+    }
 
     $result->{'budget_owner'}   = $member_full;
     $result->{'budget_ordered'} = GetBudgetOrdered( $result->{'budget_id'} );
-- 
1.6.6

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to