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

SF.net SVN: ledger-smb:[4460] trunk/LedgerSMB/Scripts/import_csv.pm



Revision: 4460
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4460&view=rev
Author:   ehuelsmann
Date:     2012-03-14 20:50:55 +0000 (Wed, 14 Mar 2012)
Log Message:
-----------
Implement support for importing sic codes and descriptions.

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/import_csv.pm

Modified: trunk/LedgerSMB/Scripts/import_csv.pm
===================================================================
--- trunk/LedgerSMB/Scripts/import_csv.pm	2012-03-14 20:35:52 UTC (rev 4459)
+++ trunk/LedgerSMB/Scripts/import_csv.pm	2012-03-14 20:50:55 UTC (rev 4460)
@@ -156,6 +156,17 @@
                }
                $dbh->commit;
              },
+    sic   => sub {
+               my ($request, $entries) = @_;
+               my $dbh = $request->{dbh};
+               my $sth = $dbh->prepare('INSERT INTO sic (code, sictype, description) VALUES (?, ?, ?)') || die $dbh->errstr;;
+
+               foreach my $entry (@$entries) {
+                 $sth->execute($entry->[0], $entry->[1], $entry->[2])
+                    || die $sth->errstr();
+               }
+               $dbh->commit;
+             },
 };
 
 sub parse_file {

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