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

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



Revision: 4458
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4458&view=rev
Author:   ehuelsmann
Date:     2012-03-14 19:46:41 +0000 (Wed, 14 Mar 2012)
Log Message:
-----------
Implement support for importing GL accounts and headers.

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

Modified: trunk/LedgerSMB/Scripts/import_csv.pm
===================================================================
--- trunk/LedgerSMB/Scripts/import_csv.pm	2012-03-14 08:00:38 UTC (rev 4457)
+++ trunk/LedgerSMB/Scripts/import_csv.pm	2012-03-14 19:46:41 UTC (rev 4458)
@@ -124,6 +124,29 @@
                        AA->post_transaction($request->{_user}, $form);
                    }
                },
+    chart => sub {
+               use LedgerSMB::DBObject::Account;
+
+               my ($request, $entries) = @_;
+
+               foreach my $entry (@$entries){
+                  my $account = LedgerSMB::DBObject::Account->new({base=>$request});
+
+                  $account->merge({
+                      accno => $entry->[0],
+                      description => $entry->[1],
+                      charttype => $entry->[2],
+                      category => $entry->[3],
+                      contra => $entry->[4],
+                      tax => $entry->[5],
+                      link => $entry->[6],
+#                      heading => $entry->[7],
+                      gifi_accno => $entry->[8],
+                  });
+                  $account->save();
+               }
+
+             },
 };
 
 sub parse_file {
@@ -152,7 +175,7 @@
         }
         push @{$self->{import_entries}}, ..hidden..;
     }     
-    unshift @{$self->{import_entries}}; # get rid of header line
+    shift @{$self->{import_entries}}; # get rid of header line
     return @{$self->{import_entries}};
 }
 

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