[Rt-commit] r3997 - in rtir/branches/1.9-EXPERIMENTAL: .
lib/RT/Action
ruz at bestpractical.com
ruz at bestpractical.com
Mon Oct 31 10:48:59 EST 2005
Author: ruz
Date: Mon Oct 31 10:48:59 2005
New Revision: 3997
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentReportState.pm
Log:
Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentReportState.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentReportState.pm (original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentReportState.pm Mon Oct 31 10:48:59 2005
@@ -75,28 +75,32 @@
sub Commit {
my $self = shift;
- my $State;
my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
$cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_State');
- unless ($cf->Id) {
+ unless ($cf->Id) {
return(1);
}
- if ($self->TicketObj->Status eq 'new' or $self->TicketObj->Status eq 'open' or $self->TicketObj->Status eq 'stalled') {
- $State = 'new';
+
+ my $state;
+ my $status = $self->TicketObj->Status;
+ if ( $status =~ /^(?:new|open|stalled)$/ ) {
+ $state = 'new';
+
my $parents = RT::Tickets->new($self->TransactionObj->CurrentUser);
$parents->LimitHasMember($self->TicketObj->id);
$parents->LimitQueue(VALUE => 'Incidents');
- if ($parents->First) {
- $State = 'open';
+ if ($parents->Count) {
+ $state = 'open';
}
- } elsif ($self->TicketObj->Status eq 'resolved') {
- $State = 'resolved';
- } elsif ($self->TicketObj->Status eq 'rejected') {
- $State = 'rejected';
+ } elsif ($status eq 'resolved') {
+ $state = 'resolved';
+ } elsif ($status eq 'rejected') {
+ $state = 'rejected';
} else {
- return 0;
+ return (1);
}
- $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $State);
+
+ $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $state);
return 1;
}
More information about the Rt-commit
mailing list