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

SF.net SVN: ledger-smb:[3908] branches/1.3/bin/io.pl



Revision: 3908
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3908&view=rev
Author:   tshvr
Date:     2011-10-21 14:38:41 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
checking undefined var whose length will be used, perl v5.12 problem

Modified Paths:
--------------
    branches/1.3/bin/io.pl

Modified: branches/1.3/bin/io.pl
===================================================================
--- branches/1.3/bin/io.pl	2011-10-21 14:05:25 UTC (rev 3907)
+++ branches/1.3/bin/io.pl	2011-10-21 14:38:41 UTC (rev 3908)
@@ -241,6 +241,7 @@
         }
         my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
         $dec = length $dec;
+        $dec ||= $moneyplaces;
         $form->{"precision_$i"} ||= $dec;
         $dec =  $form->{"precision_$i"};
         $decimalplaces = ( $dec > $moneyplaces ) ? $dec : $moneyplaces;
@@ -261,6 +262,7 @@
                     if ( ( $p * 1 ) && ( $form->{"qty_$i"} >= ( $q * 1 ) ) ) {
                         ($dec) = ( $p =~ /\.(\d+)/ );
                         $dec = length $dec;
+                        $dec ||= $moneyplaces;
                         $decimalplaces = ( $dec > $moneyplaces ) 
                                         ? $dec 
                                         : $moneyplaces;
@@ -644,13 +646,16 @@
             $form->{"partsgroup_$i"} =
               qq|$form->{"new_partsgroup_$j"}--$form->{"new_partsgroup_id_$j"}|;
 
+            my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
             ($dec) = ( $form->{"sellprice_$i"} =~ /\.(\d+)/ );
             $dec = length $dec;
-            $decimalplaces1 = ( $dec > 2 ) ? $dec : 2;
+            $dec ||=$moneyplaces;
+            $decimalplaces1 = ( $dec > $moneyplaces ) ? $dec : $moneyplaces;
 
             ($dec) = ( $form->{"lastcost_$i"} =~ /\.(\d+)/ );
             $dec = length $dec;
-            $decimalplaces2 = ( $dec > 2 ) ? $dec : 2;
+            $dec ||=$moneyplaces;
+            $decimalplaces2 = ( $dec > $moneyplaces ) ? $dec : $moneyplaces;
 
             # if there is an exchange rate adjust sellprice
             if ( ( $form->{exchangerate} * 1 ) ) {

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