[Rt-commit] r6078 - in RT-Extension-TicketAging: . etc
ruz at bestpractical.com
ruz at bestpractical.com
Thu Sep 28 00:19:05 EDT 2006
Author: ruz
Date: Thu Sep 28 00:19:04 2006
New Revision: 6078
Added:
RT-Extension-TicketAging/lib/RT/Action/
RT-Extension-TicketAging/lib/RT/Action/TicketAgingActivate.pm
Modified:
RT-Extension-TicketAging/MANIFEST
RT-Extension-TicketAging/etc/initialdata
Log:
* add re-activation via scrip
Modified: RT-Extension-TicketAging/MANIFEST
==============================================================================
--- RT-Extension-TicketAging/MANIFEST (original)
+++ RT-Extension-TicketAging/MANIFEST Thu Sep 28 00:19:04 2006
@@ -13,6 +13,7 @@
inc/Module/Install/Substitute.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
+lib/RT/Action/TicketAgingActivate.pm
lib/RT/Extension/TicketAging.pm
Makefile.PL
MANIFEST This list of files
Modified: RT-Extension-TicketAging/etc/initialdata
==============================================================================
--- RT-Extension-TicketAging/etc/initialdata (original)
+++ RT-Extension-TicketAging/etc/initialdata Thu Sep 28 00:19:04 2006
@@ -18,4 +18,20 @@
},
);
+ at ScripActions = (
+ { Name => 'TicketAging - Activate', # loc
+ Description => 'Set age to active on the ticket and all its dependencies', # loc
+ ExecModule => 'TicketAgingActivate',
+ Argument => 'Requestor' },
+);
+
+ at Scrips = (
+ { Description => 'Set the Age to active',
+ ScripCondition => 'On Reopen',
+ ScripAction => 'TicketAging - Activate',
+ Template => 'Blank'
+ },
+);
+
+
1;
Added: RT-Extension-TicketAging/lib/RT/Action/TicketAgingActivate.pm
==============================================================================
--- (empty file)
+++ RT-Extension-TicketAging/lib/RT/Action/TicketAgingActivate.pm Thu Sep 28 00:19:04 2006
@@ -0,0 +1,41 @@
+package RT::Action::TicketAgingActivate;
+
+use strict;
+use warnings;
+
+use base qw(RT::Action::Generic);
+
+sub Prepare { return 1 }
+
+sub Commit {
+ my $self = shift;
+
+ my $ticket = $self->TicketObj;
+ $self->Activate( $ticket );
+
+ my $id = $ticket->id;
+ foreach my $type ( qw(MemberOf DependsOn HasMember DependedOnBy) ) {
+ my $query = "CF.{Age} != 'Active' AND $type = $id";
+ my $tickets = RT::Tickets->new( $RT::SystemUser );
+ $tickets->FromSQL( $query );
+ while ( my $t = $tickets->Next ) {
+ $self->Activate( $t );
+ }
+ }
+ return 1;
+}
+
+sub Activate {
+ my $self = shift;
+ my $ticket = shift;
+ my ($status, $msg) = $ticket->AddCustomFieldValue(
+ Field => 'Age',
+ Value => 'Active',
+ RecordTransaction => 0,
+ );
+ $RT::Logger->warning("Couldn't set age to active: $msg")
+ unless $status;
+}
+
+1;
+
More information about the Rt-commit
mailing list