[Rt-commit] [svn] r1536 - in rtir/branches/1.1-TESTING: etc
etc/upgrade/1.1.3 html/RTIR/Elements lib/RT/Action lib/RT/Condition
leira at pallas.eruditorum.org
leira at pallas.eruditorum.org
Wed Sep 22 01:22:26 EDT 2004
Author: leira
Date: Wed Sep 22 01:22:25 2004
New Revision: 1536
Added:
rtir/branches/1.1-TESTING/etc/upgrade/1.1.3/
rtir/branches/1.1-TESTING/etc/upgrade/1.1.3/content
rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueIncident.pm
rtir/branches/1.1-TESTING/lib/RT/Condition/RTIR_RequireDueChange.pm
Modified:
rtir/branches/1.1-TESTING/etc/RTIR_Config.pm
rtir/branches/1.1-TESTING/etc/initialdata
rtir/branches/1.1-TESTING/html/RTIR/Elements/DueIncidents
rtir/branches/1.1-TESTING/html/RTIR/Elements/NewReports
rtir/branches/1.1-TESTING/lib/RT/Condition/RTIR_RequireStateChange.pm
Log:
RT-Ticket: 6051
RT-Action: correspond
Added a scrip to set Incident due dates when child due dates change.
DueIncidents and NewReports now use TicketList element.
Modified: rtir/branches/1.1-TESTING/etc/RTIR_Config.pm
==============================================================================
--- rtir/branches/1.1-TESTING/etc/RTIR_Config.pm (original)
+++ rtir/branches/1.1-TESTING/etc/RTIR_Config.pm Wed Sep 22 01:22:25 2004
@@ -172,8 +172,15 @@
BulkReply => qq{___RTIR_Check__,
'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__Subject__</a></B>/Title:Subject',
- __Requestors__,__OwnerName__,__CreatedRelative__,__DueRelative__}
-}
+ __Requestors__,__OwnerName__,__CreatedRelative__,__DueRelative__},
+
+ DueIncidents => qq{'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
+ '<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__Subject__</a></B>/Title:Subject',
+ '__Owner__',
+ '__Priority__',
+ '__DueRelative__',
+ },
+},
);
1;
Modified: rtir/branches/1.1-TESTING/etc/initialdata
==============================================================================
--- rtir/branches/1.1-TESTING/etc/initialdata (original)
+++ rtir/branches/1.1-TESTING/etc/initialdata Wed Sep 22 01:22:25 2004
@@ -283,6 +283,10 @@
Description => 'Set the due date for correspondence' , # loc
ExecModule => 'RTIR_SetDueCorrespond',
},
+ { Name => 'RTIR Set Incident Due', # loc
+ Description => 'Set the due date of parent Incident' , # loc
+ ExecModule => 'RTIR_SetDueIncident',
+ },
{ Name => 'RTIR Unset Due', # loc
Description => 'Unset the due date' , # loc
ExecModule => 'RTIR_UnsetDue',
@@ -351,6 +355,11 @@
ApplicableTransTypes => 'Any',
ExecModule => 'RTIR_RequireStateChange',
},
+ { Name => 'RTIR Require Due Change', # loc
+ Description => 'The due date of the parent incident must be changed' , # loc
+ ApplicableTransTypes => 'Any',
+ ExecModule => 'RTIR_RequireDueChange',
+ },
);
@@ -478,6 +487,23 @@
ScripCondition => 'RTIR Require State Change',
ScripAction => 'RTIR Set Incident State',
Template => 'Blank', },
+
+ { Description => "SetRTIRState",
+ Queue => 'Incident Reports',
+ ScripCondition => 'RTIR Require Due Change',
+ ScripAction => 'RTIR Set Incident Due',
+ Template => 'Blank', },
+ { Description => "SetRTIRState",
+ Queue => 'Investigations',
+ ScripCondition => 'RTIR Require Due Change',
+ ScripAction => 'RTIR Set Incident Due',
+ Template => 'Blank', },
+ { Description => "SetRTIRState",
+ Queue => 'Blocks',
+ ScripCondition => 'RTIR Require Due Change',
+ ScripAction => 'RTIR Set Incident Due',
+ Template => 'Blank', },
+
{ Description => "ResolveAllChildren",
Queue => 'Incidents',
ScripCondition => 'On Status Change',
Added: rtir/branches/1.1-TESTING/etc/upgrade/1.1.3/content
==============================================================================
--- (empty file)
+++ rtir/branches/1.1-TESTING/etc/upgrade/1.1.3/content Wed Sep 22 01:22:25 2004
@@ -0,0 +1,36 @@
+ at ScripActions = (
+
+ { Name => 'RTIR Set Incident Due', # loc
+ Description => 'Set the due date of parent Incident' , # loc
+ ExecModule => 'RTIR_SetDueIncident',
+ },
+
+);
+
+ at ScripConditions = (
+
+ { Name => 'RTIR Require Due Change', # loc
+ Description => 'A ticket requires a state change' , # loc
+ ApplicableTransTypes => 'Any',
+ ExecModule => 'RTIR_RequireDueChange',
+ },
+
+);
+
+ at Scrips = (
+ { Description => "SetRTIRState",
+ Queue => 'Incident Reports',
+ ScripCondition => 'RTIR Require Due Change',
+ ScripAction => 'RTIR Set Incident Due',
+ Template => 'Blank', },
+ { Description => "SetRTIRState",
+ Queue => 'Investigations',
+ ScripCondition => 'RTIR Require Due Change',
+ ScripAction => 'RTIR Set Incident Due',
+ Template => 'Blank', },
+ { Description => "SetRTIRState",
+ Queue => 'Blocks',
+ ScripCondition => 'RTIR Require Due Change',
+ ScripAction => 'RTIR Set Incident Due',
+ Template => 'Blank', },
+);
Modified: rtir/branches/1.1-TESTING/html/RTIR/Elements/DueIncidents
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Elements/DueIncidents (original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Elements/DueIncidents Wed Sep 22 01:22:25 2004
@@ -23,115 +23,43 @@
%#
%# END LICENSE BLOCK
<& /Elements/TitleBoxStart, title => $title, bodyclass=> '' &>
-<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
-<TR>
-<TH ALIGN=RIGHT><&|/l&>#</&></TH>
-<TH ALIGN=LEFT><&|/l&>Subject</&></TH>
-<TH ALIGN=LEFT><&|/l&>Owner</&></TH>
-<TH ALIGN=LEFT><&|/l&>Priority</&></TH>
-<TH ALIGN=LEFT><&|/l&>Due</&></TH>
-<TH ALIGN=LEFT> </TH>
-</TR>
- <TR>
-% my $i;
-% foreach my $entry (sort(keys(%most_due))) {
-% my $tickethash = $most_due{$entry};
-% foreach my $item (sort(keys(%$tickethash))) {
-% my $Ticket = $tickethash->{$item}->{ticket};
-% my $due = $tickethash->{$item}->{due};
-<TR class="<% $i++%2 ? 'oddline' : 'evenline'%>" >
-<TD ALIGN=RIGHT>
-<A HREF="<% $RT::WebPath %>/RTIR/Display.html?id=<%$Ticket->Id%>">
-<%$Ticket->Id%>
-</a>
-</TD>
-<TD>
-<A HREF="<% $RT::WebPath %>/RTIR/Display.html?id=<%$Ticket->Id%>">
-<%$Ticket->Subject || loc('(no subject)')%>
-</A>
-</TD>
-<TD>
-<%$Ticket->OwnerObj->Name%>
-</TD>
-<TD>
-<%$Ticket->Priority%>
-</TD>
-<TD>
-<& ShowDate, date => $due &>
-</TD>
-<TD ALIGN=RIGHT>
-% if ($Ticket->Owner != $session{CurrentUser}->id) {
-% if ($Ticket->Owner == $RT::Nobody->Id) {
-[<A HREF="<% $RT::WebPath %>/RTIR/Display.html?Action=Take&id=<%$Ticket->Id%>"><&|/l&>Take</&></A>]
-% } else {
-[<A HREF="<% $RT::WebPath %>/RTIR/Display.html?Action=Steal&id=<%$Ticket->Id%>"><&|/l&>Steal</&></A>]
-% }
-% } else {
-
-% }
-</TD>
-</TR>
-% }
-% }
-</TABLE>
-<& /Elements/TitleBoxEnd &>
+<& /RTIR/Search/Elements/ShowResults,
+ Query => $Query,
+ QueryString => $QueryString,
+ Format => $Format,
+ Rows => 10,
+&>
+
+<& /Elements/TitleBoxEnd &>
<%INIT>
-my $MyTickets;
-$MyTickets = new RT::Tickets ($session{'CurrentUser'});
-$MyTickets->LimitQueue(VALUE => 'Incidents');
+$Format = $RT::RTIRSearchResultFormats->{'DueIncidents'};
+
+my $Query = "Queue = 'Incidents'";
+
if ($owner) {
- $MyTickets->LimitOwner(VALUE => $owner->id);
- $MyTickets->LimitOwner(VALUE => $RT::Nobody->id);
-}
-#my $date = ParseDateToISO("0");
-#$MyTickets->LimitDue(VALUE => $date, OPERATOR => ">");
-$MyTickets->LimitStatus(VALUE => "new");
-$MyTickets->LimitStatus(VALUE => "open");
-$MyTickets->LimitStatus(VALUE => "stalled");
-$MyTickets->OrderBy(FIELD => 'Due', ORDER => 'ASC');
-
-my %most_due;
-
-my ($incidents, $seen);
-my $c = 0;
-while (my $Ticket = $MyTickets->Next) {
- my $kids = RT::Tickets->new($session{'CurrentUser'});
- $kids->LimitMemberOf($Ticket->Id);
- $kids->LimitQueue(VALUE =>'Incident Reports');
- $kids->LimitQueue(VALUE =>'Investigations');
- $kids->LimitQueue(VALUE =>'Blocks');
- # Make sure the child actually has a due date set
- $kids->LimitDue(OPERATOR => ">", VALUE => -1);
- $kids->RowsPerPage(1);
- $kids->OrderBy( FIELD => 'Due', ORDER => 'ASC');
- my $due = $Ticket->DueObj;
-
- while (my $kid = $kids->Next) {
- if ($kid->DueObj->Unix > $Ticket->DueObj->Unix) {
- $due = $kid->DueObj;
- }
- }
- my $tickethash = {};
- if ($most_due{$due->Unix}) {
- $tickethash = $most_due{$due->Unix};
- }
- $tickethash->{$Ticket->Id} = { due => $due, ticket => $Ticket };
- $most_due{$due->Unix} = $tickethash;
+ $Query .= " AND (Owner = " . $owner->id . " OR Owner = 'Nobody')";
}
+$Query .= " AND " .
+ $m->comp('/RTIR/Elements/NewQuery',
+ Queue => 'Incidents',
+ states => [ 'new', 'open', 'stalled' ]);
my $title;
if ($owner) {
- $title = loc("Most due incidents owned by [_2] (and unowned)...",
- $MyTickets->Count, $owner->Name);
+ $title = loc("Most due incidents owned by [_1] (and unowned)...",
+ $owner->Name);
} else {
- $title = loc("Most due incidents...", $MyTickets->Count);
+ $title = loc("Most due incidents...");
}
</%INIT>
<%ARGS>
$rows => 10
$owner => undef
+$OrderBy => undef
+$Format => undef
+$QueryString => undef
</%ARGS>
Modified: rtir/branches/1.1-TESTING/html/RTIR/Elements/NewReports
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Elements/NewReports (original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Elements/NewReports Wed Sep 22 01:22:25 2004
@@ -25,64 +25,27 @@
<& /Elements/TitleBoxStart,
title_href =>"$RT::WebPath/RTIR/Search/Results.html?Queue=$Queue$QueryString",
title_class=> 'inverse',
- title => loc("[_1] of [_2] new unlinked Incident Reports...", $num, $MyTickets->Count), bodyclass=> '' &>
-<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
-<TR>
-<TH ALIGN=RIGHT><&|/l&>#</&></TH>
-<TH ALIGN=LEFT><&|/l&>Subject</&></TH>
-<TH ALIGN=LEFT><&|/l&>From</&></TH>
-<TH ALIGN=LEFT><&|/l&>Owner</&></TH>
-<TH ALIGN=LEFT><&|/l&>Due</&></TH>
-<TH ALIGN=LEFT> </TH>
-</TR>
- <TR>
-% my $i;
-% while (my $Ticket = $MyTickets->Next) {
-% next if $Ticket->HasUnresolvedDependencies( Type => 'approval' );
-% last if $i++ >= $rows;
-<TR class="<% $i%2 ? 'oddline' : 'evenline'%>" >
-<TD ALIGN=RIGHT>
-<A HREF="<% $RT::WebPath %>/RTIR/Display.html?id=<%$Ticket->Id%>">
-<%$Ticket->Id%>
-</A>
-</TD>
-<TD>
-<A HREF="<% $RT::WebPath %>/RTIR/Display.html?id=<%$Ticket->Id%>">
-<%$Ticket->Subject || loc('(no subject)')%>
-</A>
-</TD>
-<TD>
-<%$Ticket->RequestorAddresses%>
-</TD>
-<TD>
-<%$Ticket->OwnerObj->Name%>
-</TD>
-<TD>
-<& ShowDate, date => $Ticket->DueObj &>
-</TD>
-<TD ALIGN=RIGHT>
-% if ($Ticket->Owner == $session{CurrentUser}->id) {
-[<A HREF="<% $RT::WebPath %>/RTIR/Incident/LinkToIncident.html?ClearRestrictions=1&id=<%$Ticket->Id%>"><&|/l&>Link</&></A>]
-[<A HREF="<% $RT::WebPath %>/RTIR/Update.html?id=<%$Ticket->Id%>"><&|/l&>Update</&></A>]
-% } elsif ($Ticket->Owner == $RT::Nobody->Id) {
-[<A HREF="<% $RT::WebPath %>/RTIR/Display.html?Action=Take&id=<%$Ticket->Id%>"><&|/l&>Take</&></A>]
-% } else {
-[<A HREF="<% $RT::WebPath %>/RTIR/Display.html?Action=Steal&id=<%$Ticket->Id%>"><&|/l&>Steal</&></A>]
-% }
-</TD>
-</TR>
-% }
-</TABLE>
+ title => $title,
+ bodyclass=> '' &>
+
+<& /RTIR/Search/Elements/ShowResults,
+ Query => $Query,
+ QueryString => $QueryString,
+ Format => $Format,
+ Rows => 10,
+&>
+
<a href="<%$RT::WebPath%>/RTIR/Report/BulkReject.html?ClearRestrictions=1">[<%loc("Bulk Reject")%>]</a>
<& /Elements/TitleBoxEnd &>
<%INIT>
-my $Query;
-if (!$Query) {
- $Query .= "'CF.$Queue.{_RTIR_State}' = 'new'";
-}
+$Format = $RT::RTIRSearchResultFormats->{'DueIncidents'};
+
+$Query = $m->comp('/RTIR/Elements/NewQuery',
+ Queue => $Queue,
+ states => [ 'new' ]);
my $QueryString = "&".$m->comp('/Elements/QueryString',
Query => $Query,
@@ -92,22 +55,19 @@
Order => $Order,
Page => $Page);
-my $MyTickets;
-my $rows = 10;
-$MyTickets = new RT::Tickets ($session{'CurrentUser'});
-$MyTickets->FromSQL("Queue = '$Queue' AND ($Query)");
-$MyTickets->RowsPerPage($rows);
-
-my $num;
-if ($MyTickets->Count < $rows) {
- $num = $MyTickets->Count;
-} else {
- $num = $rows;
+if (!$BaseQuery) {
+ $BaseQuery = $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
}
+$Query = "$BaseQuery AND ( $Query )";
+
+my $title = loc("New unlinked Incident Reports...");
+
</%INIT>
<%ARGS>
+$Query => undef
+$BaseQuery => undef
$Queue => 'Incident Reports'
$Format => undef
$HideResults => 0
Added: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueIncident.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueIncident.pm Wed Sep 22 01:22:25 2004
@@ -0,0 +1,109 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+#
+# COPYRIGHT:
+#
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
+# <jesse at bestpractical.com>
+#
+# (Except where explicitly superseded by other copyright notices)
+#
+#
+# LICENSE:
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#
+# CONTRIBUTION SUBMISSION POLICY:
+#
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+#
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+#
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetDueIncident;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+ my $self = shift;
+
+ return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Set the Due date based on the most due child.
+
+=cut
+
+sub Commit {
+ my $self = shift;
+
+ my $incident;
+ if ($self->TransactionObj->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);
+
+ $incident = $incidents->First;
+ }
+
+ if ($incident) {
+ my $children = new RT::Tickets($self->CurrentUser);
+ $children->FromSQL("(Queue = 'Incident Reports' OR Queue = 'Investigations' OR Queue = 'Blocks') AND (Status = 'new' OR Status = 'open') AND MemberOf = " . $incident->Id);
+ $children->OrderBy(FIELD => 'Due', ORDER => 'ASC');
+
+ my $mostdue = $children->First();
+ if ($mostdue) {
+ $incident->SetDue($mostdue->DueObj->ISO);
+ } else {
+ $incident->SetDue(0);
+ }
+ }
+
+ return 1;
+
+}
+
+# }}}
+
+1;
Added: rtir/branches/1.1-TESTING/lib/RT/Condition/RTIR_RequireDueChange.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1-TESTING/lib/RT/Condition/RTIR_RequireDueChange.pm Wed Sep 22 01:22:25 2004
@@ -0,0 +1,82 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+#
+# COPYRIGHT:
+#
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
+# <jesse at bestpractical.com>
+#
+# (Except where explicitly superseded by other copyright notices)
+#
+#
+# LICENSE:
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#
+# CONTRIBUTION SUBMISSION POLICY:
+#
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+#
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+#
+# }}} END BPS TAGGED BLOCK
+
+
+
+package RT::Condition::RTIR_RequireDueChange;
+require RT::Condition::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Condition::Generic);
+
+
+=head2 IsApplicable
+
+If a child had a Due Date change or changes parents.
+
+=cut
+
+sub IsApplicable {
+ my $self = shift;
+
+ if ($self->TransactionObj->Type eq 'DeleteLink' ||
+ $self->TransactionObj->Type eq "AddLink" ||
+ ($self->TransactionObj->Type eq "Set" and
+ $self->TransactionObj->Field eq "Due")) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+eval "require RT::Condition::RTIR_RequireDueChange_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/RTIR_RequireDueChange_Vendor.pm});
+eval "require RT::Condition::RTIR_RequireDueChange_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/RTIR_RequireDueChange_Local.pm});
+
+1;
+
Modified: rtir/branches/1.1-TESTING/lib/RT/Condition/RTIR_RequireStateChange.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Condition/RTIR_RequireStateChange.pm (original)
+++ rtir/branches/1.1-TESTING/lib/RT/Condition/RTIR_RequireStateChange.pm Wed Sep 22 01:22:25 2004
@@ -66,6 +66,8 @@
if ($self->TransactionObj->Type eq "Status" or
($self->TransactionObj->Type eq "Set" and
$self->TransactionObj->Field eq "Status") or
+ ($self->TransactionObj->Type eq "AddLink" and
+ $self->TransactionObj->Field eq "MemberOf") or
$self->TransactionObj->Type eq "Create" or
$self->TransactionObj->Type eq "CustomField" or
($self->TransactionObj->Type eq "Set" and
More information about the Rt-commit
mailing list