Missung Attachment in Article

English! place to talk about development, programming and coding
Post Reply
JoernWR
Znuny newbie
Posts: 18
Joined: 04 Mar 2011, 18:44
Znuny Version: 3.05

Missung Attachment in Article

Post by JoernWR »

Hi!

I want to create a cloned Ticket from special tickets (identified by a special service).
So I listen for the ArticleCreate event, which works just fine. But when an attachment was attached to an article, I dont get it! I just get the "file-2" attachement which contains the body of the article.
This is how I try:

Code: Select all

   	my @OldTicketID = ($HistoryLines[-1]{'Name'} =~ m/(\d+)/);
      	print DATEI "Alte TicketID $OldTicketID[0].\n";
      	my %OrgArticle = $Self->{TicketObject}->ArticleFirstArticle(
			        TicketID => $OldTicketID[0],
	);
    	
    	print DATEI "Ich will das Attachement aus Article mit ID $OrgArticle{ArticleID}.\n";
    	
    	my %AttIndex = $Self->{TicketObject}->ArticleAttachmentIndex(
	        ArticleID => $OrgArticle{ArticleID},
                UserID	  => 1,
    	);
    	my $size = scalar keys %AttIndex;
    	print DATEI "$size Elemente im Hash.\n";
    	
I simplified the example here, but even when I print out the content of the %AttIndex Hash, my attached pdf is always missing.
When I run the example outside the ArticleCreate event for any other articles which have an attachment, then everythings works fine.
So my suspect was, that in the moment, where the event is fired, the attachment is still not attached, but looking in Article.pm shows, that all attachments should already been processed before the event is fired.

Whats wrong here?

Cheers,
Joern
Produktiv OTRS::ITSM 3.0.2 unter SLES10SP3, Testsystem OTRS3.2.6 with laatest ITSM
JoernWR
Znuny newbie
Posts: 18
Joined: 04 Mar 2011, 18:44
Znuny Version: 3.05

Update: Missung Attachment in Article

Post by JoernWR »

Hi again,

I have an update on this issue.
For my own surpise, everything works finde, when the article is not created by the AgentTicketPhone Module, but was sent as an email instead!?!
Obviously it makes a difference in the way the attachment is attached to the article.

Can someone please give me a hint?

Cheers,
Joern
Produktiv OTRS::ITSM 3.0.2 unter SLES10SP3, Testsystem OTRS3.2.6 with laatest ITSM
peckel
Znuny newbie
Posts: 1
Joined: 08 Feb 2015, 18:44
Znuny Version: 3.3.10
Real Name: Peter Eckel

Re: Missung Attachment in Article

Post by peckel »

Hi Joern,

after quite a long time I ran into exactly the same issue.

It seems that the attachments just are not there while the 'ArticleCreate' event handler runs. If I write a script and check for articles manually (i.e. outside the event handler module) I see all articles just fine, while exactly the same code fails to show them when called from the event handler.

That seems to be a timing issue, meaning the event handler runs before the attachments have actually been added to the article.

Does anyone have an idea for a quick fix or a workaround? Or Joern, did you find a solution?

Cheers,

Peter.
Post Reply