summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-03 01:03:22 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-03 01:03:22 +0000
commit6bd3193933475b0510001cca878328c37842e0a7 (patch)
tree6c219553214453c991828d12118b075e051ca268 /LedgerSMB
parenteccfb178ba7ac5510764818dae2f55bf25bf31b4 (diff)
RP.pm progress
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@471 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-xLedgerSMB/RP.pm81
1 files changed, 42 insertions, 39 deletions
diff --git a/LedgerSMB/RP.pm b/LedgerSMB/RP.pm
index f6f848d4..71432f58 100755
--- a/LedgerSMB/RP.pm
+++ b/LedgerSMB/RP.pm
@@ -1654,59 +1654,62 @@ sub aging {
sub get_customer {
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form) = @_;
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
- my $query = qq|SELECT name, email, cc, bcc
- FROM $form->{ct} ct
- WHERE ct.id = $form->{"$form->{ct}_id"}|;
- ($form->{$form->{ct}}, $form->{email}, $form->{cc}, $form->{bcc}) = $dbh->selectrow_array($query);
+ my $query = qq|
+ SELECT name, email, cc, bcc FROM $form->{ct} ct
+ WHERE ct.id = ?|;
+ $sth = $dbh->prepare($query);
+ $sth->execute($form->{"$form->{ct}_id"});
+ ($form->{$form->{ct}}, $form->{email}, $form->{cc}, $form->{bcc})
+ = $sth->fetchrow_array();
- $dbh->disconnect;
+ $dbh->commit;
}
sub get_taxaccounts {
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form) = @_;
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
- my $ARAP = uc $form->{db};
+ my $dbh = $form->{dbh};
+ my $ARAP = uc $form->{db};
- # get tax accounts
- my $query = qq|SELECT DISTINCT c.accno, c.description
- FROM chart c
- JOIN tax t ON (c.id = t.chart_id)
- WHERE c.link LIKE '%${ARAP}_tax%'
- ORDER BY c.accno|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror;
+ # get tax accounts
+ my $query = qq|
+ SELECT DISTINCT c.accno, c.description
+ FROM chart c
+ JOIN tax t ON (c.id = t.chart_id)
+ WHERE c.link LIKE '%${ARAP}_tax%'
+ ORDER BY c.accno|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror;
- my $ref = ();
- while ($ref = $sth->fetchrow_hashref(NAME_lc) ) {
- push @{ $form->{taxaccounts} }, $ref;
- }
- $sth->finish;
+ my $ref = ();
+ while ($ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ push @{ $form->{taxaccounts} }, $ref;
+ }
+ $sth->finish;
- # get gifi tax accounts
- my $query = qq|SELECT DISTINCT g.accno, g.description
- FROM gifi g
- JOIN chart c ON (c.gifi_accno= g.accno)
- JOIN tax t ON (c.id = t.chart_id)
- WHERE c.link LIKE '%${ARAP}_tax%'
- ORDER BY accno|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror;
+ # get gifi tax accounts
+ my $query = qq|
+ SELECT DISTINCT g.accno, g.description
+ FROM gifi g
+ JOIN chart c ON (c.gifi_accno= g.accno)
+ JOIN tax t ON (c.id = t.chart_id)
+ WHERE c.link LIKE '%${ARAP}_tax%'
+ ORDER BY accno|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror;
- while ($ref = $sth->fetchrow_hashref(NAME_lc) ) {
- push @{ $form->{gifi_taxaccounts} }, $ref;
- }
- $sth->finish;
+ while ($ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ push @{ $form->{gifi_taxaccounts} }, $ref;
+ }
+ $sth->finish;
- $dbh->disconnect;
+ $dbh->commit;
}