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

SF.net SVN: ledger-smb:[3048] addons/1.3/assets/trunk



Revision: 3048
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3048&view=rev
Author:   einhverfr
Date:     2010-08-12 17:31:52 +0000 (Thu, 12 Aug 2010)

Log Message:
-----------
Correcting for Excel issues with CSV files.

Modified Paths:
--------------
    addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm
    addons/1.3/assets/trunk/scripts/asset.pl

Modified: addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm
===================================================================
--- addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm	2010-08-12 16:00:28 UTC (rev 3047)
+++ addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm	2010-08-12 17:31:52 UTC (rev 3048)
@@ -40,10 +40,14 @@
         while ($line ne '') {
             if ($line =~ /^"/){
                 $line =~ s/"(.*?)"(,|$)//;
-                push @fields, $1;
+                my $field = $1;
+                $field =~ s/\s*$//;
+                push @fields, $field;
             } else {
                 $line =~ s/([^,]*),?//;
-                push @fields, $1;
+                my $field = $1;
+                $field =~ s/\s*$//;
+                push @fields, $field;
             }
         }
         push @{$self->{import_entries}}, ..hidden..;

Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl	2010-08-12 16:00:28 UTC (rev 3047)
+++ addons/1.3/assets/trunk/scripts/asset.pl	2010-08-12 17:31:52 UTC (rev 3048)
@@ -874,6 +874,8 @@
           $ai->{$file_columns[$_]} = $ail->[$_];
         }
         next if $ai->{purchase_value} !~ /\d/;
+        $ai->{purchase_value} = $ai->parse_amount(amount => $ai->{purchase_value});
+        $ai->{accum_dep} = $ai->parse_amount(amount => $ai->{accum_dep});
         if (!$ai->{start_depreciation}){
             $ai->{start_depreciation} = $ai->{purchase_date};
         }


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