[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6720] trunk/LedgerSMB
- Subject: SF.net SVN: ledger-smb:[6720] trunk/LedgerSMB
- From: ..hidden..
- Date: Sat, 1 Feb 2014 22:00:21 +0000
Revision: 6720
http://sourceforge.net/p/ledger-smb/code/6720
Author: ehuelsmann
Date: 2014-02-01 22:00:21 +0000 (Sat, 01 Feb 2014)
Log Message:
-----------
Fix issue reported by Istvan - setup.pl skipping CoA setup step.
Modified Paths:
--------------
trunk/LedgerSMB/Database.pm
trunk/LedgerSMB/Scripts/setup.pm
Modified: trunk/LedgerSMB/Database.pm
===================================================================
--- trunk/LedgerSMB/Database.pm 2014-01-31 12:55:42 UTC (rev 6719)
+++ trunk/LedgerSMB/Database.pm 2014-02-01 22:00:21 UTC (rev 6720)
@@ -645,6 +645,29 @@
close (LOADORDER); ### return failure to execute the script?
}
+=item $db->load_coa({country => '2-char-country-code',
+ chart => 'name-of-chart' })
+
+Loads the chart of accounts (and possibly GIFI) as specified in
+the chart of accounts file name given for the given 2-char (iso) country code.
+
+=cut
+
+sub load_coa {
+ my ($self, $args) = @_;
+ my $log = loader_log_filename();
+
+ $self->exec_script(
+ {script => "sql/coa/$args->{country}/chart/$args->{chart}",
+ logfile => $log });
+ if (-f "sql/coa/$args->{coa_lc}/gifi/$args->{chart}"){
+ $self->exec_script(
+ {script => "sql/coa/$args->{coa_lc}/gifi/$args->{chart}",
+ logfile => $log });
+ }
+}
+
+
=item $db->exec_script({script => 'path/to/file', log => 'path/to/log',
errlog => 'path/to/stderr_output' })
Modified: trunk/LedgerSMB/Scripts/setup.pm
===================================================================
--- trunk/LedgerSMB/Scripts/setup.pm 2014-01-31 12:55:42 UTC (rev 6719)
+++ trunk/LedgerSMB/Scripts/setup.pm 2014-02-01 22:00:21 UTC (rev 6720)
@@ -677,22 +677,7 @@
$rc=$database->create_and_load();#TODO what if createdb fails?
$logger->info("create_and_load rc=$rc");
- #COA Directories
- opendir(COA, 'sql/coa');
- my @coa = grep !/^(\.|[Ss]ample.*)/, readdir(COA);
- closedir(COA);
-
- $request->{coa_lcs} =[];
- foreach my $lcs (sort @coa) {
- push @{$request->{coa_lcs}}, {code => $lcs};
- }
-
- my $template = LedgerSMB::Template->new(
- path => 'UI/setup',
- template => 'select_coa',
- format => 'HTML',
- );
- $template->render($request);
+ select_coa($request);
}
=item select_coa
@@ -717,27 +702,38 @@
}
if ($request->{coa_lc}){
if ($request->{chart}){
+ my $database = _get_database($request);
+
+ $database->load_coa( {
+ country => $request->{coa_lc},
+ chart => $request->{chart} });
+
template_screen($request);
+ return;
} else {
- opendir(COA, "sql/coa/$request->{coa_lc}/chart");
- my @coa = sort (grep !/^(\.|[Ss]ample.*)/, readdir(COA));
- $request->{charts} = [];
- for my $chart (sort @coa){
- push @{$request->{charts}}, {name => $chart};
- }
+ opendir(CHART, "sql/coa/$request->{coa_lc}/chart");
+ @{$request->{charts}} =
+ map +{ name => $_ },
+ sort (grep !/^(\.|[Ss]ample.*)/,
+ readdir(CHART));
+ closedir(CHART);
}
} else {
#COA Directories
opendir(COA, 'sql/coa');
- my @coa = sort(grep !/^(\.|[Ss]ample.*)/, readdir(COA));
+ @{$request->{coa_lcs}} =
+ map +{ code => $_ },
+ sort(grep !/^(\.|[Ss]ample.*)/,
+ readdir(COA));
closedir(COA);
+ }
- $request->{coa_lcs} =[];
- foreach my $lcs (sort {$a cmp $b} @coa){
- push @{$request->{coa_lcs}}, {code => $lcs};
- }
- }
- template_screen($request);
+ my $template = LedgerSMB::Template->new(
+ path => 'UI/setup',
+ template => 'select_coa',
+ format => 'HTML',
+ );
+ $template->render($request);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits