Access config option from custom module [SOLVED]

Moderator: crythias

Post Reply
pawel
Znuny newbie
Posts: 3
Joined: 02 Oct 2015, 18:04
Znuny Version: 4.0.10
Real Name: Paweł Kalicki
Company: Remote Service Desk

Access config option from custom module [SOLVED]

Post by pawel »

I'm writing some custom notification module. I've created xml to add some parameters to SysConfig and created custom module in Kernel/System/Ticket/Event. So far everything works fine, but I'd like to set some variables directly from sysconfig.
In documentation I've found function:

Code: Select all

my $ConfigOption = $Kernel::OM->Get('Kernel::Config')->Get('Prefix::Option');
And it works fine for some variables in ZZZAuto.pm like:
$Self->{'PostMasterMaxEmailSize'} = '40960';

Code: Select all

my $ConfigOption = $Kernel::OM->Get('Kernel::Config')->Get('PostMasterMaxEmailSize')
returns correct value.
How can I get "Channel" and "Token" values if configuration in ZZZAuto.pm looks like this:

Code: Select all

$Self->{'Ticket::EventModulePost'}->{'TestNotify'} =  {
  'Channel' => '111111111',
  'Event' => '(TicketCreate|TicketLockUpdate|ArticleAgentNotification)',
  'Module' => 'Kernel::System::Ticket::Event::TestNotify',
  'Token' => '123qwerty'
};
Last edited by pawel on 07 Oct 2015, 16:25, edited 1 time in total.
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Access config option from custom module

Post by eandrex »

Try

Code: Select all

my $ConfigOption = $Kernel::OM->Get('Kernel::Config')->Get(Ticket::EventModulePost')->{'TestNotify'}->{'Channel'};
But if you want to get those values from the module itself(in this case 'Kernel::System::Ticket::Event::TestNotify') I think those are passed as arguments in the Run method
i would try this

Code: Select all

my $ConfigChannelOption = $Param{Config}->{Channel};
pawel
Znuny newbie
Posts: 3
Joined: 02 Oct 2015, 18:04
Znuny Version: 4.0.10
Real Name: Paweł Kalicki
Company: Remote Service Desk

Re: Access config option from custom module

Post by pawel »

Thank you,
eandrex wrote:

Code: Select all

my $ConfigOption = $Kernel::OM->Get('Kernel::Config')->Get(Ticket::EventModulePost')->{'TestNotify'}->{'Channel'};
solves my problem.
Post Reply