Unlock Tickets with Perl API

English! place to talk about development, programming and coding
Post Reply
grisuu
Znuny newbie
Posts: 15
Joined: 29 Jun 2011, 20:36
Znuny Version: 3.0

Unlock Tickets with Perl API

Post by grisuu »

Hey,
I want to unlock a series of locked tickets. So I wrote a perl script which uses these small code snippets as shown in the otrs api doc.
In detail I am using Kernel::System::Ticket. I've created all the necessary objects and used the method “TicketLockSet”. So far the script works and all the specified tickets become unlocked. But in the end of the execution I get the following error:

(in cleanup) Can't call method "Get" on an undefined value at /opt/otrs-3.0.9/Kernel/System/EventHandler.pm line 195 during global destruction.

I'm not an experienced perl developer so maybe someone could give me a hint?

Thanks
OTRS 3.0.10 (produktiv)
MichaelR
Znuny expert
Posts: 250
Joined: 12 Oct 2010, 01:35
Znuny Version: 3.0.9
Company: LRS Health

Re: Unlock Tickets with Perl API

Post by MichaelR »

Have you created an EventHandler object at the start of the script?
OTRS: 3.0.9 & ITSM 3.0.4 - OS: Windows 7 - DB: MySQL - Heaps of random/useful hacks :)
[Major Code Changes]
ArticleFreeTime1-3
Ability to search ArticleFreeText
grisuu
Znuny newbie
Posts: 15
Joined: 29 Jun 2011, 20:36
Znuny Version: 3.0

Re: Unlock Tickets with Perl API

Post by grisuu »

MichaelR wrote:Have you created an EventHandler object at the start of the script?
No, I haven't created it. How do I have to integrate the object?
OTRS 3.0.10 (produktiv)
MichaelR
Znuny expert
Posts: 250
Joined: 12 Oct 2010, 01:35
Znuny Version: 3.0.9
Company: LRS Health

Re: Unlock Tickets with Perl API

Post by MichaelR »

From what I can see you need to call EventHandlerInit and pass in the required variables. I don't think you are passing the appropriate vars.
If you post your code (or the section causing the error) I will be able to help you further.
OTRS: 3.0.9 & ITSM 3.0.4 - OS: Windows 7 - DB: MySQL - Heaps of random/useful hacks :)
[Major Code Changes]
ArticleFreeTime1-3
Ability to search ArticleFreeText
grisuu
Znuny newbie
Posts: 15
Joined: 29 Jun 2011, 20:36
Znuny Version: 3.0

Re: Unlock Tickets with Perl API

Post by grisuu »

MichaelR wrote:From what I can see you need to call EventHandlerInit and pass in the required variables. I don't think you are passing the appropriate vars.
If you post your code (or the section causing the error) I will be able to help you further.
Ok, thanks for the support. I've already solved the problem. It wasn't necessary to create an new EventHandler-Object because the TicketObject already creates it internally. So what I did:

$TicketObject->TicketLockSet(..) and $TicketObject->EventHandler( Event => 'TicketLockUpdate'...) for all those tickets.

At the end of the script I call $TicketObject->EventHandlerTransaction();

and the problem is gone..

Thank you for your hints!
OTRS 3.0.10 (produktiv)
Post Reply