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

jesse at bestpractical.com jesse at bestpractical.com
Sun Mar 27 04:14:15 EST 2005


Author: jesse
Date: Sun Mar 27 04:14:15 2005
New Revision: 2522

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/lib/RT/CurrentUser.pm
   rt/branches/3.4-RELEASE/lib/RT/Record.pm
Log:
 r10231 at hualien:  jesse | 2005-03-27 17:12:44 +0800
 * More fixes for status messages broken in this morning's commit


Modified: rt/branches/3.4-RELEASE/lib/RT/CurrentUser.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/CurrentUser.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/CurrentUser.pm	Sun Mar 27 04:14:15 2005
@@ -400,7 +400,7 @@
 
 sub loc_fuzzy {
     my $self = shift;
-    return '' if $_[0] eq '';
+    return '' if (!$_[0] ||  $_[0] eq '');
 
     # XXX: work around perl's deficiency when matching utf8 data
     return $_[0] if Encode::is_utf8($_[0]);

Modified: rt/branches/3.4-RELEASE/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Record.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Record.pm	Sun Mar 27 04:14:15 2005
@@ -481,24 +481,25 @@
         Value => $args{'Value'},
         IsSQL => $args{'IsSQL'}
     );
+        my ($status, $msg) =  $ret->as_array();
+
+        # @values has two values, a status code and a message.
+
     # $ret is a Class::ReturnValue object. as such, in a boolean context, it's a bool
     # we want to change the standard "success" message
-    if ($ret) {
-        my @values = $ret->as_array;
-        # @values has two values, a status code and a message.
-        pop @values;
-        push @values,
+    if ($status) {
+        $msg =
           $self->loc(
             "[_1] changed from [_2] to [_3]",
             $args{'Field'},
             ( $old_val ? "'$old_val'" : $self->loc("(no value)") ),
-            '"' . $self->__Value( $args{'Field'} . '"' )
+            '"' . $self->__Value( $args{'Field'}) . '"' 
           );
+      } else {
 
-        $ret->as_array(@values);     
+          $msg = $self->CurrentUser->loc_fuzzy($msg);
     }
-
-    return ($ret);
+    return wantarray ? ($status, $msg) : $ret;     
 
 }
 
@@ -891,16 +892,12 @@
         next if ( $value eq $self->$attribute() );
         my $method = "Set$attribute";
         my ( $code, $msg ) = $self->$method($value);
-
         my ($prefix) = ref($self) =~ /RT::(\w+)/;
 
         # Default to $id, but use name if we can get it.
         my $label = $self->id;
         $label = $self->Name if (UNIVERSAL::can($self,'Name'));
-
-        push @results,
-          $self->loc( "$prefix [_1]", $label ) . ': '
-          . $self->CurrentUser->loc_fuzzy($msg);
+        push @results, $self->loc( "$prefix [_1]", $label ) . ': '. $msg;
 
 =for loc
                                    "[_1] could not be set to [_2].",       # loc


More information about the Rt-commit mailing list