[Rt-commit] r4236 - in rtir/branches/1.9-EXPERIMENTAL: .
lib/RT/Action
ruz at bestpractical.com
ruz at bestpractical.com
Sun Dec 4 19:07:09 EST 2005
Author: ruz
Date: Sun Dec 4 19:07:08 2005
New Revision: 4236
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_ChangeParentOwnership.pm
Log:
r415 at cubic-pc: cubic | 2005-12-05 03:09:07 +0300
r394 at cubic-pc: cubic | 2005-12-04 12:04:33 +0300
* switch to the CreatorCurrentUser method
* move condition to the SQL
* log errors
Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_ChangeParentOwnership.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_ChangeParentOwnership.pm (original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_ChangeParentOwnership.pm Sun Dec 4 19:07:08 2005
@@ -73,23 +73,20 @@
my $self = shift;
# change owner of parent Incident(s)
- my $query = "Queue = 'Incidents' AND HasMember = " . $self->TicketObj->Id;
-
- my $parents = new RT::Tickets($self->TransactionObj->CurrentUser);
+ my $query = "Queue = 'Incidents'".
+ ."AND HasMember = " . $self->TicketObj->Id
+ ."AND Owner != ". $self->TransactionObj->NewValue;
+ my $parents = new RT::Tickets( $self->CreatorCurrentUser );
$parents->FromSQL($query);
- while (my $incident = $parents->Next) {
- if ( $incident->Owner != $self->TransactionObj->NewValue) {
- my ($res, $msg);
- my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
- $user->Load($self->TransactionObj->Creator);
- my $t = new RT::Ticket($user);
- $t->Load($incident->id);
- if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
- ($res, $msg) = $t->Steal();
- } else {
- ($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
- }
- }
+
+ while ( my $incident = $parents->Next ) {
+ my ($res, $msg);
+ if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
+ ($res, $msg) = $incident->Steal;
+ } else {
+ ($res, $msg) = $incident->SetOwner($self->TransactionObj->NewValue);
+ }
+ $RT::Logger->info("Couldn't set owner: $msg") unless $res;
}
return 1;
}
More information about the Rt-commit
mailing list