Hallo
So langsam laufen die Prozesse.
Hab jetzt auch mittels TicketCreate neue Tickets erstellt. (LinkAs: Child)
Nun würde ich gerne das ParentTicket (Also das Prozessticket) entsprechend schließen, wenn alle Childs geschlossen sind.
Leider finde ich dazu weder in der OTRS Doc etwas noch hier. (vieleicht auch einfach schlecht gesucht)
Kann mir da jemand nen Tipp geben?
Schön wäre ja, wenn man einfach eine Transission erstellen könnte, welche feuert, sobald beide Kindtickets beendet sind.
Transition für Child Ticket
Re: Transition für Child Ticket
Hi,
child tickets haben keine Direkte Verbindung außer dem "link" zum Parent.
Es gibt Möglichkeiten mit dem GenericInterface + Webservices, wenn Dein Child das Parent "kennt" indem Du die Ticketnummer vererbst. Ohne kommerziellem AddOn kenne ich keine Möglichkeit.
Mit AddOn aus der OTRS Business Solution™ geht's, habe es aber selber nicht konfiguirert bekommen, sondern konfigurieren lassen. Damit kennt das Child den Parent, das Parent weiß, wieviele Childs es gibt, und solange
noch welche offen sind, geht das Parent nicht zu. Frag' mich aber nicht, wie das genau geht.
Andere Möglichkeiten mit ACLs habe ich versucht, bin aber gescheitert.
Viele Grüße
Flo
child tickets haben keine Direkte Verbindung außer dem "link" zum Parent.
Es gibt Möglichkeiten mit dem GenericInterface + Webservices, wenn Dein Child das Parent "kennt" indem Du die Ticketnummer vererbst. Ohne kommerziellem AddOn kenne ich keine Möglichkeit.
Mit AddOn aus der OTRS Business Solution™ geht's, habe es aber selber nicht konfiguirert bekommen, sondern konfigurieren lassen. Damit kennt das Child den Parent, das Parent weiß, wieviele Childs es gibt, und solange
noch welche offen sind, geht das Parent nicht zu. Frag' mich aber nicht, wie das genau geht.

Andere Möglichkeiten mit ACLs habe ich versucht, bin aber gescheitert.
Viele Grüße
Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12
-- Ich beantworte keine Forums-Fragen PN - No PN please
I won't answer to unfriendly users any more. A greeting and regards are just polite.
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12
-- Ich beantworte keine Forums-Fragen PN - No PN please
I won't answer to unfriendly users any more. A greeting and regards are just polite.
Re: Transition für Child Ticket
Danke!
Habs jetzt mit Generic Agent und eigenem kleinen Modul gelöst.
Habs jetzt mit Generic Agent und eigenem kleinen Modul gelöst.
Re: Transition für Child Ticket
Hi,
kannst Du das mal zeigen? Ich wäre interessiert.
Flo
kannst Du das mal zeigen? Ich wäre interessiert.
Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12
-- Ich beantworte keine Forums-Fragen PN - No PN please
I won't answer to unfriendly users any more. A greeting and regards are just polite.
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12
-- Ich beantworte keine Forums-Fragen PN - No PN please
I won't answer to unfriendly users any more. A greeting and regards are just polite.
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Transition für Child Ticket
Falls es irgendwem Anregungen gibt, ich hab ein ähnliches GA Modul, das allerdings nicht das Eltern Ticket schließt, sondern nur einen Artikel anhängt:
Code: Select all
#!/usr/bin/perl
# This module is triggered by a generic agent and will:
# - Parse the linked tickets and the articles of the ticket
# - Append a new article (note-internal, sender_type == system) if a child got closed since the last run
# - Reopen the ticket if it was in a pending state
package GAModules::ParentReactsToChild;
use strict;
use warnings;
use utf8;
use Kernel::System::VariableCheck qw(:all);
use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new(
'Kernel::System::Log' => {
LogPrefix => 'TTO-ParentReactstoChild',
},
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# get needed objects
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $LinkObject = $Kernel::OM->Get('Kernel::System::LinkObject');
# get all linked tickets
my $LinkList = $LinkObject->LinkList(
Object => 'Ticket',
Key => $Param{TicketID},
Object2 => 'Ticket',
State => 'Valid',
Type => 'ParentChild',
Direction => 'Target',
UserID => 1,
);
# exit if no tickets are linked
return unless IsHashRefWithData($LinkList);
# exit if there are links, but no links to childs
return unless ($LinkList->{Ticket}->{ParentChild} && IsHashRefWithData($LinkList->{Ticket}->{ParentChild}) );
my %LinkedChildIDs = ( %{ $LinkList->{Ticket}->{ParentChild}->{Target} } );
# get all articles of type note-internal and sender system
my $ArticleTypeID = $TicketObject->ArticleTypeLookup(
ArticleType => 'note-internal',
);
my $SenderTypeID = $TicketObject->ArticleSenderTypeLookup(
SenderType => 'system',
);
my @ArticleBox = $TicketObject->ArticleContentIndex(
TicketID => $Param{TicketID},
UserID => 1,
ArticleTypeID => [ $ArticleTypeID ],
ArticleSenderTypeID => [ $SenderTypeID ],
);
# remove all (closed) tickets from the LinkList if an system-article contains the line:
# 'Info: Child ( #TicketNumber ) got closed'
# (Because we don't want to create the closed message twice)
foreach my $Article (@ArticleBox) {
if ( $Article->{Subject} =~ m/Info:\sChild\s\(\s#(\d*)\s\)\sgot\sclosed\./ ) {
# Get TicketID of this TicketNumber
my $TicketID = $TicketObject->TicketIDLookup(
TicketNumber => $1,
UserID => 1,
);
# And remove it from the hash
delete $LinkedChildIDs{$TicketID};
}
}
# exit if no unseen child tickets are left
return unless IsHashRefWithData( \%LinkedChildIDs );
my $ReopenMainTicket = 0;
foreach my $TicketID ( keys %LinkedChildIDs ) {
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
DynamicFields => 0,
UserID => 1,
);
# If ticket is closed, create an article (to Main Ticket!)
if ($Ticket{StateType} eq 'closed') {
my $Link = "index.pl?Action=AgentTicketZoom;TicketID=$TicketID";
my $Body = "Automated note to inform the parent ticket about closed sub/child-tickets.<br />";
$Body .= "<br /><a href=\"$Link\">Link to ticket</a>";
my $ArticleID = $TicketObject->ArticleCreate(
TicketID => $Param{TicketID},
ArticleType => 'note-internal',
SenderType => 'system',
Subject => "Info: Child ( #$Ticket{TicketNumber} ) got closed.",
Body => $Body,
Charset => 'ISO-8859-15',
MimeType => 'text/html',
HistoryType => 'AddNote',
HistoryComment => 'Automated update (GA) - StateUpdate and AddNote',
UserID => 1,
);
$ReopenMainTicket = 1;
}
}
if ( $ReopenMainTicket == 1 ) {
my $Success = $TicketObject->TicketStateSet(
State => 'open',
TicketID => $Param{TicketID},
UserID => 1,
);
}
}
1;
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Transition für Child Ticket
sorry etwas busy mit einarbeitung in otrs
hier mein code (nicht hübsch und muss noch aufgeräumt werden)
hier mein code (nicht hübsch und muss noch aufgeräumt werden)
Code: Select all
package Kernel::System::GenericAgent::CloseOnChild;
#use strict;
use warnings;
use Kernel::System::ObjectManager;
use Kernel::System::Log;
use Kernel::System::Ticket;
use Kernel::System::LinkObject;
use vars qw(@ISA $VERSION);
$VERSION = qw($Revision: 1.17 $) [1];
sub new {
my ( $Type, %Param ) = @_;
my $Self = {};
bless( $Self, $Type );
$Self->{TicketObject} = Kernel::System::Ticket->new(%Param);
$Self->{LinkObject} = Kernel::System::LinkObject->new($Self->{TicketObject});
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
my %Ticket = $Self->{TicketObject}->TicketGet(%Param);
my $Links = $Kernel::OM->Get('Kernel::System::LinkObject')->LinkList(
Object => 'Ticket',
Key => $Ticket{TicketID},
State => 'Valid',
Type => 'ParentChild',
UserID => $Ticket{OwnerID},
);
return 1 if !$Links;
return 1 if ref $Links ne 'HASH';
return 1 if !$Links->{Ticket};
return 1 if ref $Links->{Ticket} ne 'HASH';
return 1 if !$Links->{Ticket}->{ParentChild};
return 1 if ref $Links->{Ticket}->{ParentChild} ne 'HASH';
return 1 if !$Links->{Ticket}->{ParentChild}->{Target};
return 1 if ref $Links->{Ticket}->{ParentChild}->{Target} ne 'HASH';
my $OpenSubTickets = 0;
TICKETID:
for my $Child_TicketID ( sort keys %{ $Links->{Ticket}->{ParentChild}->{Target} } ) {
my %Child_Ticket = $Kernel::OM->Get('Kernel::System::Ticket')->TicketGet(
TicketID => $Child_TicketID,
);
if ( $Child_Ticket{StateType} !~ m{ \A (close|merge|remove) }xms ) {
$OpenSubTickets = 1;
last TICKETID;
}
}
if ($OpenSubTickets == 0) {
$Kernel::OM->Get('Kernel::System::Ticket')->TicketStateSet(
StateID => 2,
TicketID => $Ticket{TicketID},
UserID => $Ticket{OwnerID},
);
}
return 1;
}
1;