[Rt-devel] RT 3.4.0 - Problems with Custom Field Type Text
truncating values
Jesse Vincent
jesse at bestpractical.com
Tue Feb 8 11:55:53 EST 2005
Can you try the attached patch?
On Tue, Feb 08, 2005 at 10:53:29AM -0500, Scott Hebert wrote:
> Hi,
>
> I recently upgraded to RT 3.4.0 and am making use of the new Text
> Custom Field Type.
>
> Unfortunately, the CF Values are getting truncated.
>
> I am entering large paragraphs of text (about 30 lines) and the value
> being saved with only about 5 lines.
>
> I've been trying to track this down and have found that in Recond.pm
> the $args{'Value'} is different compared to $new_value->Content which
> is returned from $cf->AddValueForObject.
>
> I will continue to delve deeper into the code, but any assistance
> would be greatly appreciated.
>
> Thanks,
>
> Scott
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>
--
-------------- next part --------------
=== lib/RT/ObjectCustomFieldValue_Overlay.pm
==================================================================
--- lib/RT/ObjectCustomFieldValue_Overlay.pm (revision 4103)
+++ lib/RT/ObjectCustomFieldValue_Overlay.pm (local)
@@ -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-devel
mailing list