meisterheister / OTRS-Teams

OTRS Microsoft Teams integration
GNU Affero General Public License v3.0
10 stars 3 forks source link

OTRS throwing Internal Server Errros #1

Open andreas5232 opened 4 years ago

andreas5232 commented 4 years ago

I have installed the TeamsNotification-1.1.0.opm on OTRS Free v6.0.5 and as soon as I'm activating the Teams Notification via system configuration, the OTRS starts throwing Internal Server Errors on specific tasks.

Apache Log excerpt when closing a ticket: Can't locate object method "ArticleGet" via package "Kernel::System::Ticket::Article" at /usr/share/otrs/Kernel/System/Ticket/Event/TeamsNotification.pm line 87

Maybe anyone has an idea whats wrong here?

idefixgallier commented 4 years ago

Hi! As far as i see the ArticleGet method is uses in a wrong way

it should be like that according to https://doc.otrs.com/doc/api/otrs/6.0/Perl/Kernel/System/Ticket/Article.pm.html for my $MetaArticle (@Articles) { my %Article = $ArticleObject->BackendForArticle( %{$MetaArticle} )->ArticleGet( %{$MetaArticle} ); }

instead of

my %Article = $ArticleObject->ArticleGet(

Unfortunately i have no knowledge of Perl and i have no idea how to change that ....

I hope for the developer to react

Kind regards Martin

andreas5232 commented 4 years ago

That's a good hint! :+1:

Unfortunately I don't have any development environment right now and never built an opm package (yet). This snippet would be my first bet:

[...]
    # get ticket attribute matches
    my @ArticleList = $ArticleObject->ArticleList(
        ArticleID    => $Param{Data}->{ArticleID},
        TicketID     => $Param{Data}->{TicketID},
        From         => $Param{Data}->{From},
        SenderType   => $Param{Data}->{SenderType},
        OnlyFirst   => 1,
    );
    my %Article = $ArticleObject->BackendForArticle(%{$ArticleList[0]})->ArticleGet(%{$ArticleList[0]});
    my %Ticket = $TicketObject->TicketGet(
[...]

I'll try it myself in the next weeks and will report back, if this fixes the issue.

idefixgallier commented 4 years ago

I solved it by coping from another script …

1 Inserted these “my BackendObject” things

2 commented the original “my % Article”

3 inserted the new “my %article” with the BackendObject

my $BackendObject = $ArticleObject->BackendForArticle(

                          TicketID  => $Param{Data}->{TicketID},

                          ArticleID => $Param{Data}->{ArticleID},

           );

# get ticket attribute matches

#my %Article = $ArticleObject->ArticleGet(

           my %Article = $BackendObject->ArticleGet(

Von: Andreas Erhard notifications@github.com Gesendet: Montag, 27. Juli 2020 14:59 An: meisterheister/OTRS-Teams OTRS-Teams@noreply.github.com Cc: idefixgallier martin.hochreiter@outlook.at; Comment comment@noreply.github.com Betreff: Re: [meisterheister/OTRS-Teams] OTRS throwing Internal Server Errros (#1)

That's a good hint! 👍

Unfortunately I don't have any development environment right now and never built an opm package (yet). This snippet would be my first bet:

[...]

# get ticket attribute matches

my @ArticleList = $ArticleObject->ArticleList(

    ArticleID    => $Param{Data}->{ArticleID},

    TicketID     => $Param{Data}->{TicketID},

    From         => $Param{Data}->{From},

    SenderType   => $Param{Data}->{SenderType},

    OnlyFirst   => 1,

);

my %Article = $ArticleObject->BackendForArticle(%{$ArticleList[0]})->ArticleGet(%{$ArticleList[0]});

my %Ticket = $TicketObject->TicketGet(

[...]

I'll try it myself in the next weeks and will report back, if this fixes the issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/meisterheister/OTRS-Teams/issues/1#issuecomment-664380496 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AQNJWZSSXGE4RYICY5DZLBLR5V22PANCNFSM4M4CXUCA . https://github.com/notifications/beacon/AQNJWZRM247ESNTDPBJYJ2DR5V22PA5CNFSM4M4CXUCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE6M2IUA.gif