[Rt-devel] Question on "Limit" for Transactions for RT3.0.12

Ruediger Riediger ruediger.riediger at Sun.COM
Mon Mar 14 06:52:45 EST 2005


Hello RT3 gurus,

I have trouble coding a scrip Condition triggering on a very special 
case: the condition should be true if the "Resolved" date is set for the 
very first time.

Now, the trouble is that this transaction [Set Resolved] is not 
recorded. However, what is recorded is the Status change. So I though it 
logical to look for a Status change to an inactive Status. As I do not 
want the condition to trigger on every Status change, I need to find the 
first change to an inactive Status:

sub IsApplicable {
     my $self = shift;
     if (($self->TransactionObj->Field eq 'Status') and
     ($self->Argument eq $self->TransactionObj->NewValue())) {
         # we are here when there is a Status change
         # copied from StatusChange.pm
         if ($self->QueueObj->IsInactiveStatus($self->Argument)) {
                 # now, we know it's resolved, rejected or deleted
                 my $Transactions = $self->TicketObj->Transactions;
                 $Transactions->Limit (FIELD => 'Field',
                                       VALUE => 'Status',
                                       ENTRYAGGREGATOR => 'AND',
                                       OPERATOR => '=',
                                       );
                 # Limiting to (Field = 'Status')
                 foreach($self->QueueObj->InactiveStatusArray) {
                     $Transactions->Limit (FIELD => 'NewValue',
                                           VALUE => $_,
                                           ENTRYAGGREGATOR => 'OR',
                                           OPERATOR => '=',
                                           );
                     # adding ... OR (NewValue = '...')
                 }

                 my $Transaction = $Transactions->Next;
                 # see if there is more than one transaction of this type
                 return(undef) if($Transaction and
                               ($Transaction->Id != 
$self->TransactionObj->Id));
         }
         return(1);
     }
     else {
         return(undef);
     }
}


However, the "Limit" criteria seem not to match up to
"Field = 'Status' AND (NewValue = 'resolved' OR NewValue = 'rejected' OR 
NewValue = 'deleted'). So what am I doing wrong?

Best regards,

	Ruediger Riediger

-- 
Dr. Ruediger Riediger                              Sun Microsystems GmbH
NSG - SunCERT                                             Komturstr. 18a
mailto:Ruediger.Riediger at Sun.com                          D-12099 Berlin
------------------------------------------------------------------------
NOTICE:  This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
------------------------------------------------------------------------
PGP 2048RSA/0x2C5020E9          964C E189 0FF0 8882  2BAB 65E2 6912 1FF2
------------------------------------------------------------------------


More information about the Rt-devel mailing list