znuny / Znuny

Znuny/Znuny LTS is a fork of the ((OTRS)) Community Edition, one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management.
https://www.znuny.org
GNU General Public License v3.0
355 stars 85 forks source link

Problems with mentions when merging tickets #347

Closed GWarsow closed 2 months ago

GWarsow commented 1 year ago

Environment

Expected behaviour

No error should be logged, when merging a ticket.

Actual behaviour

An error is thrown:

Message: Need ChannelID or ChannelName!

 Traceback (30252):
   Module: Kernel::System::CommunicationChannel::ChannelGet Line: 159
   Module: Kernel::System::Ticket::Event::Mentions::Run Line: 52
   Module: Kernel::System::EventHandler::EventHandler Line: 222
   Module: Kernel::System::EventHandler::EventHandlerTransaction Line: 264
   Module: Kernel::System::ObjectManager::ObjectEventsHandle Line: 426
   Module: Kernel::System::ObjectManager::ObjectsDiscard Line: 474
   Module: Kernel::System::Ticket::TicketMerge Line: 6358

How to reproduce

1) Merge freshly generated ticket into already existing ticket

Note: merging an already existing ticket, into the freshly created ticket, does not cause problems.

Additional information

when merging two tickets, we finally get to following lines https://github.com/znuny/Znuny/blob/944dda4cd387724bdbc1119c49f549742a4bdee6/Kernel/System/Ticket/Event/Mentions.pm#L46-L49 where an article is to be fetched via its TicketID and ArticleID. Problem is, that this article is the/one article to be merged from TicketID to otherTicketID and this merging already took place. Accordingly, the article would have to be fetched via ArticleGet(otherTicketID, ArticleID). But since ArticleGet(TicketID, ArticleID) is called, we get no proper article object but

Article:
$VAR1 = {
          'SenderType' => undef
        };

which means that return 1 if !%Article; is not applied and we run into the Need ChannelID or ChannelName! as $Article{CommunicationChannelID} is undef.

I do not know whether this is of importance, but the article to be merged is the one article of a freshly created ticket where ticket merging was triggered via a ArticleCreate Eventhandler. However, I assume this to be of importance since doing the merging the other way around (merging already existing ticket into the freshly created ticket) does not cause problems.

Could you please fix the incorrect behavior mentioned above?

Kind regards Gregor

GWarsow commented 1 year ago

Would it be an option to call return 1 if !%Article || !(exists $Article{CommunicationChannelID}); in https://github.com/znuny/Znuny/blob/944dda4cd387724bdbc1119c49f549742a4bdee6/Kernel/System/Ticket/Event/Mentions.pm#L50

hanneshal commented 1 year ago

Updated issue to issue template

dignin commented 1 year ago

@GWarsow , can you verify the issue again in 6.5.2? I cannot currently produces the issue. It's also for me not really clear. Here's what I did.

Install base system\ Create new ticket\ Merge into welcome ticket

Help me understand if that was what you did, and please verify again in 6.5.2.

rkaldung commented 2 months ago

This issue will be closed due to missing feedback.