summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/Batch.pm9
-rw-r--r--LedgerSMB/DBTest.pm13
-rw-r--r--LedgerSMB/Setting.pm20
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 ) {