Le 13/01/2016 20:55, Aaron McCormack a écrit :
> Hi RT Users-
>
> I'm looking to create a scrip which enforces a maximum number of tickets of a
> certain status, per person, per queue.
>
> For example:
>
> Joe has 3 status open tickets and 4 status stalled tickets. By policy, Joe
> is only allowed to have 3 open tickets at once.
>
> Joe tries to change 1 of the stalled tickets to open, but RT counts the
> number of status open tickets that Joe already has and doesn't allow the
> status change. If Joe then changes 1 open ticket to resolved, then he can
> change 1 stalled to open, maintaining his limit of 3 status open tickets.
>
> Has anyone tried enforcing limitation like this or query the status of other
> tickets in a scrip?
>
I don't think you should use scrips for this because it will be asynchrone.
I would do:
- set a user or group CustomField to record each ones limits
- add a method to local/lib/RT/User_Local.pm named CheckStatusLimit,
that retrieve the user/group limit, get the list of owned tickets and
check if limit are reached, then return if the new status is allowed or not.
- use callbacks (Tickt/Display.html and other plaes where user can
change status) or override maybe ProcessTicketBasics, to use this method
before accepting status change. Display proper error to user if not allowed
I would avoid enforcing this in Ticket->SetStatus method as you may
wan't to allow others to force status or even scripts.
--
Easter-eggs Spécialiste GNU/Linux
44-46 rue de l'Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37- Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com - http://www.easter-eggs.com