From da36e0095ae8b05e124507abd70b7122a94c15f1 Mon Sep 17 00:00:00 2001 From: tetragon Date: Thu, 2 Nov 2006 23:24:28 +0000 Subject: Change defaults queries to using new table structure git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@469 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/GL.pm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'LedgerSMB/GL.pm') diff --git a/LedgerSMB/GL.pm b/LedgerSMB/GL.pm index c6fe1037..8d31c453 100755 --- a/LedgerSMB/GL.pm +++ b/LedgerSMB/GL.pm @@ -500,13 +500,17 @@ sub transaction { if ($form->{id}) { - $query = "SELECT closedto, revtrans - FROM defaults"; + $query = "SELECT setting_key, value + FROM defaults + WHERE setting_key IN + ('closedto', 'revtrans')"; $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - ($form->{closedto}, $form->{revtrans}) = $sth->fetchrow_array; + my $results = $sth->fetchall_hashref('setting_key'); + $form->{closedto} = $results->{'closedto'}->{'value'}; + $form->{revtrans} = $results->{'revtrans'}->{'value'}; $sth->finish; $query = qq|SELECT g.*, d.description AS department @@ -544,13 +548,19 @@ sub transaction { $form->get_recurring($dbh); } else { - $query = "SELECT current_date AS transdate, closedto, revtrans - FROM defaults"; + $query = "SELECT current_date AS transdate, setting_key, value + FROM defaults + WHERE setting_key IN + ('closedto', 'revtrans')"; + $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - ($form->{transdate}, $form->{closedto}, $form->{revtrans}) = $sth->fetchrow_array; + my $results = $sth->fetchall_hashref('setting_key'); + $form->{closedto} = $results->{'closedto'}->{'value'}; + $form->{revtrans} = $results->{'revtrans'}->{'value'}; + $form->{transdate} = $results->{'revtrans'}->{'transdate'}; } $sth->finish; -- cgit v1.2.3