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

ruz at bestpractical.com ruz at bestpractical.com
Wed Aug 2 15:47:44 EDT 2006


Author: ruz
Date: Wed Aug  2 15:47:42 2006
New Revision: 5684

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

Log:
 r3577 at cubic-pc:  cubic | 2006-08-02 01:32:36 +0400
 ObjectCustomFieldValue::Create
 * log error when Content is longer than 255 chars
   and LargeContent is not empty. We still create
   record and content of the Content arg would be
   truncated.


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/ObjectCustomFieldValue_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/ObjectCustomFieldValue_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/ObjectCustomFieldValue_Overlay.pm	Wed Aug  2 15:47:42 2006
@@ -52,23 +52,26 @@
 sub Create {
     my $self = shift;
     my %args = (
-                CustomField => '0',
-                ObjectType => '',
-                ObjectId => '0',
-                Disabled => '0',
-                Content => '',
-                LargeContent => '',
-                ContentType => '',
-                ContentEncoding => '',
-
-          @_);
-
-   
-    if( $args{'Content'} && length($args{'Content'}) > 255 && !$args{'LargeContent'} ) {
-
-        $args{'LargeContent'} = $args{'Content'};
-        $args{'Content'} = '';
-        $args{'ContentType'} = 'text/plain';
+        CustomField     => 0,
+        ObjectType      => '',
+        ObjectId        => 0,
+        Disabled        => 0,
+        Content         => '',
+        LargeContent    => undef,
+        ContentType     => '',
+        ContentEncoding => '',
+        @_,
+    );
+
+    if ( defined $args{'Content'} && length( $args{'Content'} ) > 255 ) {
+        if ( defined $args{'LargeContent'} && length $args{'LargeContent'} ) {
+            $RT::Logger->error("Content is longer than 255 and LargeContent specified");
+        }
+        else {
+            $args{'LargeContent'} = $args{'Content'};
+            $args{'Content'} = '';
+            $args{'ContentType'} ||= 'text/plain';
+        }
     }
 
     ( $args{'ContentEncoding'}, $args{'LargeContent'} ) =


More information about the Rt-commit mailing list