%# 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 => loc("Incident #[_1]: [_2]", $Ticket->Id, $Ticket->Subject) &> <& /RTIR/Incident/Elements/Tabs, Ticket => $Ticket, current_tab => 'RTIR/Display.html?id='.$Ticket->id, current_subtab => 'RTIR/Display.html?id='.$Ticket->id, Title => loc("Incident #[_1]: [_2]", $Ticket->Id, $Ticket->Subject) &> <& /RTIR/Elements/ListActions, actions => \@Actions &> % if ($id != 'new' && $Ticket->QueueObj->Name ne "Incidents") { <&|/l&>This ticket isn't an Incident. % $m->abort(); %}
<& /Elements/TitleBoxStart, title => loc('Incident #[_1]', $Ticket->Id), title_href =>"$RT::WebPath/RTIR/Edit.html?id=".$Ticket->Id, title_class=> 'inverse' &>
<&|/l&>Owner: <%$Ticket->OwnerObj->Name%>
<&|/l&>State: <& /RTIR/Elements/ShowRTIRField, Name => 'State', Ticket => $Ticket &>
<&|/l&>Subject: <%$Ticket->Subject %>
<&|/l&>Description: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'Description', Cols => 60 &>
<&|/l&>Priority: <%$Ticket->Priority %>
<&|/l&>Time Worked: <%loc('[_1] min', $TimeWorked)%>
<&|/l&>Constituency: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'Constituency' &>
<&|/l&>Function: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'Function' &>
<&|/l&>Classification: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'Classification' &>
<& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxStart, title => loc('Incident Reports'), title_href => "$RT::WebPath/RTIR/Incident/ShowReports.html?id=".$Ticket->Id, title_class=> 'inverse', titleright => '', color=> "#336633" &> % if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
| New | <%loc("Link")%> |
% } <& /RTIR/Elements/ShowChildren, Ticket => $Ticket, Type => 'Report', LimitDepth => 8, FullList => $RT::WebPath."/RTIR/Incident/ShowReports.html?id=".$Ticket->id &> <& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxStart, title => loc('Investigations'), title_href => "$RT::WebPath/RTIR/Incident/ShowInvestigations.html?id=".$Ticket->Id, title_class=> 'inverse', titleright => '', color=> "#336633" &> % if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
| Launch | <%loc("Link")%> |
% } <& /RTIR/Elements/ShowChildren, Ticket => $Ticket, Type => 'Investigation', LimitDepth => 8, FullList => $RT::WebPath."/RTIR/Incident/ShowInvestigations.html?id=".$Ticket->id &> <& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxStart, title => loc('Blocks'), title_href => "$RT::WebPath/RTIR/Incident/ShowBlocks.html?id=".$Ticket->Id, title_class=> 'inverse', titleright => '', color=> "#336633" &> % if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
| New | <%loc("Link")%> |
% } <& /RTIR/Elements/ShowChildren, Ticket => $Ticket, Type => 'Block', LimitDepth => 8, FullList => $RT::WebPath."/RTIR/Incident/ShowBlocks.html?id=".$Ticket->id &> <& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxStart, title => loc("Dates"), title_href =>"$RT::WebPath/RTIR/Edit.html?id=".$Ticket->Id, title_class=> 'inverse', color => "#663366" &> <& /RTIR/Elements/ShowDates, Ticket => $Ticket &> <& /Elements/TitleBoxEnd &>
<& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $attachments &> <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket, DisplayPath => "/RTIR/Display.html" &>
<& /Ticket/Elements/ShowHistory , Ticket => $Ticket, Collapsed => $ARGS{'Collapsed'}, ShowHeaders => $ARGS{'ShowHeaders'}, UpdatePath => "$RT::WebPath/RTIR/Update.html", &> <%INIT> my ($Ticket, $ChildObj, @Actions); $Ticket = new RT::Ticket($session{'CurrentUser'}); if ($ARGS{'child'}) { $ChildObj = LoadTicket($ARGS{'child'}); } if ($SelectedTicket) { $id = $SelectedTicket; $ARGS{'Status'} = "open"; } unless ($id) { Abort('No incident specified'); } my $DoLinks = sub { my $Ticket = shift; my $Target = shift; my @linkresults; my $Type = $m->scomp("/RTIR/Elements/Type", Ticket => $Ticket->Id); $ARGS{$Ticket->Id.'-MemberOf'} = $Target->Id; # Blocks can have multiple incidents my $unlinked; if ($Type ne 'Block') { while (my $link = $Ticket->MemberOf->Next) { my $member = $link->TargetObj; if ($member->QueueObj->Name eq "Incidents") { $RT::Logger->debug ("Deleting: ".$link->Target."\n"); $ARGS{'DeleteLink--'.$link->Type.'-'.$link->Target} = ''; $unlinked->{$link->Target} = $link->TargetObj; } } } # If we don't own the thing we're linking to, change the owner if ($Ticket->OwnerObj->id != $session{'CurrentUser'}->id) { if ($Ticket->OwnerObj->id == $RT::Nobody->id) { $ARGS{'Action'} = 'Take'; } else { $ARGS{'Action'} = 'Steal'; } my $action = $ARGS{'Action'}; my ($res, $msg)=$Ticket->$action(); push (@linkresults, $msg); } push @linkresults, ProcessTicketLinks(TicketObj => $Ticket, ARGSRef => \%ARGS); @linkresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @linkresults; push (@Actions, @linkresults); }; if ($id eq 'new') { # {{{ Create a new ticket my $Queue = new RT::Queue($session{'CurrentUser'}); unless ($Queue->Load($ARGS{'Queue'})) { Abort('Queue not found'); } unless ($Queue->CurrentUserHasRight('CreateTicket')) { Abort('You have no permission to create tickets in that queue.'); } ($Ticket, @Actions) = CreateTicket(Attachments => $session{'Attachments'}, %ARGS); delete $session{'Attachments'}; unless ($Ticket->CurrentUserHasRight('ShowTicket')) { Abort("No permission to view newly created ticket #".$Ticket->id."."); } $ARGS{'id'} = $Ticket->Id; # }}} if ($ChildObj) { $ARGS{'id'}=$Ticket->Id; &$DoLinks($ChildObj, $Ticket); } } else { $Ticket = LoadTicket($id); unless ($Ticket->CurrentUserHasRight('ShowTicket')) { Abort("No permission to view ticket"); } if ($ChildObj) { $ARGS{'id'}=$Ticket->Id; &$DoLinks($ChildObj, $Ticket); } if (defined $ARGS{'Action'}) { if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) { my $action = $1; my ($res, $msg)=$Ticket->$action(); push(@Actions, $msg); } } elsif ($ARGS{'BulkLink'}) { #Iterate through each ticket we've been handed my $IncidentObj = LoadTicket($id); while (my $t = $session{'tickets'}->Next) { next unless ($ARGS{"UpdateTicket".$t->Id}); &$DoLinks($t, $IncidentObj); } } my ($oldstate, $newstate); $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State'); $ARGS{'UpdateContent'} =~ s/\r\n/\n/g; chomp ($ARGS{'UpdateContent'}) ; if ($ARGS{'UpdateContent'} && $ARGS{'UpdateContent'} ne '' && $ARGS{'UpdateContent'} ne "-- \n" . $session{'CurrentUser'}->UserObj->Signature ) { $ARGS{UpdateAttachments} = $session{'Attachments'}; ProcessUpdateMessage(ARGSRef=>\%ARGS, Actions=>\@Actions, TicketObj=>$Ticket); delete $session{'Attachments'}; } #Process basics updates my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$Ticket); push (@Actions, @BasicActions); $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State'); if ($newstate ne $oldstate) { push (@Actions, loc("State changed from [_1] to [_2]", $oldstate, $newstate)); } } my $TimeWorked; if (defined $Ticket) { $TimeWorked = $Ticket->TimeWorked; if ($Ticket->TimeLeft > 0 ) { $TimeWorked = $Ticket->TimeWorked."/".$Ticket->TimeLeft; } } # If we deleted any links, check if what we deleted from still has children foreach my $arg (%ARGS) { if (substr($arg, 0, length('DeleteLink--MemberOf-')) eq 'DeleteLink--MemberOf-') { my $t = substr($arg, length('DeleteLink--MemberOf-')); my $children = new RT::Tickets ($session{'CurrentUser'}); $children->LimitQueue(VALUE => 'Incident Reports'); $children->LimitQueue(VALUE => 'Investigations'); $children->LimitQueue(VALUE => 'Blocks'); $children->LimitMemberOf($t); if ($children->Count == 0) { push (@Actions, loc("WARNING: Incident [_1] has no children.", $t)); } } } # Check if the current incident still has children my $children; $children = new RT::Tickets ($session{'CurrentUser'}); $children->LimitQueue(VALUE => 'Incident Reports'); $children->LimitQueue(VALUE => 'Investigations'); $children->LimitQueue(VALUE => 'Blocks'); $children->LimitMemberOf($Ticket->Id); if ($children->Count == 0) { push (@Actions, loc("WARNING: Incident [_1] has no children.", $Ticket->Id)); } my $attachments = $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket); <%ARGS> $id => undef $SelectedTicket => undef $child => undef