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

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



Revision: 3043
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3043&view=rev
Author:   einhverfr
Date:     2010-08-09 21:51:18 +0000 (Mon, 09 Aug 2010)

Log Message:
-----------
Correcting handling of quotes for file import

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-09 18:16:41 UTC (rev 3042)
+++ addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm	2010-08-09 21:51:18 UTC (rev 3043)
@@ -34,8 +34,19 @@
 
     $self->{import_entries} = [];
     for my $line (split /\n/, $contents){
-        next if ($line =~ /^$/);
-        my @fields = split(/,/, $line);
+        next if ($line !~ /,/);
+        my @fields;
+        while ($line ne '') {
+            print STDERR $line . "\n";
+            if ($line =~ /^"/){
+                $line =~ s/"(.*?)"(,|$)//;
+                push @fields, $1;
+            } else {
+                $line =~ s/([^,]*),?//;
+                push @fields, $1;
+            }
+        }
+        print STDERR join(':', @fields) . "\n";
         push @{$self->{import_entries}}, ..hidden..;
     }     
     unshift @{$self->{import_entries}}; # get rid of header line

Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl	2010-08-09 18:16:41 UTC (rev 3042)
+++ addons/1.3/assets/trunk/scripts/asset.pl	2010-08-09 21:51:18 UTC (rev 3043)
@@ -902,6 +902,7 @@
         }
         $ai->import_asset;
     }
+    $request->{dbh}->commit;
     $request->{info} = $request->{_locale}->text('File Imported');
     begin_import($request);
 }


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