Seeking ideas for not displaying an error in Process Tickets

Moderator: crythias

Post Reply
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Seeking ideas for not displaying an error in Process Tickets

Post by crythias »

Scenario: The process ticket TransitionAction TicketQueueSet enables someone to be in a Process which transitions the Process Ticket to a queue of which the current user no longer has privileges:

Process Ticket in Queue: Main ...
(Happy ... submit action)
TransitionAction: TicketQueueSet: SecureQueue
(Ugly error message: No Permission to see this ticket anymore. ) (Sad face: Did I do something wrong?)

So if I'm an agent doing a move on a manual ticket, I get thrown to Dashboard. If I'm in a Process, I get an error.

What can I do to not throw the error?
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
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Seeking ideas for not displaying an error in Process Tickets

Post by eandrex »

I Havent worke too much with proccess, but i guess that all of this occurs in the "AgentTicketZoom", so my advice would be this.

From your profile info i see you are using OTRS 3.3, so in OTRS 3.3, in AgentTicketZoom.pm from line 138 to 146 looks like this

https://github.com/OTRS/otrs/blob/rel-3 ... om.pm#L138

Code: Select all

my $TranslatableMessage = $Self->{LayoutObject}->{LanguageObject}->Get(
            "We are sorry, you do not have permissions anymore to access this ticket in its"
                . " current state. "
        );

        return $Self->{LayoutObject}->NoPermission(
            Message    => $TranslatableMessage,
            WithHeader => 'yes',
        );
I would change that to this:

Code: Select all

return $Self->{LayoutObject}->Redirect(
	OP => 'Action=AgentDashboard'
);
Did I understand you correctly?
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Seeking ideas for not displaying an error in Process Tickets

Post by crythias »

(I forgot to set my sig to 4.0.x) I really wish that I didn't have to do this at that location. It means all permission errors whatsoever go to Dashboard. I don't really want to do that because sometimes I really might want to throw that error so I know if someone's sourcing from a bad location.
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
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Seeking ideas for not displaying an error in Process Tickets

Post by eandrex »

I see your point and it is valid..

Assuming that the dynamic field "ProcessManagementActivityID" holds the current activity id of the proccess ticket, we could come with something like check if it a proccess ticket and compare the current ActivityID..it could work, because if i am not wrong, the transaction action is fired when the ticket passes from Activity 1 from Activity 2.. in that order, lets assume that your ticket is in ActivityID = 1 and goes to Activity=2, when that happens, TicketQueueSet is executed..so something like this should do the trick

in AgentTicketZoom.pm, replace from line 255 to 271 to this

Code: Select all

	my %Ticket = $Self->{TicketObject}->TicketGet(
			TicketID      => $Self->{TicketID},
			DynamicFields => 1,
	);
	 # error screen, don't show ticket
	 if ( !$Access ) {
		# Check if it is a proccess ticket and passed to ActivityID 2
		# If so, redirect instead of displaying error
		
		my $IsTicketProcess = $Self->{TicketObject}->TicketCheckForProcessType(
			'TicketID' => $Ticket{TicketID},
		);
		
		if($IsTicketProcess && $Ticket{DynamicField_ProcessManagementActivityID} == 2){
			return $Self->{LayoutObject}->Redirect(
				OP => 'Action=AgentDashboard',
			);
		}
		
		# Show error if agent is trying to access a non-proccess ticket or does not match the previous criteria
		my $TranslatableMessage = $Self->{LayoutObject}->{LanguageObject}->Translate(
            "We are sorry, you do not have permissions anymore to access this ticket in its current state. "
        );

        return $Self->{LayoutObject}->NoPermission(
            Message    => $TranslatableMessage,
            WithHeader => 'yes',
        );
	}
The only thing you should consdering, is that, instead of hardcode the "ActivityID", you could define a new OTRS Config option where you define the Activities ID and modifiy the previous code to look into those activities ids and if it matchs redirect to AgentDashboard.

What do you think about that solution?

Edit: This modification will be affected to by the fact that if an agent hat is not involved to the ticket tries to read it..and instead of displaying him the error message, will be redirected. :(
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Seeking ideas for not displaying an error in Process Tickets

Post by crythias »

You're probably right. I *really* wanted to check this before being redirected to the ticket, but it seems I really do have to check at the point of rendering. My issue appears to be checking if a queue is changed. And a lot of what I'm being requested to do is to reflect positive action but only if a queue is changed.

I'm thinking that I'll probably modify/extend Process Transition Action TicketQueueSet to do ... something, like set a DynamicField flag to 1 (or do that anyway as TicketDynamicFieldSet (QueueChange 1) )..
I think I might test if set, then clear the field, then redirect to dashboard at that point. My concern is whether the render screen test for permissions happens after all TAs (it should).

Alternative to that I wouldn't mind a TransitionAction that handled this, but the problem as it currently exists is that the TA that I'd want to run would have to occur separately after all the other TA's happen. I have a post about this ... My post is really important: An Activity without an Activity Dialog should just go to the next Transition, without waiting for events.

Back to what you said, I'm not completely happy with hard coding the source AID and PID to check things, but I guess that's all I have to do unless I can get a custom/standalone TA to escape the ticket if the queue changes [and permissions no longer valid].
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