[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3910] branches/1.2/bin



Revision: 3910
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3910&view=rev
Author:   einhverfr
Date:     2011-10-22 04:09:17 +0000 (Sat, 22 Oct 2011)
Log Message:
-----------
Attempts to correct Perl 5.12 errors on LedgerSMB 1.2

Modified Paths:
--------------
    branches/1.2/bin/aa.pl
    branches/1.2/bin/io.pl

Modified: branches/1.2/bin/aa.pl
===================================================================
--- branches/1.2/bin/aa.pl	2011-10-21 23:16:12 UTC (rev 3909)
+++ branches/1.2/bin/aa.pl	2011-10-22 04:09:17 UTC (rev 3910)
@@ -909,8 +909,11 @@
         $count = 0;
         @a     = ();
         for $i ( 1 .. $form->{rowcount} ) {
+            if (!$form->{"amount_$i"}){
+               $form->{"amount_$i"} = "0.00";
+            }
             $form->{"amount_$i"} =
-              $form->parse_amount( \%myconfig, $form->{"amount_$i"} );
+                 $form->parse_amount( \%myconfig, $form->{"amount_$i"} );
             if ( $form->{"amount_$i"} ) {
                 push @a, {};
                 $j = $#a;
@@ -966,6 +969,9 @@
     @taxaccounts = split / /, $form->{taxaccounts};
 
     for (@taxaccounts) {
+        if (!$form->{"tax_$_"}){
+           $form->{"tax_$_"} = '0.00';
+        }
         $form->{"tax_$_"} =
           $form->parse_amount( \%myconfig, $form->{"tax_$_"} );
     }
@@ -979,6 +985,9 @@
                 $form->{"${_}_$j"} = $form->{"${_}_$i"};
             }
             for (qw(paid exchangerate)) {
+                if (!$form->{"${_}_$j"}){
+                   $form->{"${_}_$j"} = '0.00';
+                }
                 $form->{"${_}_$j"} =
                   $form->parse_amount( \%myconfig, $form->{"${_}_$i"} );
             }

Modified: branches/1.2/bin/io.pl
===================================================================
--- branches/1.2/bin/io.pl	2011-10-21 23:16:12 UTC (rev 3909)
+++ branches/1.2/bin/io.pl	2011-10-22 04:09:17 UTC (rev 3910)
@@ -83,6 +83,11 @@
 
 sub _calc_taxes {
     for $i (1 .. $form->{rowcount}){
+        for (qw(sellprice discount qty)){
+            if (!$form->{"${_}_$i"}){
+                $form->{"${_}_$i"} = '0.00';
+            }
+        }
         my $linetotal = 
              $form->round_amount($form->parse_amount(\%myconfig, $form->{"sellprice_$i"}) 
              * (1 - $form->parse_amount(\%myconfig, $form->{"discount_$i"})
@@ -234,6 +239,7 @@
 
         # undo formatting
         for (qw(qty oldqty ship discount sellprice)) {
+            $form->{"${_}_$i"} = '0.00' if ! $form->{"${_}_$i"};
             $form->{"${_}_$i"} =
               $form->parse_amount( \%myconfig, $form->{"${_}_$i"} );
         }
@@ -635,6 +641,7 @@
                 $form->{"adj_$i"} = 1;
 
                 for (qw(sellprice listprice weight)) {
+                    $form->{$_} = '0.00' unless $form->{$_};
                     $form->{$_} =
                       $form->parse_amount( \%myconfig, $form->{$_} );
                 }
@@ -1017,6 +1024,10 @@
     my ( $amount, $sellprice, $discount, $qty );
 
     for $i ( 1 .. $form->{rowcount} ) {
+        $form->{"sellprice_$i"} = '0.00' unless $form->{"sellprice_$i"};
+        $form->{"discount_$i"}  = '0.00' unless $form->{"discount_$i"};
+        $form->{"qty_$i"}       = '0.00' unless $form->{"qty_$i"};
+
         $sellprice = $form->parse_amount( \%myconfig, $form->{"sellprice_$i"} );
         $discount  = $form->parse_amount( \%myconfig, $form->{"discount_$i"} );
         $qty       = $form->parse_amount( \%myconfig, $form->{"qty_$i"} );
@@ -1811,6 +1822,7 @@
 
         for $i ( 1 .. $form->{paidaccounts} ) {
             for (qw(paid exchangerate)) {
+                $form->{"${_}_$i"} = '0.00' unless $form->{"${_}_$i"};
                 $form->{"${_}_$i"} =
                   $form->parse_amount( \%myconfig, $form->{"${_}_$i"} );
             }

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.