[Bps-public-commit] r16936 - sd/trunk/lib/App/SD/Replica/hm

ruz at bestpractical.com ruz at bestpractical.com
Wed Nov 19 15:54:15 EST 2008


Author: ruz
Date: Wed Nov 19 15:54:15 2008
New Revision: 16936

Modified:
   sd/trunk/lib/App/SD/Replica/hm/PushEncoder.pm

Log:
* handle situation when ticket has more then one requestor

Modified: sd/trunk/lib/App/SD/Replica/hm/PushEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/hm/PushEncoder.pm	(original)
+++ sd/trunk/lib/App/SD/Replica/hm/PushEncoder.pm	Wed Nov 19 15:54:15 2008
@@ -163,6 +163,23 @@
 
 sub _recode_props_for_create {
     my $self = shift;
+    my $attr = $self->__recode_props_for_create( @_ );
+
+    if ( $attr->{'requestor_id'} ) {
+        require Email::Address;
+        my @addresses = Email::Address->parse( $attr->{'requestor_id'} );
+        if ( @addresses > 1 ) {
+            #XXX, TODO: HM supports only one requestor, but it would be cool
+            # to add comment or something like that
+            warn "A ticket has more than one requestor when HM supports only one";
+            $attr->{'requestor_id'} = $addresses[0]->format;
+        }
+    }
+    return $attr;
+}
+
+sub __recode_props_for_create {
+    my $self = shift;
     my $attr = $self->_recode_props_for_integrate(@_);
 
     my $source_props = $self->sync_source->props;



More information about the Bps-public-commit mailing list