[Bps-public-commit] r14709 - in sd: trunk/lib/App/SD/CLI/Command/Ticket

spang at bestpractical.com spang at bestpractical.com
Fri Aug 1 11:15:20 EDT 2008


Author: spang
Date: Fri Aug  1 11:15:18 2008
New Revision: 14709

Modified:
   sd/   (props changed)
   sd/trunk/lib/App/SD/CLI/Command/Ticket/Create.pm

Log:
 r47501 at loki:  spang | 2008-08-01 16:13:24 +0100
 invoke comment creation command directly when creating a ticket with a comment


Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Create.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Create.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Create.pm	Fri Aug  1 11:15:18 2008
@@ -1,6 +1,8 @@
 package App::SD::CLI::Command::Ticket::Create;
 use Moose;
 
+use App::SD::CLI::Command::Ticket::Comment::Create qw(new);
+
 extends 'Prophet::CLI::Command::Create';
 with 'App::SD::CLI::Model::Ticket';
 with 'App::SD::CLI::Command';
@@ -32,10 +34,11 @@
 
         my $footer = comment_separator();
 
-        my $ticket = $self->get_content(type => 'ticket', default_edit => 1,
-                                        prefill_props => \%prefill_props,
-                                        props_order => \@props,
-                                        footer => $footer);
+        my $ticket = $self->get_content( type => 'ticket', default_edit => 1,
+                                         prefill_props => \%prefill_props,
+                                         props_order => \@props,
+                                         footer => $footer,
+                                       );
 
         die "Aborted.\n"
             if length($ticket) == 0;
@@ -53,14 +56,15 @@
         $record = $self->record();
 
         if ($comment) {
-            my $props = [ {prop => 'content', cmp => '=', value => $comment} ];
-            my $args = { uuid => $record->uuid() };
-            my $primary_commands = [ qw/ticket comment create/ ];
-            $self->cli->run_another_command( type => 'comment',
-                                             props => $props,
-                                             args => $args,
-                                             primary_commands => $primary_commands,
-                                            );
+            my $args = { uuid => $record->uuid(),
+                         content => $comment,
+                       };
+            $self->cli->change_attributes( args => $args );
+            my $command = App::SD::CLI::Command::Ticket::Comment::Create->new(
+                cli => $self->cli,
+                type => 'comment',
+            );
+            $command->run();
         }
     } else {
         super();



More information about the Bps-public-commit mailing list