[Rt-commit] rt branch, admin_ui, updated. f3d116f0d581c675c8e3d63ebe4467150a9f8f83

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Dec 16 00:00:50 EST 2009


The branch, admin_ui has been updated
       via  f3d116f0d581c675c8e3d63ebe4467150a9f8f83 (commit)
      from  8966abaf49cb475c00799ff3a51f785e690011d5 (commit)

Summary of changes:
 lib/RT/Action/CreateWorkflow.pm |   48 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100644 lib/RT/Action/CreateWorkflow.pm

- Log -----------------------------------------------------------------
commit f3d116f0d581c675c8e3d63ebe4467150a9f8f83
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Dec 16 12:49:50 2009 +0800

    add CreateWorkflow action

diff --git a/lib/RT/Action/CreateWorkflow.pm b/lib/RT/Action/CreateWorkflow.pm
new file mode 100644
index 0000000..eeaa1c2
--- /dev/null
+++ b/lib/RT/Action/CreateWorkflow.pm
@@ -0,0 +1,48 @@
+use strict;
+use warnings;
+
+package RT::Action::CreateWorkflow;
+use base qw/RT::Action Jifty::Action/;
+use RT::Workflow;
+
+__PACKAGE__->mk_accessors('name');
+
+sub arguments {
+    my $self = shift;
+    return { name => { } };
+}
+
+=head2 take_action
+
+=cut
+
+sub take_action {
+    my $self = shift;
+
+    my $name = $self->argument_value('name');
+    my $schema = RT::Workflow->new;
+    my ($status, $msg) = $schema->create( name => $name );
+
+    unless ($status) {
+        Jifty->log->error(
+            'failed to create workflow ' . $name . ': ' . $msg );
+        return;
+    }
+
+    $self->report_success;
+    return 1;
+}
+
+=head2 report_success
+
+=cut
+
+sub report_success {
+    my $self = shift;
+
+    # Your success message here
+    $self->result->message('Success');
+}
+
+1;
+

-----------------------------------------------------------------------


More information about the Rt-commit mailing list