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

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



Revision: 4576
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4576&view=rev
Author:   ehuelsmann
Date:     2012-03-25 21:09:09 +0000 (Sun, 25 Mar 2012)
Log Message:
-----------
Fix chart uploading setting links.

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

Modified: trunk/LedgerSMB/Scripts/import_csv.pm
===================================================================
--- trunk/LedgerSMB/Scripts/import_csv.pm	2012-03-25 20:56:50 UTC (rev 4575)
+++ trunk/LedgerSMB/Scripts/import_csv.pm	2012-03-25 21:09:09 UTC (rev 4576)
@@ -131,18 +131,27 @@
 
                foreach my $entry (@$entries){
                   my $account = LedgerSMB::DBObject::Account->new({base=>$request});
-
-                  $account->merge({
+                  my $settings = {
                       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],
-                  });
+                  };
+
+                  if ($entry->[6] !~ /:/) {
+                    $settings->{$entry->[6]} = 1
+                      if ($entry-[6] != "");
+                  else {
+                    foreach my $link (split( /:/, $entry->[6]) {
+                       $settings->{$link} = 1;
+                    }
+                  }
+
+                  $account->merge($settings);
                   $account->save();
                }
              },

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