[rt-users] Write a Custom Action in rt4 as a Module/package ERROR

Red Pantyhose redpantyhose at yahoo.com
Fri Oct 26 09:40:04 EDT 2012


Dear Christian

Thank you I applied some changes and I get still an error:

Oct 26 13:56:15 rt RT: Scrip Prepare 14 died. - Can't locate object method "new" via package "RT::Action::OpenSystemCustomFields" at /usr/share/request-tracker4/lib/RT/ScripAction.pm line 175.#012#012Stack:#012  [/usr/share/request-tracker4/lib/RT/ScripAction.pm:175]#012  [/usr/share/request-tracker4/lib/RT/Scrip.pm:443]#012  [/usr/share/request-tracker4/lib/RT/Scrips.pm:252]#012  [/usr/share/request-tracker4/lib/RT/Transaction.pm:179]#012  [/usr/share/request-tracker4/lib/RT/Record.pm:1459]#012  [/usr/share/request-tracker4/lib/RT/Ticket.pm:676]#012  [/usr/share/request-tracker4/lib/RT/Interface/Web.pm:1711]#012  [/usr/share/request-tracker4/html/Ticket/Display.html:128]#012  [/usr/share/request-tracker4/html/Ticket/Create.html:444]#012  [/usr/share/request-tracker4/html/Ticket/autohandler:19]#012  [/usr/share/request-tracker4/lib/RT/Interface/Web.pm:568]#012  [/usr/share/request-tracker4/lib/RT/Interface/Web.pm:318]#012 
 [/usr/share/request-tracker4/html/autohandler:53] (/usr/share/request-tracker4/lib/RT/Scrip.pm:451)

What am I doing wrong ? 

Do I really need a  sub new() ???

Thanks sincerely,

Denis


#-----------------------------OpenSystemCustomFields---------------------#

package RT::Action::OpenSystemCustomFields;

use strict;
use warnings;
use base qw(RT::Action);
our $VERSION = '0.01';

sub Describe {
    my $self = shift;
    my $class = ref($self) || $self;
    return "$class will retrive values from the OS database and create dynamic CustomFields.";
}

sub Prepare {
  my $self = shift;
  my $class = ref($self) || $self;
  return 1;
}

sub Commit {
  my $self = shift;
  my $class = ref($self) || $self;
  return 1;
}

RT::Base->_ImportOverlays();

# ;)
1;







________________________________
 From: Christian Loos <cloos at netcologne.de>
To: Red Pantyhose <redpantyhose at yahoo.com> 
Cc: "rt-users at lists.bestpractical.com" <rt-users at lists.bestpractical.com> 
Sent: Friday, October 26, 2012 3:17 PM
Subject: Re: Write a Custom Action in rt4 as a Module/package ERROR
 
uncomment this line:
#use base qw(RT::Action);

Chris

Am 26.10.2012 15:02, schrieb Red Pantyhose:
> Dear rt-users
> 
> I created the following ActionScrip Module below -  the Module is
> registered.
> 
> But i get the following Error:
> 
> Oct 26 14:42:49 rt RT: Scrip Prepare 14 died. - Can't locate object
> method "new" via package "RT::Action::OpenSystemCustomFields" at
> /usr/share/request-tracker4/lib/RT/ScripAction.pm line
> 175.#012#012Stack:#012 
> [/usr/share/request-tracker4/lib/RT/ScripAction.pm:175]#012 
> [/usr/share/request-tracker4/lib/RT/Scrip.pm:443]#012 
> [/usr/share/request-tracker4/lib/RT/Scrips.pm:252]#012 
> [/usr/share/request-tracker4/lib/RT/Transaction.pm:179]#012 
> [/usr/share/request-tracker4/lib/RT/Record.pm:1459]#012 
> [/usr/share/request-tracker4/lib/RT/Ticket.pm:676]#012 
> [/usr/share/request-tracker4/lib/RT/Interface/Web.pm:1711]#012 
> [/usr/share/request-tracker4/html/Ticket/Display.html:128]#012 
> [/usr/share/request-tracker4/html/Ticket/Create.html:444]#012 
> [/usr/share/request-tracker4/html/Ticket/autohandler:19]#012 
> [/usr/share/request-tracker4/lib/RT/Interface/Web.pm:568]#012 
> [/usr/share/request-tracker4/lib/RT/Interface/Web.pm:318]#012 
> [/usr/share/request-tracker4/html/autohandler:53]
> (/usr/share/request-tracker4/lib/RT/Scrip.pm:451)
> 
> I'm using rt-4.0.5.
> 
> What am I doing wrong ?
> 
> Thanks Sincerely
> 
> Denis
> 
> 
> #-------------------------------------OpenSystemCustomFields.init-------------------------------------------#
> 
> # To initialize the OpenSystemCustomFields ActionScrip:
> # rt-setup-database-4 --action insert --datafile OpenSystemCustomFields.init
> 
> @ScripActions = (
> {
>    Name        => 'OpenSystemCustomFields',
>    Description => 'Create CustomFields from data retrieved out of the
> OpenSystem DB',
>    ExecModule  => 'OpenSystemCustomFields',
>    Argument    => ''
>  },
> );
> 
> 
> 
> 
> #-------------------------------------OpenSystemCustomFields.pm-------------------------------------------#
> use strict;
> use warnings;
> 
> package RT::Action::OpenSystemCustomFields;
> 
> #use base qw(RT::Action);
> 
> #use base qw(RT::Action::Generic);
> 
> sub Prepare {
>   my $self = shift;
>   return 1;
> }
> 
> sub Commit {
>   my $self = shift;
>   return 1;
> }
> 
> # ;)
> 1;
> 
> 
> 
> 
> 
> 
> 
> --------
> We're hiring! http://bestpractical.com/jobs
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20121026/b6d93f3f/attachment.html>


More information about the rt-users mailing list