[Rt-commit] r4848 - in rtir/branches/1.9-EXPERIMENTAL: lib/RT/Action
ruz at bestpractical.com
ruz at bestpractical.com
Tue Mar 28 18:33:18 EST 2006
Author: ruz
Date: Tue Mar 28 18:33:16 2006
New Revision: 4848
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueIncident.pm
Log:
r1044 at cubic-pc: cubic | 2006-03-27 13:21:32 +0400
* we shouldn't update only the first linked incident, touch all
Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueIncident.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueIncident.pm (original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueIncident.pm Tue Mar 28 18:33:16 2006
@@ -75,18 +75,27 @@
sub Commit {
my $self = shift;
- my $incident;
- if ( $self->TransactionObj->Type eq 'DeleteLink' ) {
+ my $type = $self->TransactionObj->Type;
+ if ( $type eq 'DeleteLink' ) {
my $uri = new RT::URI( $self->CurrentUser );
$uri->FromURI( $self->TransactionObj->OldValue );
- $incident = $uri->Object;
- } else {
- my $incidents = new RT::Tickets($self->CurrentUser);
- $incidents->FromSQL("Queue = 'Incidents' AND HasMember = " . $self->TicketObj->id);
- $incidents->RowsPerPage(1);
- $incident = $incidents->First;
+ return $self->UpdateDue( $uri->Object );
}
+
+ my $incidents = new RT::Tickets($self->CurrentUser);
+ $incidents->FromSQL( "Queue = 'Incidents' AND HasMember = " . $self->TicketObj->id );
+ while ( my $incident = $incidents->Next ) {
+ $self->UpdateDue( $incident );
+ }
+
+ return 1;
+}
+
+sub UpdateDue {
+ my $self = shift;
+ my $incident = shift;
return 1 unless $incident;
+ return 1 unless $incident->QueueObj->Name eq 'Incidents';
my $query = "(Queue = 'Incident Reports'"
." OR Queue = 'Investigations'"
@@ -100,14 +109,10 @@
$children->OrderBy( FIELD => 'Due', ORDER => 'ASC' );
$children->RowsPerPage(1);
my $mostdue = $children->First;
- if ($mostdue) {
- $incident->SetDue($mostdue->DueObj->ISO);
- } else {
- $incident->SetDue(0);
- }
- return 1;
+ $incident->SetDue( $mostdue? $mostdue->DueObj->ISO: 0 );
+ return 1;
}
# }}}
More information about the Rt-commit
mailing list