[Rt-commit] rt branch, 4.0/avoid-updating-truncated-values, created. rt-4.0.10-5-gd4c8682

Thomas Sibley trs at bestpractical.com
Thu Jan 31 14:48:00 EST 2013


The branch, 4.0/avoid-updating-truncated-values has been created
        at  d4c8682d31dec03e0d1a542323a50956f17f8cb5 (commit)

- Log -----------------------------------------------------------------
commit d4c8682d31dec03e0d1a542323a50956f17f8cb5
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jan 31 11:40:16 2013 -0800

    Account for field truncation when comparing new values to current values
    
    Without comparing truncated values, a field which is truncated will
    always be updated, only to be set to the same value as previously.  This
    can occur particularly often when values are pulled from an external
    source via RT::Authen::ExternalAuth or RT::Extension::LDAPImport.

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 0310475..6f28120 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -892,6 +892,8 @@ sub Update {
 
         $value =~ s/\r\n/\n/gs;
 
+        my $truncated_value = $self->TruncateValue($attribute, $value);
+
         # If Queue is 'General', we want to resolve the queue name for
         # the object.
 
@@ -910,8 +912,8 @@ sub Update {
             my $current = $self->$attribute();
             # RT::Queue->Lifecycle returns a Lifecycle object instead of name
             $current = eval { $current->Name } if ref $current;
-            next if $value eq $current;
-            next if ( $value || 0 ) eq $current;
+            next if $truncated_value eq $current;
+            next if ( $truncated_value || 0 ) eq $current;
         };
 
         $new_values{$attribute} = $value;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list