[Rt-commit] r2443 - in rt/branches/PLATANO-EXPERIMENTAL-CSS: . lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Mon Mar 14 03:02:13 EST 2005


Author: jesse
Date: Mon Mar 14 03:02:12 2005
New Revision: 2443

Modified:
   rt/branches/PLATANO-EXPERIMENTAL-CSS/   (props changed)
   rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm
Log:
 r8603 at hualien:  jesse | 2005-03-14 02:42:45 -0500
  r8491 at hualien:  jesse | 2005-03-14 02:27:57 -0500
   r6061 at hualien:  jesse | 2005-02-27 18:58:48 -0500
   RT::Transaction->Delete implemented. (for RTFM)
  
 


Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm	(original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm	Mon Mar 14 03:02:12 2005
@@ -192,10 +192,34 @@
 
 # {{{ sub Delete
 
+=head2 Delete
+
+Delete this transaction. Currently DOES NOT CHECK ACLS
+
+=cut
+
 sub Delete {
     my $self = shift;
-    return ( 0,
-        $self->loc('Deleting this object could break referential integrity') );
+
+
+    $RT::Handle->BeginTransaction();
+
+    my $attachments = $self->Attachments;
+
+    while (my $attachment = $attachments->Next) {
+        my ($id, $msg) = $attachment->Delete();
+        unless ($id) {
+            $RT::Handle->Rollback();
+            return($id, $self->loc("System Error: [_1]", $msg));
+        }
+    }
+    my ($id,$msg) = $self->SUPER::Delete();
+        unless ($id) {
+            $RT::Handle->Rollback();
+            return($id, $self->loc("System Error: [_1]", $msg));
+        }
+    $RT::Handle->Commit();
+    return ($id,$msg);
 }
 
 # }}}


More information about the Rt-commit mailing list