1 # Copyright 1999-2000 Jesse Vincent <jesse@fsck.com>
2 # Released under the terms of the GNU Public License
3 # $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/ScripAction.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
7 RT::ScripAction - RT Action object
16 This module should never be called directly by client code. it's an internal module which
17 should only be accessed through exported APIs in other modules.
22 ok (require RT::TestHarness);
23 ok (require RT::ScripAction);
31 package RT::ScripAction;
38 $self->{'table'} = "ScripActions";
39 return ($self->SUPER::_Init(@_));
46 my %Cols = ( Name => 'read',
47 Description => 'read',
50 Creator => 'read/auto',
51 Created => 'read/auto',
52 LastUpdatedBy => 'read/auto',
53 LastUpdated => 'read/auto'
55 return($self->SUPER::_Accessible(@_, %Cols));
62 Takes a hash. Creates a new Action entry.
63 should be better documented.
68 #TODO check these args and do smart things.
69 return($self->SUPER::Create(@_));
77 return (0, "ScripAction->Delete not implemented");
84 my $identifier = shift;
87 return (0, 'Input error');
90 if ($identifier !~ /\D/) {
91 $self->SUPER::LoadById($identifier);
94 $self->LoadByCol('Name', $identifier);
99 # Set the template Id to the passed in template
100 my $template = shift;
102 $self->{'Template'} = $template;
104 return ($self->Id, 'ScripAction loaded');
110 =head2 LoadAction HASH
112 Takes a hash consisting of TicketObj and TransactionObj. Loads an RT::Action:: module.
118 my %args = ( TransactionObj => undef,
122 #TODO: Put this in an eval
123 $self->ExecModule =~ /^(\w+)$/;
125 my $type = "RT::Action::". $module;
127 $RT::Logger->debug("now requiring $type\n");
128 eval "require $type" || die "Require of $type failed.\n$@\n";
130 $self->{'Action'} = $type->new ( 'ScripActionObj' => $self,
131 'TicketObj' => $args{'TicketObj'},
132 'TransactionObj' => $args{'TransactionObj'},
133 'TemplateObj' => $self->TemplateObj,
134 'Argument' => $self->Argument,
139 # {{{ sub TemplateObj
143 Return this action\'s template object
149 return undef unless $self->{Template};
150 if (!$self->{'TemplateObj'}) {
151 require RT::Template;
152 $self->{'TemplateObj'} = RT::Template->new($self->CurrentUser);
153 $self->{'TemplateObj'}->LoadById($self->{'Template'});
157 return ($self->{'TemplateObj'});
161 # The following methods call the action object
167 return ($self->{'Action'}->Prepare());
175 return($self->{'Action'}->Commit());
184 return ($self->{'Action'}->Describe());
192 $self->{'Action'} = undef;
193 $self->{'TemplateObj'} = undef;