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

SF.net SVN: ledger-smb:[3660] trunk/scripts/setup.pl



Revision: 3660
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3660&view=rev
Author:   einhverfr
Date:     2011-08-16 00:03:56 +0000 (Tue, 16 Aug 2011)

Log Message:
-----------
selecting coa now works but loading does not yet

Modified Paths:
--------------
    trunk/scripts/setup.pl

Modified: trunk/scripts/setup.pl
===================================================================
--- trunk/scripts/setup.pl	2011-08-15 23:49:33 UTC (rev 3659)
+++ trunk/scripts/setup.pl	2011-08-16 00:03:56 UTC (rev 3660)
@@ -192,6 +192,54 @@
 
 =item select_coa
 
+Selects and loads the COA.
+
+There are three distinct input scenarios here:
+
+coa_lc and chart are set:  load the coa file specified (sql/coa/$coa_lc/$chart)
+coa_lc set, chart not set:  select the chart
+coa_lc not set:  Select the coa location code
+
+=cut
+
+sub select_coa {
+    my ($request) = @_;
+
+    if ($request->{coa_lc} =~ /\.\./){
+       $request->error($request->{_locale}->text('Access Denied'));
+    }
+    if ($request->{coa_lc}){
+        if ($request->{chart}){
+            # new db instance
+            # load file
+            # render admin user template
+        } else {
+            opendir(COA, "sql/coa/$request->{coa_lc}/chart");
+            my @coa = grep !/^(\.|[Ss]ample.*)/, readdir(COA);
+            $request->{charts} = [];
+            for my $chart (@coa){
+                push @{$request->{charts}}, {name => $chart};
+            }
+       }
+    } else {
+        #COA Directories
+        opendir(COA, 'sql/coa');
+        my @coa = grep !/^(\.|[Ss]ample.*)/, readdir(COA);
+        closedir(COA); 
+
+        $request->{coa_lcs} =[];
+        foreach my $lcs (@coa){
+             push @{$request->{coa_lcs}}, {code => $lcs};
+        } 
+    }
+    $template = LedgerSMB::Template->new(
+            path => 'UI/setup',
+            template => 'select_coa',
+	    format => 'HTML',
+    );
+    $template->render($request);
+}
+
 =item cancel
 
 Cancels work.  If the confirm is set to no, returns to the credential screen


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