[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [469] trunk/LedgerSMB
- Subject: SF.net SVN: ledger-smb: [469] trunk/LedgerSMB
- From: ..hidden..
- Date: Thu, 02 Nov 2006 15:24:31 -0800
Revision: 469
http://svn.sourceforge.net/ledger-smb/?rev=469&view=rev
Author: tetragon
Date: 2006-11-02 15:24:28 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
Change defaults queries to using new table structure
Modified Paths:
--------------
trunk/LedgerSMB/AM.pm
trunk/LedgerSMB/GL.pm
trunk/LedgerSMB/RC.pm
Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm 2006-11-02 22:16:58 UTC (rev 468)
+++ trunk/LedgerSMB/AM.pm 2006-11-02 23:24:28 UTC (rev 469)
@@ -251,8 +251,10 @@
# set inventory_accno_id, income_accno_id, expense_accno_id to defaults
$query = qq|
UPDATE parts
- SET inventory_accno_id = (SELECT inventory_accno_id
- FROM defaults)
+ SET inventory_accno_id = (SELECT value
+ FROM defaults
+ WHERE setting_key =
+ 'inventory_accno_id')
WHERE inventory_accno_id = ?|;
$sth = $dbh->prepare($query);
@@ -1592,7 +1594,6 @@
my $boundary = time;
my $tmpfile = "${LedgerSMB::Sysconfig::userspath}/$boundary.$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql";
$tmpfile .= ".gz" if ${LedgerSMB::Sysconfig::gzip};
- my $out = $form->{OUT};
$form->{OUT} = ">$tmpfile";
open(OUT, "$form->{OUT}") or $form->error("$form->{OUT} : $!");
Modified: trunk/LedgerSMB/GL.pm
===================================================================
--- trunk/LedgerSMB/GL.pm 2006-11-02 22:16:58 UTC (rev 468)
+++ trunk/LedgerSMB/GL.pm 2006-11-02 23:24:28 UTC (rev 469)
@@ -500,13 +500,17 @@
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 @@
$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;
Modified: trunk/LedgerSMB/RC.pm
===================================================================
--- trunk/LedgerSMB/RC.pm 2006-11-02 22:16:58 UTC (rev 468)
+++ trunk/LedgerSMB/RC.pm 2006-11-02 23:24:28 UTC (rev 469)
@@ -232,9 +232,11 @@
if ($form->{fx_transaction}) {
$fx_transaction = qq|
AND NOT (ac.chart_id IN
- (SELECT fxgain_accno_id FROM defaults
+ (SELECT value AS fxgain_accno_id FROM defaults
+ WHERE setting_key = 'fxgain_accno_id'
UNION
- SELECT fxloss_accno_id FROM defaults))|;
+ SELECT value AS fxloss_accno_id FROM defaults
+ WHERE setting_key = 'fxloss_accno_id))|;
} else {
$fx_transaction = qq|
AND ac.fx_transaction = '0'|;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.