Merge branch 'master' of lx-office.linet-services.de:lx-office-erp
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 23 Jun 2011 12:12:05 +0000 (14:12 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 23 Jun 2011 12:12:05 +0000 (14:12 +0200)
SL/CT.pm
bin/mozilla/ct.pl

index b36cfa3..6d801d4 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -1045,7 +1045,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();
 
index 4121ac5..b25509e 100644 (file)
@@ -717,7 +717,7 @@ sub delete_contact {
   CT->get_contact(\%myconfig, \%$form);
 
   unless ($form->{cp_used}) {
-    CT->delete_shipto($form->{cp_id});
+    CT->delete_contact($form->{cp_id});
     @$form{ grep /^cp_/, keys %$form } = undef;
   }