diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-11-22 21:38:18 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-11-22 21:38:18 +0000 |
commit | bda04bbe95f0ff8996619a5c2599b070d4a7326f (patch) | |
tree | 057af110773f9c84f5f7850e8980f1f873241575 /LedgerSMB | |
parent | 75a1145585826d7c88eee5fd8d536d62176d1e6d (diff) |
Batch numbers assigned at batch creation phase. Tests working.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2414 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/Batch.pm | 9 | ||||
-rw-r--r-- | LedgerSMB/DBTest.pm | 13 | ||||
-rw-r--r-- | LedgerSMB/Setting.pm | 20 |
3 files changed, 31 insertions, 11 deletions
diff --git a/LedgerSMB/Batch.pm b/LedgerSMB/Batch.pm index 8c4e397b..f18200c8 100644 --- a/LedgerSMB/Batch.pm +++ b/LedgerSMB/Batch.pm @@ -1,8 +1,17 @@ package LedgerSMB::Batch; +use LedgerSMB::Setting; use base qw(LedgerSMB::DBObject); +sub get_new_info { + $self = shift @_; + my $cc_object = LedgerSMB::Setting->new({base => $self}); + $cc_object->{key} = 'batch_cc'; + $self->{batch_number} = $cc_object->increment; + $self->{dbh}->commit; +} + sub create { $self = shift @_; my ($ref) = $self->exec_method(funcname => 'batch_create'); diff --git a/LedgerSMB/DBTest.pm b/LedgerSMB/DBTest.pm index b9eb6ae2..594dfa82 100644 --- a/LedgerSMB/DBTest.pm +++ b/LedgerSMB/DBTest.pm @@ -95,6 +95,19 @@ sub connect{ return $self; } +sub commit { + my ($self) = shift; + my $sth = $self->{_dbh}->prepare('SELECT 1'); + $sth->execute; + my ($retval) = $sth->fetchrow_array; + return $retval; +} + +sub selectrow_array { + my ($self) = shift; + return $self->{_dbh}->selectrow_array(@_); +} + sub disconnect { my ($self) = @_; $self->rollback; diff --git a/LedgerSMB/Setting.pm b/LedgerSMB/Setting.pm index 57630c97..f9fc122c 100644 --- a/LedgerSMB/Setting.pm +++ b/LedgerSMB/Setting.pm @@ -23,8 +23,6 @@ The following methods are passed through to stored procedures: =item get ($self->{key}) -=item get_default_accounts() (via AUTOLOAD) returns a list of accounts. - =item set ($self->{key}, $self->{value}) =item parse_increment ($self->{key}) @@ -58,7 +56,7 @@ sub get { $self->merge( $hashref, 'value' ); } -sub parse_increment { +sub increment { my $self = shift; my $myconfig = shift; @@ -68,26 +66,26 @@ sub parse_increment { # Replaces Form::UpdateDefaults - $_ = $self->incriment; - + my ($retval) = $self->exec_method('funcname' => 'setting_increment'); + my $value = $retval->{setting_increment}; # check for and replace # <?lsmb DATE ?>, <?lsmb YYMMDD ?>, <?lsmb YEAR ?>, <?lsmb MONTH ?>, <?lsmb DAY ?> or variations of # <?lsmb NAME 1 1 3 ?>, <?lsmb BUSINESS ?>, <?lsmb BUSINESS 10 ?>, <?lsmb CURR... ?> # <?lsmb DESCRIPTION 1 1 3 ?>, <?lsmb ITEM 1 1 3 ?>, <?lsmb PARTSGROUP 1 1 3 ?> only for parts # <?lsmb PHONE ?> for customer and vendors - my $dbvar = $_; - my $var = $_; + my $dbvar = $value; + my $var = $value; my $str; my $param; - if (/<\?lsmb /) { + if ($value =~ /<\?lsmb /) { - while (/<\?lsmb /) { + while ($value =~ /<\?lsmb /) { - s/<\?lsmb .*? \?>//; + $value =~ s/(<\?lsmb .*? \?>)//; last unless $&; - $param = $&; + $param = $1; $str = ""; if ( $param =~ /<\?lsmb date \?>/i ) { |