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

jesse at bestpractical.com jesse at bestpractical.com
Thu Feb 10 16:25:10 EST 2005


Author: jesse
Date: Thu Feb 10 16:25:10 2005
New Revision: 2218

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/lib/RT/ObjectCustomFieldValue_Overlay.pm
Log:
 r4672 at hualien:  jesse | 2005-02-10T21:19:40.639192Z
 Fixes to handle large text custom fields gracefully
 
 


Modified: rt/branches/3.4-RELEASE/lib/RT/ObjectCustomFieldValue_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/ObjectCustomFieldValue_Overlay.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/ObjectCustomFieldValue_Overlay.pm	Thu Feb 10 16:25:10 2005
@@ -62,7 +62,19 @@
                 ContentEncoding => '',
 
           @_);
-    ($args{'ContentEncoding'}, $args{'LargeContent'}) = $self->_EncodeLOB($args{'LargeContent'}, $args{'ContentType'}) if ($args{'LargeContent'}); 
+
+   
+    if( $args{'Content'} && length($args{'Content'}) > 255 && !$args{'LargeContent'} ) {
+
+        $args{'LargeContent'} = $args{'Content'};
+        $args{'Content'} = '';
+        $args{'ContentType'} = 'text/plain';
+    }
+
+    ( $args{'ContentEncoding'}, $args{'LargeContent'} ) =
+      $self->_EncodeLOB( $args{'LargeContent'}, $args{'ContentType'} )
+      if ( $args{'LargeContent'} );
+
     $self->SUPER::Create(
                          CustomField => $args{'CustomField'},
                          ObjectType => $args{'ObjectType'},
@@ -134,6 +146,25 @@
 
 }
 
+
+=head2 Content
+
+Return this custom field's content. If there's no "regular"
+content, try "LargeContent"
+
+=cut
+
+
+sub Content {
+    my $self = shift;
+    my $content = $self->SUPER::Content();
+    if (!$content && $self->ContentType eq 'text/plain') {
+       $content = $self->LargeContent(); 
+    }
+    return($content);
+}
+
+
 sub Delete {
     my $self = shift;
     $self->SetDisabled(1);


More information about the Rt-commit mailing list