[Rt-commit] r5029 - in rtir/branches/1.9-EXPERIMENTAL: lib/RT/Action
ruz at bestpractical.com
ruz at bestpractical.com
Thu Apr 13 11:59:09 EDT 2006
Author: ruz
Date: Thu Apr 13 11:59:08 2006
New Revision: 5029
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetBlockState.pm
Log:
r1298 at cubic-pc: cubic | 2006-04-13 20:06:04 +0400
* add special case for situation when DutyTeam member changes block's State from UI.
Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetBlockState.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetBlockState.pm (original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetBlockState.pm Thu Apr 13 11:59:08 2006
@@ -68,25 +68,37 @@
my $status = $t->Status;
return $state{ $status } if $state{ $status };
+ # all code below is related to open status
+
my $old_state = $t->FirstCustomFieldValue('_RTIR_State');
+ # if block was removed (resolved/rejected) we reactivate it
+ return 'active' if $old_state eq 'removed';
+
+ my $txn = $self->TransactionObj;
+ if ( $txn->Creator != $RT::System ) {
+ # if a duty team member changes Status directly then we want to do it
+ my $group = RT::Group->new( $self->CurrentUser );
+ $group->LoadUserDefinedGroup('DutyTeam');
+ $RT::Logger->error("Couldn't load 'DutyTeam' group") unless $group->id;
+ if ( $group->HasMember( $txn->CreatorObj->PrincipalObj ) ) {
+ return 'active';
+ }
+ }
if ( $old_state eq 'pending activation' ) {
+
# switch to active state if it is reply from requestor(s)
- my $txn = $self->TransactionObj;
- return '' unless $txn->Type eq 'Correspond';
- return '' unless $t->Requestors->HasMember( $txn->CreatorObj->PrincipalObj );
- return 'active';
+ return 'active' if $txn->Type eq 'Correspond'
+ && $t->Requestors->HasMember( $txn->CreatorObj->PrincipalObj );
+ return '';
} elsif ( $old_state eq 'pending removal' ) {
# switch to removed state when requestor(s) replies
# but do it via changing status!
- my $txn = $self->TransactionObj;
return '' unless $txn->Type eq 'Correspond';
return '' unless $t->Requestors->HasMember( $txn->CreatorObj->PrincipalObj );
my ($val, $msg) = $t->SetStatus( 'resolved' );
$RT::Logger->error("Couldn't change status: $msg") unless $val;
return '';
- } elsif ( $status eq 'open' && $old_state eq 'removed' ) {
- return 'active';
}
return '';
More information about the Rt-commit
mailing list