X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FRP.pm;h=479d850308a5b541262c4304623125fa05cc27e9;hb=31f989254ce9f2ab881af7aee5d07dd63df0e004;hp=425dfa1c29a08c97217f537cf3fe3e1bf9cf770e;hpb=d38eaef8d62fc0826fa963c0ebea4fced33f5410;p=kivitendo-erp.git diff --git a/SL/RP.pm b/SL/RP.pm index 425dfa1c2..479d85030 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -25,7 +25,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # # backend code for reports @@ -38,6 +39,7 @@ use SL::DBUtils; use Data::Dumper; use SL::DB::Helper::AccountingPeriod qw(get_balance_starting_date); use List::Util qw(sum); +use SL::DB; # use warnings; use strict; @@ -660,7 +662,7 @@ sub trial_balance { my ($self, $myconfig, $form, %options) = @_; - my $dbh = $form->dbconnect($myconfig); + my $dbh = SL::DB->client->dbh; my ($query, $sth, $ref); my %balance = (); @@ -1162,8 +1164,6 @@ sub trial_balance { } - $dbh->disconnect; - # debits and credits for headings foreach my $accno (@headingaccounts) { foreach $ref (@{ $form->{TB} }) { @@ -1200,7 +1200,7 @@ sub aging { my ($self, $myconfig, $form) = @_; # connect to database - my $dbh = $form->dbconnect($myconfig); + my $dbh = SL::DB->client->dbh; my ($invoice, $arap, $buysell, $ct, $ct_id, $ml); @@ -1332,9 +1332,6 @@ sub aging { $sth->finish; - # disconnect - $dbh->disconnect; - $main::lxdebug->leave_sub(); } @@ -1343,8 +1340,7 @@ sub get_customer { my ($self, $myconfig, $form) = @_; - # connect to database - my $dbh = $form->dbconnect($myconfig); + my $dbh = SL::DB->client->dbh; my $ct = $form->{ct} eq "customer" ? "customer" : "vendor"; @@ -1354,7 +1350,6 @@ sub get_customer { WHERE ct.id = ?|; ($form->{ $form->{ct} }, $form->{email}, $form->{cc}, $form->{bcc}) = selectrow_query($form, $dbh, $query, $form->{"${ct}_id"}); - $dbh->disconnect; $main::lxdebug->leave_sub(); } @@ -1364,8 +1359,7 @@ sub tax_report { my ($self, $myconfig, $form) = @_; - # connect to database - my $dbh = $form->dbconnect($myconfig); + my $dbh = SL::DB->client->dbh; my ($null, $department_id) = split /--/, $form->{department}; @@ -1454,8 +1448,6 @@ sub tax_report { $form->{TR} = selectall_hashref_query($form, $dbh, $query); - $dbh->disconnect; - $main::lxdebug->leave_sub(); } @@ -1614,8 +1606,7 @@ sub bwa { my ($self, $myconfig, $form) = @_; - # connect to database - my $dbh = $form->dbconnect($myconfig); + my $dbh = SL::DB->client->dbh; my $last_period = 0; my $category; @@ -1815,7 +1806,6 @@ sub bwa { } } - $dbh->disconnect; $main::lxdebug->leave_sub(); }