[rt-users] Help with code identifying QueueWatcher AdminCc

Kevin Falcone falcone at bestpractical.com
Thu Apr 28 23:09:52 EDT 2011


On Thu, Apr 28, 2011 at 03:47:40PM -0700, Kenneth Crocker wrote:
>    To List,
> 
>    I've got some code that I'm using to try and identify certain users as the Queue AdminCc. I
>    want to do this so I can stop sending emails to Queue AdminCc's when they are also the
>    Requestor or Owner. The code is as follows:

If you want to check Queue AdminCc's not Ticket AdminCcs, you need to
look at the queue ($ticket->QueueObj) not the $ticket

$ticket->QueueObj->AdminCc will give you an RT::Group and you want to
read about the HasMember method on groups

-kevin

>    =======================================================================
>    # Initiate Email when Ticket Status is created and Requestor or Owner are not Queue AdminCc
> 
>    my $trans = $self->TransactionObj;
>    my $ticket = $self->TicketObj;
>    my $owner = $ticket->OwnerObj->EmailAddress;
>    my $requestor = $ticket->Requestors->UserMembersObj->First->EmailAddress;
> 
>    if ($ticket->IsWatcher(Type => 'AdminCc', EmailAddress => $owner) or
>    $ticket->IsWatcher(Type => 'AdminCc', EmailAddress => $requestor))
>    {
>    return 0;
>    }
> 
>    return ($trans->Type eq "Create");
>    return 0;
>    ==============================================================
> 
>    It always fails. I always get a couple emails going to the same person. I've tried using
>    PrincipalID and Name as the identifiers and still no joy.
> 
>    I've also checked the code in Queue_Overlay.pm and I can't seem to see (I'mbasically a perl
>    newbie) where the Queue AdminCc is differentiated from the Ticket AdminCc, which we NEVER use.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110428/37cc6a7a/attachment.sig>


More information about the rt-users mailing list