Module Erstellung in OTRS6

Hilfe zu OTRS Problemen aller Art
Post Reply
BerndDasBrot2
Znuny newbie
Posts: 11
Joined: 06 Mar 2018, 09:52
Znuny Version: 6.0.1

Module Erstellung in OTRS6

Post by BerndDasBrot2 »

Hi,

ich würde gern ein eigenes Module entwerfen.
Dazu wollte ich ein Ausgangsmiodul nehmen und von da weiter machen. Ich ging nach folgender Anleitung vor: http://doc.otrs.com/doc/manual/develope ... otrs.html#
Die Dokumentation ist aber sehr ungenau und auch wohl ziemlich veraltet. Z. B. habe ich herausgefunden, dass es link.pl nicht mehr gibt und das man das Projekt mit

Code: Select all

su -c "/opt/module-tools/bin/otrs.ModuleTools.pl Module::File::Link helloworld /opt/otrs" -s /bin/bash otrs 
verlinkt.
Jedoch: egal was ich mache, das Modul wird nicht geladen. Egal ob ich verlinke, ein Paket baue, den Cache leere, die Config neu aufbaue (Rebuild). Es wird einfach ignoriert. Kein Fehler, es wird einfach nicht geladen. Ich sehe kein "HelloWorld" Link, die URL Action=AgentHelloWorld läuft auf dem Fehler, dass das zugehörige modul nicht geladen wurde.

Code: Select all

su -c "bin/otrs.Console.pl Admin::Package::List  " -s /bin/bash otrs
Bringt auch nur Fred. Fred selbst kann auch keinen Hinweis liefern, warum das Modul nicht geladen wurde. Ja, auch das SOPM habe ich erstellt, sonst könnte ich kein Paket erstellen.

Wie komme ich jetzt dem Grund auf die Spur, warum das modul ignoriert wird? Und nochmal: es sind 100% die Dateien und deren Inhalt wie in dem oben erwähnten link.

Liebe Grüße,
Björn
zzz
Znuny superhero
Posts: 889
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Module Erstellung in OTRS6

Post by zzz »

Hallo Björn,

wie Du richtig bemerkt hast, wurde die Doku noch nicht vollständiger der 6er angepasst, weswegen ein Eins-zu-eins-Nachbau nicht funktionieren kann. Als erstes musst Du

Code: Select all

<otrs_config version="1.0" init="Application">
durch

Code: Select all

<otrs_config version="2.0" init="Application">
ersetzt.

Die restliche Syntax, inklusive Pfad, passt auch nicht mehr.

Du kannst dieses Modul als Beispiel nehmen und Dein HelloWorld-Modul dementsprechend anpassen.
https://github.com/OTRS/otrs/blob/rel-6 ... .xml#L7442

Tipp: Der Error-Log des Webservers bietet wertvolle Informationen.

Viele Grüße
Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
BerndDasBrot2
Znuny newbie
Posts: 11
Joined: 06 Mar 2018, 09:52
Znuny Version: 6.0.1

Re: Module Erstellung in OTRS6

Post by BerndDasBrot2 »

Hallo Emin,

mh, nur wegen der XML? Das habe ich mal konvertiert mit

Code: Select all

 Dev::Tools::Migrate::ConfigXMLStructure 
und sieht jetzt so aus:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<otrs_config version="2.0" init="Application">
        <Setting Name="Frontend::Module###AgentHelloWorld" Required="1" Valid="1">
        <Description Translatable="1">FrontendModuleRegistration for HelloWorld module.</Description>
        <Navigation>Frontend::Agent::ModuleRegistration</Navigation>
        <Value>
            <Item ValueType="FrontendRegistration">
                <Hash>
                    <Item Key="GroupRo">
                        <Array>
                        </Array>
                    </Item>
                    <Item Key="Title">HelloWorld</Item>
                    <Item Key="Group">
                        <Array>
                            <Item>users</Item>
                        </Array>
                    </Item>
                    <Item Key="Description">HelloWorld</Item>
                    <Item Key="NavBarName">HelloWorld</Item>
                </Hash>
            </Item>
        </Value>
    </Setting>
    <Setting Name="Frontend::Navigation###AgentHelloWorld###002-HelloWorld" Required="1" Valid="1">
        <Description Translatable="1">Main menu item registration.</Description>
        <Navigation>Frontend::Agent::ModuleRegistration::MainMenu</Navigation>
        <Value>
            <Array>
                <DefaultItem ValueType="FrontendNavigation">
                    <Hash>
                    </Hash>
                </DefaultItem>
                <Item>
                    <Hash>
                        <Item Key="Group">
                            <Array>
                                <Item>users</Item>
                            </Array>
                        </Item>
                        <Item Key="GroupRo">
                            <Array>
                            </Array>
                        </Item>
                        <Item Key="Description">HelloWorld</Item>
                        <Item Key="Name">HelloWorld</Item>
                        <Item Key="Link">Action=AgentHelloWorld</Item>
                        <Item Key="LinkOption"></Item>
                        <Item Key="NavBar">HelloWorld</Item>
                        <Item Key="Type">Menu</Item>
                        <Item Key="Block">ItemArea</Item>
                        <Item Key="AccessKey"></Item>
                        <Item Key="Prio">8400</Item>
                    </Hash>
                </Item>
            </Array>
        </Value>
    </Setting>

</otrs_config>
Leider ohne Erfolg.
Wie ich sagte, es gibt keinen Fehler, auch nicht im Error_log des Webservers.

Gruß,
Björn
zzz
Znuny superhero
Posts: 889
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Module Erstellung in OTRS6

Post by zzz »

BerndDasBrot2 wrote:die URL Action=AgentHelloWorld läuft auf dem Fehler, dass das zugehörige modul nicht geladen wurde.
Wäre in dem Fall Dein Fehler. Du musst die Action AgentHelloWorld öffnen, um eine Feedback zu erhalten.

Der Fehler, der in Deinem Browser angezeigt wird, sollte auch im Webserver-/OTRS-Log erscheinen.

Viele Grüße
Emin

Edit: Der alte Edit kann weg.
Last edited by zzz on 06 Mar 2018, 15:16, edited 2 times in total.
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
BerndDasBrot2
Znuny newbie
Posts: 11
Joined: 06 Mar 2018, 09:52
Znuny Version: 6.0.1

Re: Module Erstellung in OTRS6

Post by BerndDasBrot2 »

Hallo Emin,

nochmal Danke. Ich habe jetzt versucht das zu ändern. Verstehe aber nicht genau was du meinst. Ich wäre dir sehr dankbar, wenn mir die XML einmal einstellen könntest.
Ich bin noch ziemlich neu in dem Prozess. Darum kann ich mit der ZUordnung der Framework-Module noch nicht viel anfangen. Ich arbeite mich da durch.

Danke schonmal im Voraus
Lebe Grüße,
Björn
zzz
Znuny superhero
Posts: 889
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Module Erstellung in OTRS6

Post by zzz »

Hallo Björn,

ich habe mir die Seite noch mal angeguckt und gesehen, dass es gar kein Admin-Modul ist :lol:

Deine Config sollte dann in Ordnung sein.

Im Beispiel-Code wurde zu viel auskommentiert.
Ändere bitte mal Deine Kernel/System/HelloWorld.pm um in:

Code: Select all

# --
# Kernel/System/HelloWorld.pm - core module
# Copyright (C) (year) (name of author) (email of author)
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

package Kernel::System::HelloWorld;

use strict;
use warnings;

# list your object dependencies (e.g. Kernel::System::DB) here
our @ObjectDependencies = (
    # 'Kernel::System::DB',
);

=head1 NAME

HelloWorld - Little "Hello World" module

=head1 DESCRIPTION

Little OTRS module that displays the text 'Hello World' when called up.

=head2 new()

Create an object. Do not use it directly, instead use:

    my $HelloWorldObject = $Kernel::OM->Get('Kernel::System::HelloWorld');

=cut

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {};
    bless ($Self, $Type);

    return $Self;
}

=head2 GetHelloWorldText()

Return the "Hello World" text.

    my $HelloWorldText = $HelloWorldObject->GetHelloWorldText();

=cut

sub GetHelloWorldText {
    my ( $Self, %Param ) = @_;

    # Get the DBObject from the central object manager
    # my $DBObject = $Kernel::OM->Get('Kernel::System::DB');

    my $HelloWorld = $Self->_FormatHelloWorldText(
        String => 'Hello World',
    );

    return $HelloWorld;
}

=head2 _FormatHelloWorldText()

Format "Hello World" text to uppercase

    my $HelloWorld = $Self->_FormatHelloWorldText(
        String => 'Hello World',
    );

=cut

sub _FormatHelloWorldText{
    my ( $Self, %Param ) = @_;

    my $HelloWorld = uc $Param{String};

    return $HelloWorld;

}

1;
, öffne /otrs/index.pl?Action=AgentHelloWorld und poste die Logs.

Viele Grüße
Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
BerndDasBrot2
Znuny newbie
Posts: 11
Joined: 06 Mar 2018, 09:52
Znuny Version: 6.0.1

Re: Module Erstellung in OTRS6

Post by BerndDasBrot2 »

Hallo Emin,

ok, ich habe es geändert und das hier ist das Log

Code: Select all

Backend ERROR: OTRS-CGI-10 Perl: 5.24.1 OS: linux Time: Tue Mar  6 14:24:03 2018

 Message: Module Kernel::Modules::AgentHelloWorld not registered in Kernel/Config.pm!

 RemoteAddress: 192.168.7.33
 RequestURI: /otrs/index.pl?Action=AgentHelloWorld

 Traceback (57614): 
   Module: Kernel::System::Web::InterfaceAgent::Run Line: 917
   Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler Line: 40
   Module: (eval) (v1.99) Line: 207
   Module: ModPerl::RegistryCooker::run (v1.99) Line: 207
   Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 173
   Module: ModPerl::Registry::handler (v1.99) Line: 32
zzz
Znuny superhero
Posts: 889
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Module Erstellung in OTRS6

Post by zzz »

Ist die Config auch unter Kernel/Config/Files/XML/ gespeichert?

Anschließend noch ein rebuild
su -c "/opt/otrs/bin/otrs.Console.pl Maint::Config::Rebuild --cleanup" -s /bin/bash otrs

Viele Grüße
Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
BerndDasBrot2
Znuny newbie
Posts: 11
Joined: 06 Mar 2018, 09:52
Znuny Version: 6.0.1

Re: Module Erstellung in OTRS6

Post by BerndDasBrot2 »

Hey Emin,

Du bist einfach Klasse. Das XMl war nicht im Ordner XML, sondern ein Ordner höher.

Jetzt geht es! Vielen lieben Dank!

Liebe Grüße,
Björn!

PS: ich habe mir den rebuild eh als GIT hook eingerichtet :)
zzz
Znuny superhero
Posts: 889
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Module Erstellung in OTRS6

Post by zzz »

Freut mich, dass es funktioniert hat =)

Das mit dem Hook ist in der Tat eine gute Idee.

Viele Grüße
Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
Post Reply