merged from upstream master
[koha_fer] / admin / aqbudgets.pl
index 5010ccd..9da555d 100755 (executable)
@@ -20,6 +20,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
+#use warnings; FIXME - Bug 2505
 use CGI;
 use List::Util qw/min/;
 use Number::Format qw(format_price);
@@ -238,8 +239,6 @@ if ($op eq 'add_form') {
     my $period_total = 0;
     my ( $period_alloc_total, $base_spent_total );
 
-       use YAML;
-       $debug && warn Dump(@budgets);
        #This Looks WEIRD to me : should budgets be filtered in such a way ppl who donot own it would not see the amount spent on the budget by others ?
 
     foreach my $budget (@budgets) {
@@ -297,6 +296,9 @@ if ($op eq 'add_form') {
         $$budget{$_}               = $num->format_price( $$budget{$_} ) if defined($$budget{$_})
                }
 
+        # Value of budget_spent equals 0 instead of undefined value
+        $$budget{"budget_spent"} = $num->format_price(0) unless defined($$budget{"budget_spent"});
+
         my $borrower = &GetMember( borrowernumber=>$budget->{budget_owner_id} );
         $budget->{"budget_owner_name"}     = $borrower->{'firstname'} . ' ' . $borrower->{'surname'};
         $budget->{"budget_borrowernumber"} = $borrower->{'borrowernumber'};