X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCT.pm;h=467fb0841f065d023bb7f43c6d3fd24fb8fd4792;hb=8084ef359515031ec8429b49baf0ab09858f55d2;hp=b36cfa3e88bc3a55d6daf90e16331285e78d2e01;hpb=1072cd08c6f5b1905a34dcb3eeab3ddec98d6905;p=kivitendo-erp.git diff --git a/SL/CT.pm b/SL/CT.pm index b36cfa3e8..467fb0841 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -236,7 +236,7 @@ sub save_customer { $form->{klass} = 0 unless ($form->{klass}); # connect to database - my $dbh = $form->dbconnect_noauto($myconfig); + my $dbh = $form->get_standard_dbh; map( { $form->{"cp_${_}"} = $form->{"selected_cp_${_}"} @@ -445,7 +445,6 @@ sub save_customer { 'always_valid' => 1); my $rc = $dbh->commit(); - $dbh->disconnect(); $main::lxdebug->leave_sub(); return $rc; @@ -458,7 +457,7 @@ sub save_vendor { $form->{taxzone_id} *= 1; # connect to database - my $dbh = $form->dbconnect_noauto($myconfig); + my $dbh = $form->get_standard_dbh; map( { $form->{"cp_${_}"} = $form->{"selected_cp_${_}"} @@ -653,7 +652,6 @@ sub save_vendor { 'always_valid' => 1); my $rc = $dbh->commit(); - $dbh->disconnect(); $main::lxdebug->leave_sub(); return $rc; @@ -1045,7 +1043,24 @@ sub delete_shipto { my %myconfig = %main::myconfig; my $dbh = $form->get_standard_dbh(\%myconfig); - do_query($form, $dbh, qq|UPDATE contacts SET cp_cv_id = NULL WHERE cp_id = ?|, $shipto_id); + do_query($form, $dbh, qq|UPDATE shipto SET trans_id = NULL WHERE shipto_id = ?|, $shipto_id); + + $dbh->commit(); + + $main::lxdebug->leave_sub(); +} + +sub delete_contact { + $main::lxdebug->enter_sub(); + + my $self = shift; + my $cp_id = shift; + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $dbh = $form->get_standard_dbh(\%myconfig); + + do_query($form, $dbh, qq|UPDATE contacts SET cp_cv_id = NULL WHERE cp_id = ?|, $cp_id); $dbh->commit();