Commit fb66c33b authored by Jesse Vincent's avatar Jesse Vincent
Browse files

Fixes to handle large text custom fields gracefully

git-svn-id: svn+ssh://svn.bestpractical.com/svn/bps-public/rt/branches/3.4-RELEASE@2218 e417ac7c-1bcc-0310-8ffa-8f5827389a85
parent 4df3cabb
......@@ -62,7 +62,19 @@ sub Create {
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 @@ sub LoadByObjectContentAndCustomField {
}
=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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment