Access to OldTicketData in Event

English! place to talk about development, programming and coding
Post Reply
vkandersv
Znuny newbie
Posts: 36
Joined: 07 Mar 2011, 18:32
Znuny Version: 3.0.6

Access to OldTicketData in Event

Post by vkandersv »

Hi,

Im trying to write a custom Ticket Event module, that is going to create a child ticket when some specific criteria is met; I have some way to the goal yet.

Thanks to a short tutorial here (viewtopic.php?f=60&t=10090&p=39314&hili ... ial#p39314) I managed to get started.

Right now im stuck when trying to access OldTicketData - that is the previous state of the ticket, as far as I can figure out it should be possible, since its done in the TriggerEscalationStopEvents.pm-module thats in the source code. But I cant manage to do it; fails on the first check if OldTicketData exists.

Any clues ? :-)

for my $Needed (qw(TicketID OldTicketData)) {
if ( !$Param{Data}->{$Needed} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need $Needed in Data!" );
# return;
}
}

if ($Param{Event} eq 'TicketStateUpdate') {
# do some stuff

$Self->{LogObject}->Log( Message => $Param{Data}->{OldTicketData}->{State});
$Self->{LogObject}->Log( $Ticket{State});

$Self->{TicketObject}->HistoryAdd(
TicketID => $Param{TicketID},
CreateUserID => 1,
HistoryType => 'Misc',
Name => 'Ticket State Update',
);
};
--
ORTS 3.0.6, Linux, MySQL, ActiveDirectory integration for Customer.
reneeb
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: Access to OldTicketData in Event

Post by reneeb »

The TriggerEscalationStopEvent.pm seems to be an exception. Nearly all events do not pass old values (that's really bad)...
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
Post Reply