X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCT.pm;h=467fb0841f065d023bb7f43c6d3fd24fb8fd4792;hb=8add0ccd27ab0ff17256b74dccd1f761c0d09182;hp=58a460039f5d709bf1703036e5c65aefd57003e3;hpb=cf889668782d1ffbb76b9f28e1d36848544fa3b3;p=kivitendo-erp.git diff --git a/SL/CT.pm b/SL/CT.pm index 58a460039..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(); @@ -1156,7 +1171,7 @@ sub parse_excel_file { delete $form->{OUT}; - $form->parse_template($myconfig, $main::userspath); + $form->parse_template($myconfig); $main::lxdebug->leave_sub(); }