]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/CT.pm
Form: single-dbh disconnects
[kivitendo-erp.git] / SL / CT.pm
index 416ed6871001282cfcab38cec01ec2ad83f3012f..e4b1ee0b188ce3c33353d886ed6f02a9e0502a8e 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -40,6 +40,7 @@ package CT;
 use SL::Common;
 use SL::CVar;
 use SL::DBUtils;
+use SL::DB;
 use Text::ParseWords;
 
 use strict;
@@ -251,7 +252,7 @@ sub search {
   }
 
   my $pg_select = $form->{l_pricegroup} ? qq|, pg.pricegroup as pricegroup | : '';
-  my $pg_join   = $form->{l_pricegroup} ? qq|LEFT JOIN pricegroup pg ON (ct.klass = pg.id) | : '';
+  my $pg_join   = $form->{l_pricegroup} ? qq|LEFT JOIN pricegroup pg ON (ct.pricegroup_id = pg.id) | : '';
   my $query =
     qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
     qq|  pt.description as payment | .
@@ -341,7 +342,7 @@ sub get_contact {
 
   die 'Missing argument: cp_id' unless $::form->{cp_id};
 
-  my $dbh   = $form->dbconnect($myconfig);
+  my $dbh   = SL::DB->client->dbh;
   my $query =
     qq|SELECT * FROM contacts c | .
     qq|WHERE cp_id = ? ORDER BY cp_id limit 1|;
@@ -359,7 +360,6 @@ sub get_contact {
   ($form->{cp_used}) = selectfirst_array_query($form, $dbh, $query, ($form->{cp_id})x2);
 
   $sth->finish;
-  $dbh->disconnect;
 
   $main::lxdebug->leave_sub();
 }