[Rt-commit] r6313 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Oct 27 01:41:02 EDT 2006


Author: ruz
Date: Fri Oct 27 01:41:01 2006
New Revision: 6313

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm

Log:
 r4051 at cubic-pc:  cubic | 2006-10-27 06:38:32 +0400
 ::Transaction->ContentObj
 * if the main attachment of the transaction is multipart
   then fetch a first not empty text/plain child directly
   from DB.


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm	Fri Oct 27 01:41:01 2006
@@ -360,13 +360,24 @@
     # If it's a multipart object, first try returning the first
     # text/plain part.
 
-    elsif ( $Attachment->ContentType() =~ '^multipart/' ) {
-        my $plain_parts = $Attachment->Children();
+    elsif ( $Attachment->ContentType =~ '^multipart/' ) {
+        my $plain_parts = $Attachment->Children;
         $plain_parts->ContentType( VALUE => 'text/plain' );
+        $plain_parts->Limit(
+            FIELD => 'Content',
+            OPERATOR => 'IS NOT',
+            VALUE => undef,
+        );
+        $plain_parts->Limit(
+            ENTRYAGGREGATOR => 'AND',
+            FIELD => 'Content',
+            OPERATOR => '!=',
+            VALUE => '',
+        );
 
         # If we actully found a part, return its content
-        if ( $plain_parts->First && $plain_parts->First->Content ne '' ) {
-            return ( $plain_parts->First );
+        if ( my $first = $plain_parts->First ) {
+            return $first;
         }
 
 


More information about the Rt-commit mailing list