[Rt-commit] r4510 - in rtir/branches/1.9-EXPERIMENTAL: lib/RT/Action
ruz at bestpractical.com
ruz at bestpractical.com
Thu Feb 9 09:13:09 EST 2006
Author: ruz
Date: Thu Feb 9 09:13:09 2006
New Revision: 4510
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_ChangeChildOwnership.pm
Log:
r681 at cubic-pc: cubic | 2006-02-09 17:16:23 +0300
r675 at cubic-pc: cubic | 2006-02-09 16:46:24 +0300
* "my $transaction = $transaction;" - error in var init
* check in callback wether we should use take or steal action
Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_ChangeChildOwnership.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_ChangeChildOwnership.pm (original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_ChangeChildOwnership.pm Thu Feb 9 09:13:09 2006
@@ -71,29 +71,29 @@
sub Commit {
my $self = shift;
+ my $transaction = $self->TransactionObj;
- my $transaction = $transaction;
-
- my $query = "(Queue = 'Incident Reports'"
- ." OR Queue = 'Investigations'"
- ." OR Queue = 'Blocks'"
- .") AND MemberOf = " . $self->TicketObj->Id
- ." AND Owner != ". $transaction->NewValue;
- my $members = new RT::Tickets( $self->CreatorCurrentUser );
- $members->FromSQL($query);
+ my $actor = $self->CreatorCurrentUser;
my $action_cb;
- if ( $transaction->NewValue == $transaction->Creator ) {
- if ( $transaction->CurrentUser->id == $RT::Nobody->id ) {
- $action_cb = sub { return $_[0]->Take }
- } else {
- $action_cb = sub { return $_[0]->Steal }
- }
+ if ( $transaction->NewValue == $actor->id ) {
+ $action_cb = sub {
+ return $_[0]->Steal if $_[0]->Owner != $RT::Nobody->id;
+ return $_[0]->Take;
+ };
} else {
$action_cb = sub { return $_[0]->SetOwner( $transaction->NewValue ) }
}
# change owner of child Incident Reports, Investigations, Blocks
+ my $query = "(Queue = 'Incident Reports'"
+ ." OR Queue = 'Investigations'"
+ ." OR Queue = 'Blocks'"
+ .") AND MemberOf = ". $self->TicketObj->Id
+ ." AND Owner != ". $transaction->NewValue;
+ my $members = new RT::Tickets( $actor );
+ $members->FromSQL( $query );
+
while ( my $member = $members->Next ) {
my ($res, $msg) = $action_cb->( $member );
$RT::Logger->info( "Couldn't change owner: $msg" ) unless $res;
More information about the Rt-commit
mailing list