[SOLVED]Disable Reply button on ticket zoom screen

Moderator: crythias

Locked
longnguyenotrs
Znuny newbie
Posts: 11
Joined: 02 Jan 2013, 19:03
Znuny Version: 3.1.6
Real Name: Long Nguyen
Company: CyberWolf

[SOLVED]Disable Reply button on ticket zoom screen

Post by longnguyenotrs »

Hi all,

My situation is as follow: If an agent go into the ticket zoom screen and is the owner of the ticket, then he/she can use Reply button to send feedback to customer. However, if that agent is not the owner of the ticket but only Responsible for it then the Reply button is disable (or removed) so that agent can only add internal note to others (without the ability to contact customer).

Could anyone can help me with that? Thanks a lot in advance.

Thanks and Best regards,

Long
Last edited by longnguyenotrs on 03 Jan 2013, 16:17, edited 1 time in total.
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Disable Reply button on ticket zoom screen for Responsib

Post by jojo »

thats not possible.
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
longnguyenotrs
Znuny newbie
Posts: 11
Joined: 02 Jan 2013, 19:03
Znuny Version: 3.1.6
Real Name: Long Nguyen
Company: CyberWolf

Re: Disable Reply button on ticket zoom screen for Responsib

Post by longnguyenotrs »

jojo wrote:thats not possible.
Thanks for your feedback jojo. Could it be done by code? Thanks in advance.
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: Disable Reply button on ticket zoom screen for Responsib

Post by reneeb »

Sure... you can do (nearly) everything with some programming.

Hint: In AgentTicketZoom.pm you'll find

Code: Select all

            my $Access = 1;
            my $Config = $Self->{ConfigObject}->Get('Ticket::Frontend::AgentTicketCompose');
            if ( $Config->{Permission} ) {
                my $Ok = $Self->{TicketObject}->TicketPermission(
                    Type     => $Config->{Permission},
                    TicketID => $Ticket{TicketID},
                    UserID   => $Self->{UserID},
                    LogNo    => 1,
                );
                if ( !$Ok ) {
                    $Access = 0;
                }
            }
You have to set $Access to 0 if the current User (hint 2: current user id is stored in $Self->{UserID}) is just the Responsible...
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
longnguyenotrs
Znuny newbie
Posts: 11
Joined: 02 Jan 2013, 19:03
Znuny Version: 3.1.6
Real Name: Long Nguyen
Company: CyberWolf

Re: Disable Reply button on ticket zoom screen for Responsib

Post by longnguyenotrs »

reneeb wrote:Sure... you can do (nearly) everything with some programming.

Hint: In AgentTicketZoom.pm you'll find

Code: Select all

            my $Access = 1;
            my $Config = $Self->{ConfigObject}->Get('Ticket::Frontend::AgentTicketCompose');
            if ( $Config->{Permission} ) {
                my $Ok = $Self->{TicketObject}->TicketPermission(
                    Type     => $Config->{Permission},
                    TicketID => $Ticket{TicketID},
                    UserID   => $Self->{UserID},
                    LogNo    => 1,
                );
                if ( !$Ok ) {
                    $Access = 0;
                }
            }
You have to set $Access to 0 if the current User (hint 2: current user id is stored in $Self->{UserID}) is just the Responsible...
Thanks a lot for your help reneeb. However, as per your instruction, I understood that we must always set some user ID as Responsible (by that, when checking user ID, we will know that user ID is Responsible or Owner). But an user ID can be owner of this ticket and at the same time the Responsible for other ticket. Could you help me how to check whether the current agent is an Owner or not? Thanks in advance.
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: Disable Reply button on ticket zoom screen for Responsib

Post by reneeb »

Code: Select all

                my $Access = 1;
                my $Config = $Self->{ConfigObject}->Get('Ticket::Frontend::AgentTicketCompose');
                if ( $Config->{Permission} ) {
                    my $Ok = $Self->{TicketObject}->TicketPermission(
                        Type     => $Config->{Permission},
                        TicketID => $Ticket{TicketID},
                        UserID   => $Self->{UserID},
                        LogNo    => 1,
                    );
                    if ( !$Ok ) {
                        $Access = 0;
                    }
                }
                
                if ( 
                    $Ticket{OwnerID} != $Self->{UserID}                 # user is not owner of the ticket
                   && $Ticket{ResponsibleID}                            # a responsible person is set
                   && $Ticket{ResponsibleID} == $Self->{UserID}         # that responsible person is the current user
                ) {
                    $Access = 0;
                }
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
longnguyenotrs
Znuny newbie
Posts: 11
Joined: 02 Jan 2013, 19:03
Znuny Version: 3.1.6
Real Name: Long Nguyen
Company: CyberWolf

Re: Disable Reply button on ticket zoom screen for Responsib

Post by longnguyenotrs »

reneeb wrote:

Code: Select all

                my $Access = 1;
                my $Config = $Self->{ConfigObject}->Get('Ticket::Frontend::AgentTicketCompose');
                if ( $Config->{Permission} ) {
                    my $Ok = $Self->{TicketObject}->TicketPermission(
                        Type     => $Config->{Permission},
                        TicketID => $Ticket{TicketID},
                        UserID   => $Self->{UserID},
                        LogNo    => 1,
                    );
                    if ( !$Ok ) {
                        $Access = 0;
                    }
                }
                
                if ( 
                    $Ticket{OwnerID} != $Self->{UserID}                 # user is not owner of the ticket
                   && $Ticket{ResponsibleID}                            # a responsible person is set
                   && $Ticket{ResponsibleID} == $Self->{UserID}         # that responsible person is the current user
                ) {
                    $Access = 0;
                }
Thanks a lot for your help reneeb. It worked nice.
Locked