Appearance
Internes Erweitern des OTOBO-Kernsystems
In diesem Artikel lernst du, wie du OTOBO direkt im Kern anpasst – über XML-Konfiguration, Perl-Module und Templates. Wir zeigen dir Schritt für Schritt, wie du ein eigenes „HelloWorld“-Modul ins System einbindest.
1. Verzeichnisstruktur
Alle Anpassungen liegen unterhalb deines OTOBO-Clones im Kernel/
-Verzeichnis:
Kernel/
├─ Config/Files/ # XML-Registrierungen
│ └─ XML/
├─ System/ # Geschäftslogik-Module (Core)
├─ Modules/ # Frontend-Controller (Agent/Customer)
├─ Output/HTML/Standard/ # Template Toolkit (TT)-Templates
└─ Language/ # Übersetzungen
2. XML-Konfiguration
Neue Module und Routen werden per XML registriert. Lege in Kernel/Config/Files/XML/
eine Datei HelloWorld.xml
an:
xml
<?xml version="1.0" encoding="UTF-8"?>
<otobo_config version="2.0" init="Application">
<!-- 1. Frontend-Modul registrieren -->
<Setting Name="Frontend::Module###AgentHelloWorld" Required="1" Valid="1">
<Navigation>Frontend::Agent::ModuleRegistration</Navigation>
<Value>
<Item ValueType="FrontendRegistration">
<Hash>
<Item Key="Group"><Array><Item>users</Item></Array></Item>
<Item Key="Description" Translatable="1">HelloWorld Modul</Item>
<Item Key="Title" Translatable="1">HelloWorld</Item>
<Item Key="NavBarName">HelloWorld</Item>
</Hash>
</Item>
</Value>
</Setting>
</otobo_config>
3. Core-Modul (Geschäftslogik)
Erstelle in Kernel/System/HelloWorld.pm
deine Logik:
perl
package Kernel::System::HelloWorld;
use strict;
use warnings;
our @ObjectDependencies = ();
sub new {
my ($Type, %Param) = @_;
return bless {}, $Type;
}
sub GetHelloWorldText {
my ($Self, %Param) = @_;
return $Self->_FormatText(String => 'Hello World');
}
sub _FormatText {
my ($Self, %Param) = @_;
return uc $Param{String};
}
1;
4. Frontend-Modul (Controller)
In Kernel/Modules/AgentHelloWorld.pm
bindest du deine Logik ins Agent-Frontend ein:
perl
package Kernel::Modules::AgentHelloWorld;
use strict;
use warnings;
sub new { bless {}, shift }
sub Run {
my ($Self, %Param) = @_;
my $HelloObj = $Kernel::OM->Get('Kernel::System::HelloWorld');
my $LayoutObj = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
my %Data;
$Data{Text} = $HelloObj->GetHelloWorldText();
return
$LayoutObj->Header(Title => 'HelloWorld')
. $LayoutObj->NavigationBar()
. $LayoutObj->Output(
TemplateFile => 'AgentHelloWorld',
Data => \%Data,
)
. $LayoutObj->Footer();
}
1;
5. Templates (TT)
Lege in Kernel/Output/HTML/Standard/AgentHelloWorld.tt
folgendes Template an:
tt
[% Data.Text %]
<p>Das ist dein selbst erstelltes HelloWorld-Modul!</p>
6. Beispiel-Workflow
Neu laden:
bashbin/otobo.Console.pl Maint::Config::Rebuild
Cache leeren:
bashbin/otobo.Console.pl Maint::Cache::Delete
Browser öffnen: Agent-Interface → Menü → „HelloWorld“
7. Tipps & Best Practices
- ObjectDependencies sauber deklarieren (z.B. DB, Layout).
- POD-Dokumentation in Perl-Modulen nicht vergessen.
- Übersetzungen unter
Kernel/Language/de_*.pm
pflegen. - Unit-Tests mit Mojolicious einrichten (optional).
- Nach jeder Änderung Config rebuild & Cache löschen.
Damit hast du eine solide Vorlage, um weitere Kern-Erweiterungen in OTOBO zu realisieren. Viel Spaß beim Entwickeln!