1 package RT::Condition::CustomFieldEquals;
2 use base 'RT::Condition';
7 If a custom field has a value equal to some specified value.
11 # Based on Chuck Boeheim's code posted on the RT Wiki 3/13/06
12 # Simplified to avoid carrying old schema around. The new mechanics are that
13 # the ScripCondition's "Argument" is the custom field name = value. If the
14 # transaction initially sets the CF value to a the specified value, or
15 # changes it from not equaling to equaling the specified value, the condition
17 # Don't use this on custom fields that allow multiple values.
21 my $trans = $self->TransactionObj;
22 my $scrip = $self->ScripObj;
23 my ($field, $value) = split('=', $self->Argument, 2);
25 if ($trans->Type eq 'Create') {
26 return ($trans->TicketObj->FirstCustomFieldValue($field) eq $value);
28 if ($trans->Type eq 'CustomField') {
29 my $cf = RT::CustomField->new($self->CurrentUser);
31 return $trans->Field == $cf->Id
32 and ($trans->NewValue eq $value)
33 and ($trans->OldValue ne $value)