%# BEGIN LICENSE BLOCK %# %# Copyright (c) 1996-2002 Jesse Vincent %# %# (Except where explictly superceded by other copyright notices) %# %# 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. %# %# %# Unless otherwise specified, all modifications, corrections or %# extensions to this work which alter its source code become the %# property of Best Practical Solutions, LLC when submitted for %# inclusion in the work. %# %# %# END LICENSE BLOCK <& /RTIR/Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &> <& /Elements/Tabs &> % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $IncidentObj); <& /Elements/ListActions, actions => \@results &>
<& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &>

<&|/l&>Reporters

<& /RTIR/Search/Elements/ShowResults, Queue => 'Incident Reports', BaseURL => $BaseURL, BaseQuery => RT::IR->Query(Queue => 'Incident Reports', MemberOf => $id), Query => $Query, DisplayFormat => "__CheckBox.{SelectedReports}__, $Format", Format => $Format, Rows => $Rows, Page => $Page, OrderBy => $OrderBy, Order => $Order, &> % if ( $All ) {

<&|/l&>Investigation Correspondents

<& /RTIR/Search/Elements/ShowResults, Queue => 'Investigations', BaseURL => $BaseURL, BaseQuery => RT::IR->Query(Queue => 'Investigations', MemberOf => $id), Query => $Query, DisplayFormat => "__CheckBox.{SelectedInvestigations}__, $Format", Format => $Format, Rows => $Rows, Page => $Page, OrderBy => $OrderBy, Order => $Order, &> % unless( RT->Config->Get('RTIR_DisableBlocksQueue') ) {

<&|/l&>Blocks Correspondents

<& /RTIR/Search/Elements/ShowResults, Queue => 'Investigations', BaseURL => $BaseURL, BaseQuery => RT::IR->Query(Queue => 'Blocks', MemberOf => $id), Query => $Query, DisplayFormat => "__CheckBox.{SelectedBlocks}__, $Format", Format => $Format, Rows => $Rows, Page => $Page, OrderBy => $OrderBy, Order => $Order, &> % } % } % unless ( $candidates ) {

Warning: no recipients!

% } <& ../Elements/ReplyForm, %ARGS, TicketObj => $IncidentObj, Status => $Status, GnuPGWidget => $gnupg_widget, &> <& /Elements/Submit, Name => "SubmitTicket", Label => loc("Update Incident") &>
<%INIT> my (@results); my $IncidentObj = LoadTicket( $id ); $id = $ARGS{'id'} = $IncidentObj->id; $m->callback( %ARGS, CallbackName => 'Initial', Ticket => $IncidentObj ); $Status = '' if $Status && $Status eq $IncidentObj->Status; $m->comp( '/RTIR/Create.html:ProcessAttachments', %ARGS ); my $checks_failure = 0; my $gnupg_widget = $m->comp('/Elements/GnuPG/SignEncryptWidget:new', Arguments => \%ARGS ); $m->comp( '/Elements/GnuPG/SignEncryptWidget:Process', self => $gnupg_widget, QueueObj => $IncidentObj->QueueObj, ); my @selected_children; foreach my $id( @SelectedReports, @SelectedInvestigations, @SelectedBlocks ) { my $ticket = RT::Ticket->new( $session{'CurrentUser'} ); $ticket->Load( $id ); unless( $ticket->id ) { push @results, loc( "Ticket [_1]: Couldn't load ticket.", $id ); next; } push @selected_children, $ticket; } if ( $SubmitTicket && $gnupg_widget ) { foreach my $Ticket ( @selected_children ) { my $status = $m->comp('/Elements/GnuPG/SignEncryptWidget:Check', self => $gnupg_widget, TicketObj => $Ticket, ); $checks_failure = 1 unless $status; } } if ( $SubmitTicket && !$checks_failure ) { $ARGS{'UpdateAttachments'} = delete $session{'Attachments'}; my $incident_cycle = $IncidentObj->QueueObj->Lifecycle; foreach my $Ticket ( @selected_children ) { my $id = $Ticket->id; push @results, map { loc("Ticket [_1]: [_2]", $id, $_) } ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%ARGS ); my %additional = ( Status => RT::IR->MapStatus( $Status, $incident_cycle => $Ticket ), ); unless ( RT::IR->IsLinkedToActiveIncidents( $Ticket, $IncidentObj ) ) { push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => { %ARGS, %additional }, ); } } my $update_incident_state = 1; if ( $Status && $incident_cycle->IsInactive( $Status ) ) { # if we are going to resolve/reject incident then do it only when we've # rejected all children that are not linked to another active incident(s) $update_incident_state = 0 if RT::IR->IncidentHasActiveChildren( $IncidentObj ); } if ( $update_incident_state ) { push @results, ProcessObjectCustomFieldUpdates( Object => $IncidentObj, ARGSRef => \%ARGS ); push @results, ProcessTicketBasics( TicketObj => $IncidentObj, ARGSRef => { %ARGS, Status => $Status }, ); } else { push @results, loc("Status of the Incident left unchanged; not all children were updated"); } my $pass = {}; $m->callback( CallbackName => 'BeforeDisplay', ARGSRef => \%ARGS, PassArguments => $pass, Ticket => $IncidentObj ); MaybeRedirectForResults( Actions => \@results, Path => "/RTIR/Incident/Display.html", Arguments => { %$pass, id => $id }, ); } # XXX, BLOODY-DIRTY-EVIL HACK: when we load the page first time we should # select all children by default, but we have no way to do that right now # without something like this foreach (qw(SelectedReports SelectedInvestigations SelectedBlocks)) { if ( !exists $ARGS{ $_ } && !exists $ARGS{ $_ .'All'} ) { push @{ $m->{'request_args'} }, $_ .'All' => 1; } } my $title; if ($Status eq 'resolved') { $title = loc("Resolve Incident #[_1] (including children)", $id); } elsif ($Status eq 'abandoned') { $title = loc("Abandon Incident #[_1] (including children)", $id); } else { if ($All) { $title = loc("Incident #[_1]: Reply to All", $id); } else { $title = loc("Incident #[_1]: Reply to Reporters", $id); } } my @queues = ('Incident Reports'); push @queues, 'Investigations' if $All; push @queues, 'Blocks' unless RT->Config->Get('RTIR_DisableBlocksQueue'); $Query ||= RT::IR->ActiveQuery( Queue => \@queues ); my $BaseURL = "RTIR/Incident/Reply/?". $m->comp('/Elements/QueryString', id => $id, All => $All, Status => $Status, Action => $Action, ); my $candidates = RT::IR->IncidentChildren( $IncidentObj, Queue => \@queues )->Count; <%ARGS> $id => undef $All => 0 $Status => '' $Action => 'Correspond' $Query => '' $Format => RT->Config->Get('RTIRSearchResultFormats')->{'BulkReply'} $Rows => 0 $Page => 1 $OrderBy => 'id' $Order => 'ASC' @SelectedReports => () @SelectedInvestigations => () @SelectedBlocks => () $SubmitTicket => 0