[Rt-commit] r5207 - rt/branches/3.4-RELEASE/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Thu May 11 16:56:25 EDT 2006


Author: ruz
Date: Thu May 11 16:56:24 2006
New Revision: 5207

Modified:
   rt/branches/3.4-RELEASE/lib/RT/Transaction_Overlay.pm

Log:
* more checks on attachments processing

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	Thu May 11 16:56:24 2006
@@ -149,7 +149,13 @@
  
     my $id = $self->SUPER::Create(%params);
     $self->Load($id);
-    $self->_Attach( $args{'MIMEObj'} ) if defined $args{'MIMEObj'};
+    if ( defined $args{'MIMEObj'} ) {
+        my ($id, $msg) = $self->_Attach( $args{'MIMEObj'} );
+        unless ( $id ) {
+            $RT::Logger->error("Couldn't add attachment: $msg");
+            return ( 0, $self->loc("Couldn't add attachment") );
+        }
+    }
 
 
     #Provide a way to turn off scrips if we need to
@@ -471,11 +477,11 @@
     }
 
     my $Attachment = new RT::Attachment( $self->CurrentUser );
-    $Attachment->Create(
+    my ($id, $msg) = $Attachment->Create(
         TransactionId => $self->Id,
         Attachment    => $MIMEObject
     );
-    return ( $Attachment, $self->loc("Attachment created") );
+    return ( $Attachment, $msg || $self->loc("Attachment created") );
 
 }
 


More information about the Rt-commit mailing list