Custom Ticket Event Handlers
Moderator: crythias
-
- Znuny newbie
- Posts: 67
- Joined: 22 May 2013, 11:35
- Znuny Version: 3.3.2
- Real Name: Philip Steeman
- Company: VIVES
Custom Ticket Event Handlers
I followed the following instructions:
viewtopic.php?f=60&t=10090
I've got this working in otrs version 3.2 when I do the following:
- make a xml-file in /opt/otrs/Kernel/Config/Files/
- make a pm-file in /opt/otrs/Kernel/System/Ticket/Event
But the same config doesn't seem to work in version 3.3.3
Philip
viewtopic.php?f=60&t=10090
I've got this working in otrs version 3.2 when I do the following:
- make a xml-file in /opt/otrs/Kernel/Config/Files/
- make a pm-file in /opt/otrs/Kernel/System/Ticket/Event
But the same config doesn't seem to work in version 3.3.3
Philip
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Custom Ticket Event Handlers
Not enough information to diagnose.steeman wrote:But the same config doesn't seem to work in version 3.3.3
Errors? Problems? Notifications?
What is it doing? What is it not doing? "Not working" isn't enough to troubleshoot.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
-
- Znuny newbie
- Posts: 67
- Joined: 22 May 2013, 11:35
- Znuny Version: 3.3.2
- Real Name: Philip Steeman
- Company: VIVES
Re: Custom Ticket Event Handlers
I've made a file Philip.xml in directory /opt/otrs/Kernel/Config/Files with the following content:
http://users.khbo.be/steeman/otrs/Philip.xml
There I call a perl-module Philip.pm in directory /opt/otrs/Kernel/Ticket/Event with the following content
http://users.khbo.be/steeman/otrs/Philip.pm
I use the following code to see ,if otrs get's there when I create a new ticket
sub new {
my ( $Type, %Param ) = @_;
open (f, ">/tmp/philip1.log");
print f "I'm in new\n";
close (f);
...
But that file isn't created.
There is also no info in log.
In version 3.2.? I've got this working without a problem. There is always a possibility that I made an error, but I think there is something changed since version 3.3.
If I'm correct I even think I tested it in version 3.2.12 and after a upgrade to 3.3.3 the same files didn't work anymore?
Philip
Philip
http://users.khbo.be/steeman/otrs/Philip.xml
There I call a perl-module Philip.pm in directory /opt/otrs/Kernel/Ticket/Event with the following content
http://users.khbo.be/steeman/otrs/Philip.pm
I use the following code to see ,if otrs get's there when I create a new ticket
sub new {
my ( $Type, %Param ) = @_;
open (f, ">/tmp/philip1.log");
print f "I'm in new\n";
close (f);
...
But that file isn't created.
There is also no info in log.
In version 3.2.? I've got this working without a problem. There is always a possibility that I made an error, but I think there is something changed since version 3.3.
If I'm correct I even think I tested it in version 3.2.12 and after a upgrade to 3.3.3 the same files didn't work anymore?
Philip
Philip
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Custom Ticket Event Handlers
First, you probably only need to set the event (.xml) for those events you're actively reacting to.
Next, Kernel/System/Event.pm is new in 3.3 vs 3.2
You may want to perldoc Event.pm for more information
Check Kernel/System/Ticket/Event/Test.pm for a sample
Below is a snippet of "working" ConfigItem from Ticket.xml
Things to check:
Item is enabled/checked in SysConfig
.xml is readable by system.
ZZZAuto.pm or ZZZAAuto.pm has reference to your Event. (try rebuildConfig)
Use the logging system instead of your own files.
Next, Kernel/System/Event.pm is new in 3.3 vs 3.2
You may want to perldoc Event.pm for more information
Check Kernel/System/Ticket/Event/Test.pm for a sample
Below is a snippet of "working" ConfigItem from Ticket.xml
Code: Select all
<ConfigItem Name="Ticket::EventModulePost###110-AcceleratorUpdate" Required="0" Valid="1">
<Description Translatable="1">Updates the ticket index accelerator.</Description>
<Group>Ticket</Group>
<SubGroup>Core::Ticket</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::System::Ticket::Event::TicketAcceleratorUpdate</Item>
<Item Key="Event">TicketStateUpdate|TicketQueueUpdate|TicketLockUpdate</Item>
</Hash>
</Setting>
</ConfigItem>
Item is enabled/checked in SysConfig
.xml is readable by system.
ZZZAuto.pm or ZZZAAuto.pm has reference to your Event. (try rebuildConfig)
Use the logging system instead of your own files.
Code: Select all
$Self->{LogObject}->Log( Priority => 'info', Message => "I reached this point in my code" );
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Custom Ticket Event Handlers
You shouldn't open a file for your own in OTRS. The MainObject has a FileWrite method. If you do it yourself, you should check for errorssteeman wrote: sub new {
my ( $Type, %Param ) = @_;
open (f, ">/tmp/philip1.log");
print f "I'm in new\n";
close (f);
...
Code: Select all
sub new {
my ( $Type, %Param ) = @_;
open (f, ">/tmp/philip1.log") or die $!;
print f "I'm in new\n";
close (f);
...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny newbie
- Posts: 67
- Joined: 22 May 2013, 11:35
- Znuny Version: 3.3.2
- Real Name: Philip Steeman
- Company: VIVES
Re: Custom Ticket Event Handlers
...
Things to check:
Item is enabled/checked in SysConfig
What do you mean by this?
Philip
Things to check:
Item is enabled/checked in SysConfig
What do you mean by this?
Philip
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Custom Ticket Event Handlers
I'm not sure how to answer your question.steeman wrote:Item is enabled/checked in SysConfig
What do you mean by this?
Search SysConfig for the .xml entry you've created.
Make sure the checkbox on the left is checked, therefore enabling your entry.
Unless you had the .xml as required, it's probably not enabled.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
-
- Znuny newbie
- Posts: 67
- Joined: 22 May 2013, 11:35
- Znuny Version: 3.3.2
- Real Name: Philip Steeman
- Company: VIVES
Re: Custom Ticket Event Handlers
Everything seems to work now with the following xml-file (all the rest was OK):
Thanks for your help
Philip
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Changes">
<ConfigItem Name="Ticket::EventModulePost###Test" Required="0" Valid="1">
<Description Translatable="1">test</Description>
<Group>Ticket</Group>
<SubGroup>Core::Ticket</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::System::Ticket::Event::Philip</Item>
<Item Key="Event">ArticleCreate|TicketCreate</Item>
</Hash>
</Setting>
</ConfigItem>
</otrs_config>
Philip
Last edited by crythias on 24 Dec 2013, 15:04, edited 1 time in total.
Reason: [code] tags
Reason: [code] tags