summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-13 01:47:52 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-13 01:47:52 +0000
commit1535312181520fa2fa182860476ecc6e0486f40f (patch)
treea57347a02c0563b38687c19cbd75056ee9e8016b
parentc41d0a434606332cc7dd1a1e81f4dcaeea590896 (diff)
Lots more dbconnects removed
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@541 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/AM.pm4
-rwxr-xr-xLedgerSMB/CP.pm2
-rwxr-xr-xLedgerSMB/HR.pm4
-rwxr-xr-xLedgerSMB/IR.pm4
-rwxr-xr-xLedgerSMB/OE.pm15
-rwxr-xr-xLedgerSMB/PE.pm8
-rwxr-xr-xLedgerSMB/RC.pm2
-rwxr-xr-xLedgerSMB/RP.pm2
8 files changed, 20 insertions, 21 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index 351b0ae0..6d72df56 100755
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -675,7 +675,7 @@ sub get_business {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $query = qq|
SELECT description, discount
@@ -695,7 +695,7 @@ sub save_business {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
$form->{description} =~ s/-(-)+/-/g;
$form->{description} =~ s/ ( )+/ /g;
diff --git a/LedgerSMB/CP.pm b/LedgerSMB/CP.pm
index 8cd22162..a7a2f0d0 100755
--- a/LedgerSMB/CP.pm
+++ b/LedgerSMB/CP.pm
@@ -560,7 +560,7 @@ sub post_payments {
my ($self, $myconfig, $form) = @_;
# connect to database, turn AutoCommit off
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->{dbh};
my $sth;
diff --git a/LedgerSMB/HR.pm b/LedgerSMB/HR.pm
index a4405892..16c1dab6 100755
--- a/LedgerSMB/HR.pm
+++ b/LedgerSMB/HR.pm
@@ -37,7 +37,7 @@ package HR;
sub get_employee {
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $query;
my $sth;
@@ -173,7 +173,7 @@ sub delete_employee {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->{dbh};
# delete employee
diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm
index d5b38bda..8c79ee64 100755
--- a/LedgerSMB/IR.pm
+++ b/LedgerSMB/IR.pm
@@ -975,7 +975,7 @@ sub retrieve_invoice {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->{dbh};
my $query;
@@ -1370,7 +1370,7 @@ sub item_links {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $query = qq|
SELECT accno, description, link
diff --git a/LedgerSMB/OE.pm b/LedgerSMB/OE.pm
index 0992b00e..cc13693c 100755
--- a/LedgerSMB/OE.pm
+++ b/LedgerSMB/OE.pm
@@ -750,7 +750,6 @@ sub delete {
$form->audittrail($dbh, "", \%audittrail);
my $rc = $dbh->commit;
- $dbh->disconnect;
if ($rc) {
foreach $spoolfile (@spoolfiles) {
@@ -1000,7 +999,7 @@ sub order_details {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $query;
my $sth;
@@ -1729,7 +1728,7 @@ sub project_description {
sub get_warehouses {
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
# setup warehouses
my $query = qq|
SELECT id, description
@@ -1744,7 +1743,7 @@ sub get_warehouses {
}
$sth->finish;
- $dbh->disconnect;
+ $dbh->commit;
}
@@ -1757,7 +1756,7 @@ sub save_inventory {
my $ml = ($form->{type} eq 'ship_order') ? -1 : 1;
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->{dbh};
my $sth;
my $wth;
my $serialnumber;
@@ -2110,7 +2109,7 @@ sub get_inventory {
sub transfer {
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->{dbh};
($form->{employee}, $form->{employee_id}) = $form->get_employee($dbh);
@@ -2205,7 +2204,7 @@ sub get_soparts {
# foreign exchange rates
&exchangerate_defaults($dbh, $form);
- $dbh->disconnect;
+ $dbh->commit;
}
@@ -2302,7 +2301,7 @@ sub generate_orders {
}
# connect to database
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->{dbh};
# foreign exchange rates
&exchangerate_defaults($dbh, $form);
diff --git a/LedgerSMB/PE.pm b/LedgerSMB/PE.pm
index 2d346175..07da3dff 100755
--- a/LedgerSMB/PE.pm
+++ b/LedgerSMB/PE.pm
@@ -979,7 +979,7 @@ sub partsgroups {
my $var;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
$form->{sort} = "partsgroup" unless $form->{partsgroup};
my @a = (partsgroup);
@@ -1051,7 +1051,7 @@ sub save_partsgroup {
sub get_partsgroup {
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $query = qq|SELECT * FROM partsgroup WHERE id = ?|;
my $sth = $dbh->prepare($query);
@@ -1432,7 +1432,7 @@ sub project_sales_order {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $query = qq|SELECT current_date|;
my ($transdate) = $dbh->selectrow_array($query);
@@ -1443,7 +1443,7 @@ sub project_sales_order {
$form->all_employees($myconfig, $dbh, $transdate);
- $dbh->disconnect;
+ $dbh->commit;
}
diff --git a/LedgerSMB/RC.pm b/LedgerSMB/RC.pm
index 36488e37..7ba6770a 100755
--- a/LedgerSMB/RC.pm
+++ b/LedgerSMB/RC.pm
@@ -444,7 +444,7 @@ sub payment_transactions {
sub reconcile {
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $query = qq|SELECT id FROM chart
WHERE accno = '$form->{accno}'|;
diff --git a/LedgerSMB/RP.pm b/LedgerSMB/RP.pm
index 9b349bab..8be97f17 100755
--- a/LedgerSMB/RP.pm
+++ b/LedgerSMB/RP.pm
@@ -104,7 +104,7 @@ sub inventory_activity {
sub yearend_statement {
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
# if todate < existing yearends, delete GL and yearends
my $query = qq|SELECT trans_id FROM yearend WHERE transdate >= ?|;