[Bps-public-commit] r11458 - in SVN-PropDB: .

jesse at bestpractical.com jesse at bestpractical.com
Thu Apr 3 21:05:08 EDT 2008


Author: jesse
Date: Thu Apr  3 21:05:08 2008
New Revision: 11458

Modified:
   SVN-PropDB/   (props changed)
   SVN-PropDB/lib/Prophet/Sync/Source/RT.pm

Log:
 r29115 at 70-5-183-240:  jesse | 2008-04-03 15:01:05 -1000
  handle onwner txns 


Modified: SVN-PropDB/lib/Prophet/Sync/Source/RT.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Sync/Source/RT.pm	(original)
+++ SVN-PropDB/lib/Prophet/Sync/Source/RT.pm	Thu Apr  3 21:05:08 2008
@@ -114,7 +114,6 @@
 
     my $ticket = $args{'ticket'};
 
-    $ticket->{'uuid'} = "NEED A UUID HERE";
 
     my $create_state = $ticket;
     map { $create_state->{$_} =~ s/ minutes$// }  qw(TimeWorked TimeLeft TimeEstimated);
@@ -136,6 +135,7 @@
         }
         else {
             warn "not handling txn type $txn->{Type} for $txn->{id} (Ticket $args{ticket}{id}) yet";
+            die YAML::Dump($txn);
         }
 
     }
@@ -182,6 +182,10 @@
                 $args{txn}->{NewValue} = $current_queue;
             }
 
+        } elsif ( $args{txn}->{Field} eq 'Owner') {
+                $args{'txn'}->{NewValue} = $self->resolve_user_id_to(name => $args{'txn'}->{'NewValue'} ),
+                $args{'txn'}->{OldValue} = $self->resolve_user_id_to(name => $args{'txn'}->{'OldValue'} )
+                
         }
 
 
@@ -200,7 +204,9 @@
 
         }
 
-
+*_recode_txn_Steal = \&_recode_txn_Set;
+*_recode_txn_Take = \&_recode_txn_Set;
+*_recode_txn_Give = \&_recode_txn_Set;
 
         
 sub _recode_txn_Create {
@@ -270,8 +276,8 @@
             $args{'create_state'}->{ $args{'txn'}->{'Field'} } = $self->warp_list_to_old_value(
                 $args{'create_state'}->{ $args{'txn'}->{'Field'} },
 
-                $self->resolve_user_id_to_email( $args{'txn'}->{'NewValue'} ),
-                $self->resolve_user_id_to_email( $args{'txn'}->{'OldValue'} )
+                $self->resolve_user_id_to( email => $args{'txn'}->{'NewValue'} ),
+                $self->resolve_user_id_to( email => $args{'txn'}->{'OldValue'} )
 
             );
 
@@ -327,17 +333,18 @@
                 new  => $new_state
             );
         }
-sub resolve_user_id_to_email {
+sub resolve_user_id_to {
     my $self  = shift;
+    my $attr = shift;
     my $id = shift;
     return undef unless ($id);
      
      my $user = RT::Client::REST::User->new(rt => $self->rt, id =>  $id)->retrieve;
-     return $user->email_address;
+     return  $attr eq 'name' ? $user->name : $user->email_address;
 
 }
 
-memoize 'resolve_user_id_to_email';
+memoize 'resolve_user_id_to';
 
 
 sub _find_matching_tickets {



More information about the Bps-public-commit mailing list