+=cut
+
+sub TemplateObj {
+ my $self = shift;
+ return undef unless $self->{Template};
+ if ( !$self->{'TemplateObj'} ) {
+ $self->{'TemplateObj'} = RT::Template->new( $self->CurrentUser );
+ $self->{'TemplateObj'}->LoadById( $self->{'Template'} );
+
+ if ( ( $self->{'TemplateObj'}->__Value('Queue') == 0 )
+ && $self->{'_TicketObj'} ) {
+ my $tmptemplate = RT::Template->new( $self->CurrentUser );
+ my ( $ok, $err ) = $tmptemplate->LoadQueueTemplate(
+ Queue => $self->{'_TicketObj'}->QueueObj->id,
+ Name => $self->{'TemplateObj'}->Name);
+
+ if ( $tmptemplate->id ) {
+ # found the queue-specific template with the same name
+ $self->{'TemplateObj'} = $tmptemplate;
+ }
+ }
+
+ }
+
+ return ( $self->{'TemplateObj'} );
+}
+
+# The following methods call the action object
+
+
+sub Prepare {
+ my $self = shift;
+ $self->{_Message_ID} = 0;
+ return ($self->Action->Prepare());
+
+}
+
+sub Commit {
+ my $self = shift;
+ return($self->Action->Commit());
+
+
+}
+
+sub Describe {
+ my $self = shift;
+ return ($self->Action->Describe());
+
+}
+
+=head2 Action
+
+Return the actual RT::Action object for this scrip.
+
+=cut
+
+sub Action {
+ my $self = shift;
+ return ($self->{'Action'});
+}
+
+sub DESTROY {
+ my $self=shift;
+ $self->{'_TicketObj'} = undef;
+ $self->{'Action'} = undef;
+ $self->{'TemplateObj'} = undef;