summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/Batch.pm7
-rw-r--r--LedgerSMB/DBObject.pm2
-rw-r--r--LedgerSMB/GL.pm7
-rwxr-xr-xLedgerSMB/Session/DB.pm2
4 files changed, 12 insertions, 6 deletions
diff --git a/LedgerSMB/Batch.pm b/LedgerSMB/Batch.pm
index 7c7bcc53..1e6b320e 100644
--- a/LedgerSMB/Batch.pm
+++ b/LedgerSMB/Batch.pm
@@ -3,4 +3,11 @@
package LedgerSMB::Batch;
use base qw(LedgerSMB::DBObject);
+sub create {
+ $self = shift @_;
+ my ($ref) = $self->exec_method(funcname => 'batch_create');
+ $self->{id} = $ref->{id}
+ return $ref->{id};
+}
+
1;
diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm
index f52724c7..93fc4f6e 100644
--- a/LedgerSMB/DBObject.pm
+++ b/LedgerSMB/DBObject.pm
@@ -107,7 +107,7 @@ sub exec_method {
my $query = "SELECT proname, pronargs, proargnames FROM pg_proc WHERE proname = ?";
my $sth = $self->{dbh}->prepare($query);
- $sth->execute($funcname);
+ $sth->execute($funcname) || $self->error($DBI::errstr . "in exec_method");
my $ref;
$ref = $sth->fetchrow_hashref('NAME_lc');
diff --git a/LedgerSMB/GL.pm b/LedgerSMB/GL.pm
index 502bb0e9..834bf8f0 100644
--- a/LedgerSMB/GL.pm
+++ b/LedgerSMB/GL.pm
@@ -101,12 +101,11 @@ sub post_transaction {
$uid .= "$$";
$query = qq|
- INSERT INTO gl (reference, employee_id)
- VALUES ('$uid', (SELECT id FROM employee
- WHERE login = ?))|;
+ INSERT INTO gl (reference)
+ VALUES ('$uid')|;
$sth = $dbh->prepare($query);
- $sth->execute( $form->{login} ) || $form->dberror($query);
+ $sth->execute() || $form->dberror($query);
$query = qq|
SELECT id
diff --git a/LedgerSMB/Session/DB.pm b/LedgerSMB/Session/DB.pm
index bfc0b9fc..19896ae7 100755
--- a/LedgerSMB/Session/DB.pm
+++ b/LedgerSMB/Session/DB.pm
@@ -182,7 +182,7 @@ sub session_create {
}
$deleteExisting->execute( $login)
|| $lsmb->dberror(
- __FILE__ . ':' . __LINE__ . ': Delete from session: ' );
+ __FILE__ . ':' . __LINE__ . ': Delete from session: ' . $DBI::errstr);
#doing the random stuff in the db so that LedgerSMB won't
#require a good random generator - maybe this should be reviewed,