CustomerVendor: Kaskadiertes Löschen/Speichern
authorThomas Heck <theck@linet-services.de>
Mon, 8 Jul 2013 11:51:24 +0000 (13:51 +0200)
committerJan Büren <jan@kivitendo-premium.de>
Thu, 18 Jul 2013 07:09:04 +0000 (09:09 +0200)
SL/Controller/CustomerVendor.pm

index 2d4bd6c..847dc71 100644 (file)
@@ -253,7 +253,7 @@ sub action_delete {
   else {
 
     $db->do_transaction(sub {
-      $self->{cv}->delete();
+      $self->{cv}->delete(cascade => 1);
 
       my $snumbers = $self->is_vendor() ? 'vendornumber_'. $self->{cv}->vendornumber : 'customernumber_'. $self->{cv}->customernumber;
       SL::DB::History->new(
@@ -286,7 +286,7 @@ sub action_delete_contact {
         $self->{contact}->save();
         SL::Helper::Flash::flash('info', $::locale->text('Contact is in use and was flagged invalid.'));
       } else {
-        $self->{contact}->delete();
+        $self->{contact}->delete(cascade => 1);
         SL::Helper::Flash::flash('info', $::locale->text('Contact deleted.'));
       }
     }) || die($db->error);
@@ -309,10 +309,10 @@ sub action_delete_shipto {
     $db->do_transaction(sub {
       if ( $self->{shipto}->used ) {
         $self->{shipto}->detach();
-        $self->{shipto}->save();
+        $self->{shipto}->save(cascade => 1);
         SL::Helper::Flash::flash('info', $::locale->text('Shipto is in use and was flagged invalid.'));
       } else {
-        $self->{shipto}->delete();
+        $self->{shipto}->delete(cascade => 1);
         SL::Helper::Flash::flash('info', $::locale->text('Shipto deleted.'));
       }
     }) || die($db->error);