[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4786] trunk
- Subject: SF.net SVN: ledger-smb:[4786] trunk
- From: ..hidden..
- Date: Sun, 27 May 2012 03:07:24 +0000
Revision: 4786
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4786&view=rev
Author: einhverfr
Date: 2012-05-27 03:07:23 +0000 (Sun, 27 May 2012)
Log Message:
-----------
Merging sample code from branches/1.3
Added Paths:
-----------
trunk/doc/samples/recon_csv.pl
Property Changed:
----------------
trunk/
trunk/LedgerSMB/Scripts/account.pm
trunk/LedgerSMB/Scripts/admin.pm
trunk/LedgerSMB/Scripts/contact.pm
trunk/LedgerSMB/Scripts/customer.pm
trunk/LedgerSMB/Scripts/employee.pm
trunk/LedgerSMB/Scripts/file.pm
trunk/LedgerSMB/Scripts/journal.pm
trunk/LedgerSMB/Scripts/login.pm
trunk/LedgerSMB/Scripts/menu.pm
trunk/LedgerSMB/Scripts/payment.pm
trunk/LedgerSMB/Scripts/recon.pm
trunk/LedgerSMB/Scripts/setup.pm
trunk/LedgerSMB/Scripts/taxform.pm
trunk/LedgerSMB/Scripts/vendor.pm
trunk/sql/upgrade/1.2-1.3-manual.sql
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3:3711-4782
+ /branches/1.3:3711-4785
Property changes on: trunk/LedgerSMB/Scripts/account.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/account.pm:3712-4782
/branches/1.3/scripts/account.pl:3711-4368
+ /branches/1.3/LedgerSMB/Scripts/account.pm:3712-4785
/branches/1.3/scripts/account.pl:3711-4368
Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/admin.pm:3712-4782
/branches/1.3/scripts/admin.pl:3711-4678
+ /branches/1.3/LedgerSMB/Scripts/admin.pm:3712-4785
/branches/1.3/scripts/admin.pl:3711-4678
Property changes on: trunk/LedgerSMB/Scripts/contact.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/customer.pm:3712-4782
/branches/1.3/scripts/customer.pl:4273-4287
+ /branches/1.3/LedgerSMB/Scripts/contact.pm:4783-4785
/branches/1.3/LedgerSMB/Scripts/customer.pm:3712-4782
/branches/1.3/scripts/customer.pl:4273-4287
Property changes on: trunk/LedgerSMB/Scripts/customer.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/customer.pm:3712-4782
/branches/1.3/scripts/customer.pl:4273-4287
+ /branches/1.3/LedgerSMB/Scripts/customer.pm:3712-4785
/branches/1.3/scripts/customer.pl:4273-4287
Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4782
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
+ /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4785
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4782
/branches/1.3/scripts/file.pl:3711-4138
+ /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4785
/branches/1.3/scripts/file.pl:3711-4138
Property changes on: trunk/LedgerSMB/Scripts/journal.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/journal.pm:3712-4782
/branches/1.3/scripts/journal.pl:3711-4328
+ /branches/1.3/LedgerSMB/Scripts/journal.pm:3712-4785
/branches/1.3/scripts/journal.pl:3711-4328
Property changes on: trunk/LedgerSMB/Scripts/login.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/login.pm:3712-4782
/branches/1.3/scripts/login.pl:3711-4192
+ /branches/1.3/LedgerSMB/Scripts/login.pm:3712-4785
/branches/1.3/scripts/login.pl:3711-4192
Property changes on: trunk/LedgerSMB/Scripts/menu.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/menu.pm:3712-4782
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
+ /branches/1.3/LedgerSMB/Scripts/menu.pm:3712-4785
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/payment.pm:3712-4782
/branches/1.3/scripts/payment.pl:3711-4680
+ /branches/1.3/LedgerSMB/Scripts/payment.pm:3712-4785
/branches/1.3/scripts/payment.pl:3711-4680
Property changes on: trunk/LedgerSMB/Scripts/recon.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4782
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
+ /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4785
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/setup.pm:3712-4782
/branches/1.3/scripts/setup.pl:3711-4550
+ /branches/1.3/LedgerSMB/Scripts/setup.pm:3712-4785
/branches/1.3/scripts/setup.pl:3711-4550
Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/taxform.pm:3712-4782
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
+ /branches/1.3/LedgerSMB/Scripts/taxform.pm:3712-4785
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
Property changes on: trunk/LedgerSMB/Scripts/vendor.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/vendor.pm:3712-4782
/branches/1.3/scripts/vendor.pl:4273-4287
+ /branches/1.3/LedgerSMB/Scripts/vendor.pm:3712-4785
/branches/1.3/scripts/vendor.pl:4273-4287
Copied: trunk/doc/samples/recon_csv.pl (from rev 4785, branches/1.3/doc/samples/recon_csv.pl)
===================================================================
--- trunk/doc/samples/recon_csv.pl (rev 0)
+++ trunk/doc/samples/recon_csv.pl 2012-05-27 03:07:23 UTC (rev 4786)
@@ -0,0 +1,97 @@
+# This is a simple CSV parsing routine. The API isn't perfect and is likely to
+# change in the future. Right now the function is parse_[account_id] which may
+# break where multiple banks are used along with multiple databases. In the
+# In the future it is likely to change to parse_[dbname]_[account_id]
+#
+# COPYRIGHT (c) 2012 Chris Travers (..hidden..)
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# Redistributions in binary form must reproduce the above copyright notice, this
+# list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Place, relative to ledgersmb root: LedgerSMB/Reconciliation/CSV/Formats/
+package LedgerSMB::Reconciliation::CSV;
+
+use strict;
+
+# The below routines are aliases for parse_n() which does the work. This would
+# be done if the parsing was all done in the same format, with no differences.
+#
+# Of course if there were formatting differences, each format could abstract
+# this out or the like.
+#
+# 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 {
+ 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.
+
+sub parse_12345 {
+ parse_n(@_);
+}
+
+
+# This is the main function. It's pretty quick and dirty. You might want to
+# replace some of the CSV parsing with a CPAN module of your choice.
+#
+sub parse_n {
+ # Basic setup-- arguemnts and private variables
+ my $self = shift @_;
+ my ($contents) = @_;
+ my @entries;
+ my @columns;
+ my $first = 1;
+
+ # Simple (read quick/dirty) Parsing of file. All kinds of things could be
+ # improved on this but this is just sample code so....
+ #
+ for my $line (split /\n/, $contents){
+ next if ($line =~ /^$/);
+ if ($first){
+ # field conversions go here.
+ @columns = qw(cleared_date amount scn type);
+ $first = 0;
+ } else {
+ my @fields = split(/,/, $line);
+ my $ref = {};
+ for my $i(1 .. scalar @fields){
+ $ref->{$columns[$i - 1]} = $fields[$i - 1];
+ }
+ push @entries, $ref;
+ }
+ }
+
+ # The below logic might be helpful if a statement consisted of a mixture of
+ # wire transfers and checks. The major point is that we need lines back
+ # from here in an order that makes it reasonable to make matches. That
+ # means we should return first the transactions which have a source control
+ # number that is meaningful in LedgerSMB. This means checks should be
+ # returned first.
+ #
+ @entries = sort {($b->{type} eq 'CHECK') cmp ($a->{type} eq 'CHECK')} @entries;
+ return @entries;
+}
+
+1;
Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4782
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
+ /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4785
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.