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

SF.net SVN: ledger-smb:[4844] trunk



Revision: 4844
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4844&view=rev
Author:   einhverfr
Date:     2012-06-05 14:46:46 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
added db name to cash recon text input parser function name to avoid conflicts on multi-db systems

Modified Paths:
--------------
    trunk/LedgerSMB/Reconciliation/CSV.pm
    trunk/doc/samples/recon_csv.pl

Modified: trunk/LedgerSMB/Reconciliation/CSV.pm
===================================================================
--- trunk/LedgerSMB/Reconciliation/CSV.pm	2012-06-05 14:37:56 UTC (rev 4843)
+++ trunk/LedgerSMB/Reconciliation/CSV.pm	2012-06-05 14:46:46 UTC (rev 4844)
@@ -4,6 +4,7 @@
 package LedgerSMB::Reconciliation::CSV;
 
 use base qw/LedgerSMB::DBObject::Reconciliation/;
+use LedgerSMB::App_State;
 
 opendir (DCSV, 'LedgerSMB/Reconciliation/CSV/Formats');
 for my $format (readdir(DCSV)){
@@ -30,7 +31,7 @@
     my ($recon, $fldname) = @_;
     my $contents = $self->load_file($fldname);
     
-    my $func = "parse_" . $recon->{chart_id};
+    my $func = "parse_${LedgerSMB::App_State::DBName}_$recon->{chart_id}";
     if ($self->can($func)){
        @entries = $self->can($func)->($self,$contents);
        @{$self->{entries}} = @entries;

Modified: trunk/doc/samples/recon_csv.pl
===================================================================
--- trunk/doc/samples/recon_csv.pl	2012-06-05 14:37:56 UTC (rev 4843)
+++ trunk/doc/samples/recon_csv.pl	2012-06-05 14:46:46 UTC (rev 4844)
@@ -39,16 +39,16 @@
 # Despite the namespace this doesn't have to handle CSV, though that is the most
 # frequent use case.  Any other format could be used instead.
 
-sub parse_11 {
+sub parse_mycompany_11 {
     parse_n(@_);
 }
 
-# One workaround for the above limitation is to set up different databases with
-# different start id's for accounts (on creation).  This would mean you could
-# have different parsers with presumed mutually exclusive id ranges, perhaps
-# offset by 10000 or 100000.
+# In 1.3, the recon parsing used only the account_id which meant that this
+# wasn't very friendly system-wide.  As of 1.4, we include the db name as part
+# of the dispatch routine.  For compatibility, you may still end up with 
+# non-overlapping ranges.
 
-sub parse_12345 {
+sub parse_mycompany_12345 {
     parse_n(@_);
 }
 

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