Execute Custom Module - error "Module not found/could not be loaded"
Moderator: crythias
Execute Custom Module - error "Module not found/could not be loaded"
Hello!
I create new job in GenericAgent. Created file in /Custom/SendmailChief.pm. For the "Execute Custom Module" to "Custom::SendmailChief" value. After the getting the error "Module Custom/SendmailChief.pm not found/could not be loaded"
I create new job in GenericAgent. Created file in /Custom/SendmailChief.pm. For the "Execute Custom Module" to "Custom::SendmailChief" value. After the getting the error "Module Custom/SendmailChief.pm not found/could not be loaded"
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Execute Custom Module - error "Module not found/could not be loaded"
Did you declare the package name in the .pm?
Like so:
Did you register it for OTRS in a .xml file?
Like so:
Code: Select all
package SendmailChief;
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Execute Custom Module - error "Module not found/could not be loaded"
I declare the package name as
In which .xml file need to register module?
Code: Select all
package Custom::SendmailChief;
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Execute Custom Module - error "Module not found/could not be loaded"
Try without the "Custom::".
You can use any xml file, but best is to create a custom one, like so:
to register a module write into the file:
(though this might only be needed for frontend modules, I'm not entirely sure)
You can use any xml file, but best is to create a custom one, like so:
Code: Select all
vi ~otrs/Kernel/Config/Files/Some-Custom-Name.xml
(though this might only be needed for frontend modules, I'm not entirely sure)
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<otrs_config version="1.0" init="Application">
<ConfigItem Name="Frontend::Module###SendmailChief" Required="0" Valid="1">
<Description Translatable="1">Frontend module registration for the agent interface.</Description>
<Group>Framework</Group>
<SubGroup>Frontend::Agent::ModuleRegistration</SubGroup>
<Setting>
<Hash>
<Item Key="Module">SendmailChief</Item>
</Hash>
</Setting>
</ConfigItem>
</otrs_config>
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Execute Custom Module - error "Module not found/could not be loaded"
Thank you. I created file Some-Custom-Name.xml
This file needs to be registered in the system OTRS?
This file needs to be registered in the system OTRS?
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Execute Custom Module - error "Module not found/could not be loaded"
It does as soon as you rebuild the SysConfig. Simplest to do so is click on the link "SysConfig" in the Admin-Frontend.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Execute Custom Module - error "Module not found/could not be loaded"
I watched in "SysConfig" and found my module. But the error remained. Maybe the problem in package structure ?
Code: Select all
#!/usr/bin/perl -w
package SendmailChief;
use strict;
use warnings;
use lib "/opt/otrs";
use lib "/opt/otrs/Kernel/cpan-lib";
use lib "/opt/otrs/Custom";
use Kernel::System::Email;
my $ticketnumber = $ARGV[0];
my $ticketid = $ARGV[1];
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
# 0=off; 1=on;
$Self->{Debug} = $Param{Debug} || 0;
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
my $MailTo = 'chief@domain.com';
my $Message = 'Wait approved';
$Self->{SendmailObject}->Send(
From => 'OTRS1' . ' <'
. 'otrs1@domain.com' . '>',
To => $MailTo,
Subject => '[Ticket#'.$ticketnumber.'] wait approved',
MimeType => 'text/plain',
Charset => 'utf-8',
Body => $Message,
Loop => 1,
);
}
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Execute Custom Module - error "Module not found/could not be loaded"
Can you post the absolut path to the file? If it's really
then it's probably wrong. Do you mean it's "~otrs/Custom/SendmailChief.pm" ?
Code: Select all
/Custom/SendmailChief.pm
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Execute Custom Module - error "Module not found/could not be loaded"
I found an error in the packet structure. Fixed. The module was found!
Code: Select all
#!/usr/bin/perl -w
package SendmailChief;
use strict;
use warnings;
use lib "/opt/otrs";
use lib "/opt/otrs/Kernel/cpan-lib";
use lib "/opt/otrs/Custom";
use Kernel::System::Email;
my $ticketnumber = $ARGV[0];
my $ticketid = $ARGV[1];
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
# 0=off; 1=on;
$Self->{Debug} = $Param{Debug} || 0;
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
my $MailTo = 'chief@domain.com';
my $Message = 'Wait approved';
$Self->{SendmailObject}->Send(
From => 'OTRS1' . ' <'
. 'otrs1@domain.com' . '>',
To => $MailTo,
Subject => '[Ticket#'.$ticketnumber.'] wait approved',
MimeType => 'text/plain',
Charset => 'utf-8',
Body => $Message,
Loop => 1,
);
}
1;
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Execute Custom Module - error "Module not found/could not be loaded"
Oh, okay.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS