[Rt-commit] r2266 - in rt/branches/3.4-RELEASE: . lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Sun Feb 27 19:02:45 EST 2005


Author: jesse
Date: Sun Feb 27 19:02:44 2005
New Revision: 2266

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/lib/RT/Transaction_Overlay.pm
Log:
 r6061 at hualien:  jesse | 2005-02-27 18:58:48 -0500
 RT::Transaction->Delete implemented. (for RTFM)


Modified: rt/branches/3.4-RELEASE/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Transaction_Overlay.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Transaction_Overlay.pm	Sun Feb 27 19:02:44 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