$form->{duedate} ||= $form->{invdate};
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $sth;
my $query = qq|SELECT date | . conv_dateq($form->{duedate}) . qq| - date | . conv_dateq($form->{invdate}) . qq| AS terms|;
$form->{username} = $myconfig->{name};
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form, @wanted_vars) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $language_id = $form->{language_id};
'allow_fallback' => 1);
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form, $locale) = @_;
# connect to database, turn off autocommit
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->get_standard_dbh;
+ $dbh->begin_work;
my (%payments, $old_form, $row, $item, $query, %keep_vars);
restore_form($old_form);
my $rc = $dbh->commit();
- $dbh->disconnect();
$main::lxdebug->leave_sub();
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->get_standard_dbh;
+ $dbh->begin_work;
&reverse_invoice($dbh, $form);
do_query($form, $dbh, qq|DELETE FROM status WHERE trans_id = ?|, @values);
my $rc = $dbh->commit;
- $dbh->disconnect;
if ($rc) {
my $spool = $::lx_office_conf{paths}->{spool};
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $i = $form->{rowcount};
map { $item->{"ic_cvar_" . $_->{name} } = $_->{value} } @{ $custom_variables };
}
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
$form->{"PRICES"} = {};
$pkr->{selected} = ' selected';
}
} elsif ( ($form->parse_amount($myconfig, $price_new)
- != $form->parse_amount($myconfig, $form->{"sellprice_$i"}))
+ != $form->parse_amount($myconfig, $form->{"sellprice_$i"}))
and ($price_new ne 0) and defined $price_new) {
# sellprice has changed
# when loading existing invoices $price_new is NULL
$pkq->finish;
}
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
# ToDO: die when this happens and throw an error
$main::lxdebug->leave_sub() and return 0 if ($table =~ /\W/);
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $query = qq|SELECT storno FROM $table WHERE storno_id = ?|;
my ($result) = selectrow_query($form, $dbh, $query, $form->{id});
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
return $result;
# ToDO: die when this happens and throw an error
$main::lxdebug->leave_sub() and return 0 if ($table =~ /\W/);
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $query = qq|SELECT storno FROM $table WHERE id = ?|;
my ($result) = selectrow_query($form, $dbh, $query, $id);
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
return $result;
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $query = qq| SELECT accno FROM chart WHERE id = (SELECT ar_paid_accno_id FROM defaults)|;
my ($result) = selectrow_query($form, $dbh, $query);
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
return $result;