Multiple responsibles or watchers in a ticket?

Moderator: crythias

Post Reply
did12345
Znuny newbie
Posts: 50
Joined: 04 Dec 2012, 15:24
Znuny Version: 3.2.0

Multiple responsibles or watchers in a ticket?

Post by did12345 »

Hi,
I'd like to know if there is a way to set multiple responsible agents to a ticket, so that they may follow all the ticket actions, or to add them automatically to the watchlist. Is this possible? 8)
OTRS 4!
did12345
Znuny newbie
Posts: 50
Joined: 04 Dec 2012, 15:24
Znuny Version: 3.2.0

Re: Multiple responsibles or watchers in a ticket?

Post by did12345 »

I may have found a way through the ticket event module, but i can't get it working, any ideas??

In config.pm i added:
$SELF->{'Ticket::EventModulePost'}->{'TicketCreateSuscribe'}={module=>'Kernel::System::Ticket::Event::TicketCreateSuscribe'};


The package:

Code: Select all

# --
# Kernel/System/Ticket/Event/TicketCreateSuscribe.pm - test event module
# Copyright (C) 2001-2011 xxx, http://otrs.org/
# --
# $Id: Test.pm,v 1.12 2011-11-25 10:14:18 mg Exp $
# --
# 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::Ticket::Event::TicketCreateSuscribe;

use strict;
use warnings;

use vars qw($VERSION);
$VERSION = qw($Revision: 1.12 $) [1];

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

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

    # get needed objects
    for (qw(ConfigObject TicketObject LogObject UserObject CustomerUserObject SendmailObject)) {
        $Self->{$_} = $Param{$_} || die "Got no $_!";
    }

    return $Self;
}

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

    # check needed stuff
    for (qw(Data Event Config)) {
        if ( !$Param{$_} ) {
            $Self->{LogObject}->Log( Priority => 'error', Message => "Need $_!" );
            return;
        }
    }
    for (qw(TicketID)) {
        if ( !$Param{Data}->{$_} ) {
            $Self->{LogObject}->Log( Priority => 'error', Message => "Need $_ in Data!" );
            return;
        }
    }

    if ( $Param{Event} eq 'TicketCreate' ) {
        my %Ticket = $Self->{TicketObject}->TicketGet(
            TicketID      => $Param{Data}->{TicketID},
            DynamicFields => 0,
        );
        if ( $Ticket{Type} eq 'DEMANDE DE SERVICE' ) {
#we start doing stuff
    # trigger event
    $Self->{TicketObject}->TicketWatchSubscribe(
        TicketID    => $Param{TicketID},
        WatchUserID => $Param{UserID},
        UserID      => $Param{UserID},
    );

    # add history
    $Self->HistoryAdd(
        TicketID     => $Param{TicketID},
        CreateUserID => $Param{UserID},
        HistoryType  => 'Subscription to watchlist',
        Name         => "\%\%$User{UserFirstname} $User{UserLastname} ($User{UserLogin})",
    );


    return 1;
               }
 
    }

1;


:? :? :?
Last edited by did12345 on 25 Sep 2013, 14:04, edited 2 times in total.
OTRS 4!
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Multiple responsibles or watchers in a ticket?

Post by reneeb »

Please use the [ code ]-Tags...


Your config should look like

Code: Select all

$Self->{'Ticket::EventModulePost'}->{'111-TicketCreateSuscribe'} = {
    Module => 'Kernel::System::Ticket::Event::TicketCreateSuscribe',
    Event   => 'TicketCreate',
};
$SELF -> $Self
module -> Module
added: Event

I didn't check the Perl module...
Last edited by reneeb on 11 Jun 2014, 13:05, edited 1 time in total.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
did12345
Znuny newbie
Posts: 50
Joined: 04 Dec 2012, 15:24
Znuny Version: 3.2.0

Re: Multiple responsibles or watchers in a ticket?

Post by did12345 »

8)
reneeb wrote:Please use the

Code: Select all

-Tags...


Your config should look like [code]$Self->{'Ticket::EventModulePost'}->{'111-TicketCreateSuscribe'} = {
    Module => 'Kernel::System::Ticket::Event::TicketCreateSuscribe',
    Event   => 'TicketCreate',
};
$SELF -> $Self
module -> Module
added: Event

I didn't check the Perl module...
Thank you very much i'll check it out, i corrected the post 8)
OTRS 4!
did12345
Znuny newbie
Posts: 50
Joined: 04 Dec 2012, 15:24
Znuny Version: 3.2.0

Re: Multiple responsibles or watchers in a ticket?

Post by did12345 »

Still not working :( any ideas?
OTRS 4!
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Multiple responsibles or watchers in a ticket?

Post by reneeb »

Any messages in the log files?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
did12345
Znuny newbie
Posts: 50
Joined: 04 Dec 2012, 15:24
Znuny Version: 3.2.0

Re: Multiple responsibles or watchers in a ticket?

Post by did12345 »

reneeb wrote:Any messages in the log files?
nothing! I tried correcting the module so that it could get a certain ticket type and then suscribe the user to the watcher list... but it still does not work...
i tried this with $PARAM {typeID}

the "corrected" code of the module is

Code: Select all

# --
# Kernel/System/Ticket/Event/TicketCreateSuscribe - test event module

package Kernel::System::Ticket::Event::TicketCreateSuscribe;

use strict;
use warnings;

use vars qw($VERSION);
$VERSION = qw($Revision: 1.12 $) [1];

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

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

    # get needed objects
    for (qw(ConfigObject TicketObject LogObject UserObject CustomerUserObject SendmailObject TypeID UserID)) {
        $Self->{$_} = $Param{$_} || die "Got no $_!";
		}

    return $Self;
	}

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

    # check needed stuff
    for (qw(Data Event Config)) {
        if ( !$Param{$_} ) {
            $Self->{LogObject}->Log( Priority => 'error', Message => "Need $_!" );
            return;
        }
    }
    for (qw(TicketID)) {
        if ( !$Param{Data}->{$_} ) {
            $Self->{LogObject}->Log( Priority => 'error', Message => "Need $_ in Data!" );
            return;
        }
    }

    if ( $Param{Event} eq 'TicketCreate' ) {
        my %Ticket = $Self->{TicketObject}->TicketGet(
            TicketID      => $Param{Data}->{TicketID},
            DynamicFields => 0,
        );
			if ( $Param{TypeID} eq '15') {
#we start doing stuff
    # trigger event
				$Self->{TicketObject}->TicketWatchSubscribe(
				TicketID    => $Param{TicketID},
				WatchUserID => $Param{UserID},
				UserID      => $Param{UserID},
				);

    # add history
				$Self->HistoryAdd(
				TicketID     => $Param{TicketID},
				CreateUserID => $Param{UserID},
				HistoryType  => 'Subscription to watchlist',
				Name         => "\%\%$User{UserFirstname} $User{UserLastname} ($User{UserLogin})",
				);


				
			}
 
        }	
		return 1;
	}
1;
OTRS 4!
hmmmm3
Znuny newbie
Posts: 57
Joined: 17 Feb 2012, 07:48
Znuny Version: 3

Re: Multiple responsibles or watchers in a ticket?

Post by hmmmm3 »

Did you get this to work for you?
did12345
Znuny newbie
Posts: 50
Joined: 04 Dec 2012, 15:24
Znuny Version: 3.2.0

Re: Multiple responsibles or watchers in a ticket?

Post by did12345 »

nope...
OTRS 4!
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Multiple responsibles or watchers in a ticket?

Post by crythias »

Use a distribution list email address attached to the watcher agent.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Post Reply