As explained here, I needed to include attachements to notifications (event), even though it was not ArticleCreate event.
What I did:
I opened Kernel\System\Ticket\Event\NotificationEvent.pm.
I took the attachement block out of the "ArticleCreate" condition.
But...
$Param{Data}->{ArticleID} meant nothing. So I had to pick an Article object... which was done by function ArticleLastCustomerArticle().
Here is my new code:
Code: Select all
# add attachments to notification
# HvL - taken out of ArticleCreate event condition
if ( $Notification{Data}->{ArticleAttachmentInclude}->[0] ) {
# HvL - search for the article
my %Article = $Self->{TicketObject}->ArticleLastCustomerArticle(
TicketID => $Param{TicketID},
);
my %Index = $Self->{TicketObject}->ArticleAttachmentIndex(
ArticleID => $Article{ArticleID},
UserID => $Param{UserID},
StripPlainBodyAsAttachment => 3,
);
if (%Index) {
for my $FileID ( sort keys %Index ) {
my %Attachment = $Self->{TicketObject}->ArticleAttachment(
ArticleID => $Article{ArticleID},
FileID => $FileID,
UserID => $Param{UserID},
);
next if !%Attachment;
push @Attachments, \%Attachment;
}
}
}
# send notification
Regards,
HervE