[Bps-public-commit] r17503 - in Net-Trac/trunk: .

trs at bestpractical.com trs at bestpractical.com
Wed Dec 31 18:06:35 EST 2008


Author: trs
Date: Wed Dec 31 18:06:35 2008
New Revision: 17503

Modified:
   Net-Trac/trunk/   (props changed)
   Net-Trac/trunk/lib/Net/Trac/Ticket.pm

Log:
 r43369 at zot:  tom | 2008-12-31 18:04:57 -0500
 auto set some statuses if it seems to make sense for default workflows


Modified: Net-Trac/trunk/lib/Net/Trac/Ticket.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/Ticket.pm	(original)
+++ Net-Trac/trunk/lib/Net/Trac/Ticket.pm	Wed Dec 31 18:06:35 2008
@@ -151,16 +151,34 @@
     my %args = validate(
         @_,
         {
-            comment  => 0,
+            comment         => 0,
+            no_auto_status  => { default => 0 },
             map { $_ => 0 } $self->valid_props
         }
     );
 
-#    if ( $update 
+    # Automatically set the status for default trac workflows unless
+    # we're asked not to
+    unless ( $args{'no_auto_status'} ) {
+        $args{'status'} = 'closed'
+            if $args{'resolution'} and not $args{'status'};
+        
+        $args{'status'} = 'assigned'
+            if $args{'owner'} and not $args{'status'};
+        
+        $args{'status'} = 'accepted'
+            if $args{'owner'} eq $self->connection->user
+               and not $args{'status'};
+    }
 
     my ($form,$form_num)= $self->_get_update_ticket_form();
 
-    my %form = map { ($_ eq 'comment' ? $_ : 'field_' . $_) => $args{$_} } keys %args;
+    # Copy over the values we'll be using
+    my %form = map  { "field_".$_ => $args{$_} }
+               grep { !/comment|no_auto_status/ } keys %args;
+
+    # Copy over comment too -- it's a pseudo-prop
+    $form{'comment'} = $args{'comment'};
 
     $self->connection->mech->submit_form(
         form_number => $form_num,



More information about the Bps-public-commit mailing list