[Rt-commit] [svn] r1204 - in rt/branches/rt-3.1: . lib/RT

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Mon Jul 12 13:13:36 EDT 2004


Author: jesse
Date: Mon Jul 12 13:13:35 2004
New Revision: 1204

Modified:
   rt/branches/rt-3.1/   (props changed)
   rt/branches/rt-3.1/lib/RT/Record.pm
   rt/branches/rt-3.1/lib/RT/Ticket_Overlay.pm
Log:
 ----------------------------------------------------------------------
 r2127 at tinbook:  jesse | 2004-07-12T17:10:45.849934Z
 
 Backing out change that altered the "Queue" method on Tickets. Updating Record::Update to be smarter about altering foriegn key rows
 ----------------------------------------------------------------------


Modified: rt/branches/rt-3.1/lib/RT/Record.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Record.pm	(original)
+++ rt/branches/rt-3.1/lib/RT/Record.pm	Mon Jul 12 13:13:35 2004
@@ -721,8 +721,8 @@
     my $self = shift;
 
     my %args = (
-        ARGSRef       => undef,
-        AttributesRef => undef,
+        ARGSRef         => undef,
+        AttributesRef   => undef,
         AttributePrefix => undef,
         @_
     );
@@ -737,26 +737,44 @@
             $value = $ARGSRef->{$attribute};
         }
         elsif (
-              defined( $args{'AttributePrefix'} )
-              && defined(
-                  $ARGSRef->{ $args{'AttributePrefix'} . "-" . $attribute }
-              )
-          ) {
+            defined( $args{'AttributePrefix'} )
+            && defined(
+                $ARGSRef->{ $args{'AttributePrefix'} . "-" . $attribute }
+            )
+          )
+        {
             $value = $ARGSRef->{ $args{'AttributePrefix'} . "-" . $attribute };
 
-        } else {
-                next;
         }
+        else {
+            $RT::Logger->warning(
+                "$self asked to update an unknown attribute: $attribute");
+            next;
+        }
+
+        $value =~ s/\r\n/\n/gs;
 
-            $value =~ s/\r\n/\n/gs;
 
-        if ($value ne $self->$attribute()){
+        # If Queue is 'General', we want to resolve the queue name for
+        # the object.
 
-              my $method = "Set$attribute";
-              my ( $code, $msg ) = $self->$method($value);
+        # This is in an eval block because $object might not exist.
+        # and might not have a Name method. But "can" won't find autoloaded
+        # items. If it fails, we don't care
+        eval {
+            my $object = $attribute . "Obj";
+            next if ($self->$object->Name eq $value);
+        };
+        next if ( $value eq $self->$attribute() );
+        my $method = "Set$attribute";
+        my ( $code, $msg ) = $self->$method($value);
+
+        my ($prefix) = ref($self) =~ /RT::(\w+)/;
+        push @results,
+          $self->loc( "$prefix [_1]", $self->id ) . ': '
+          . $self->loc($attribute) . ': '
+          . $self->CurrentUser->loc_fuzzy($msg);
 
-	      my($prefix) = ref($self) =~ /RT::(\w+)/;
-	      push @results,  $self->loc("$prefix [_1]", $self->id) . ': ' . $self->loc($attribute) . ': ' . $self->CurrentUser->loc_fuzzy($msg);
 =for loc
                                    "[_1] could not be set to [_2].",       # loc
                                    "That is already the current value",    # loc
@@ -771,7 +789,6 @@
                                    "Missing a primary key?: [_1]",         # loc
                                    "Found Object",                         # loc
 =cut
-          };
 
     }
 

Modified: rt/branches/rt-3.1/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/rt-3.1/lib/RT/Ticket_Overlay.pm	Mon Jul 12 13:13:35 2004
@@ -2128,18 +2128,6 @@
     return ($queue_obj);
 }
 
-=head2 Queue
-
-Returns the name of this ticket's queue, rather than its id.
-
-=cut
-
-sub Queue { 
-    my $self = shift;
-    return $self->QueueObj->Name;
-}
-
-
 # }}}
 
 # }}}


More information about the Rt-commit mailing list