%# BEGIN LICENSE BLOCK %# %# Copyright (c) 1996-2003 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 &> <& "/RTIR/".$Type."/Elements/Tabs", Ticket => $Ticket, current_tab => 'RTIR/Display.html?id='.$Ticket->id, current_subtab => 'RTIR/Display.html?id='.$Ticket->id, Title => $Title &> <& /RTIR/Elements/ListActions, actions => \@Actions &> % if ($id != 'new' && $Ticket->QueueObj->Name ne $QueueObj->Name) { <%loc("This ticket isn't a [_1].", $Type)%> % $m->abort(); % }
<& /Elements/TitleBoxStart, title => loc("The Basics"), title_href =>"$RT::WebPath/RTIR/Edit.html?id=".$Ticket->Id, title_class=> 'inverse' &> % if ($Type eq 'Report') { % } elsif ($Type eq "Block") { % }
<%loc("State")%>: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'State' &>
<%loc("Incident")%>: <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket &>
<&|/l&>Time Worked: <%loc('[_1] min', $TimeWorked)%>
<%loc("How Reported")%>: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'HowReported' &>
<%loc("Reporter Type")%>: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'ReporterType' &>
<&|/l&>SLA: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'SLA' &>
<&|/l&>IP Address: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'IP' &>
<&|/l&>Netmask: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'Netmask' &>
<&|/l&>Port: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'Port' &>
<&|/l&>Where Blocked: <& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'WhereBlocked' &>
<& /Ticket/Elements/ShowCustomFields, Ticket => $Ticket &> <& /Elements/TitleBoxEnd &>

<& /Elements/TitleBoxStart, title => loc('People'), title_href =>"$RT::WebPath/RTIR/Edit.html?id=".$Ticket->Id, title_class=> 'inverse' &> <& /RTIR/Elements/ShowPeople, Ticket => $Ticket &> <& /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 (@Actions, $Type, $name); my $Ticket = new RT::Ticket($session{'CurrentUser'}); my $QueueObj = new RT::Queue($session{'CurrentUser'}); if ($id ne 'new') { $Ticket = LoadTicket($id); unless ($Ticket->CurrentUserHasRight('ShowTicket')) { Abort("No permission to view ticket"); } $QueueObj->Load($Ticket->QueueObj->Name) || Abort(loc("Queue could not be loaded.")); } else { $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded.")); } # Incidents have their own Create.html if ($QueueObj->Name eq 'Incidents') { $m->comp("/RTIR/Incident/Display.html", %ARGS); $m->abort; } if ($ARGS{'id'} eq 'new') { # {{{ Create a new ticket unless ($QueueObj->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; } # }}} } else { $Ticket = LoadTicket($ARGS{'id'}); unless ($Ticket->CurrentUserHasRight('ShowTicket')) { Abort("No permission to view ticket"); } $ARGS{'UpdateContent'} =~ s/\r\n/\n/g; chomp ($ARGS{'UpdateContent'}) ; my @UpdateActions; if ($ARGS{'UpdateContent'} && $ARGS{'UpdateContent'} ne '' && $ARGS{'UpdateContent'} ne "-- \n" . $session{'CurrentUser'}->UserObj->Signature ) { $ARGS{UpdateAttachments} = $session{'Attachments'}; ProcessUpdateMessage(ARGSRef=>\%ARGS, Actions=>\@UpdateActions, TicketObj=>$Ticket); delete $session{'Attachments'}; } if (defined $ARGS{'Action'}) { if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) { my $action = $1; my ($res, $msg)=$Ticket->$action(); push(@Actions, $msg); } elsif ($ARGS{'Action'} eq 'Respond' && @UpdateActions) { my $date = RT::Date->new($RT::SystemUser); $date->SetToNow; $date->AddDays($RT::OverdueAfter); use Business::Hours; my $bizhours = new Business::Hours; if ($RT::BusinessHours) { $bizhours->business_hours(%$RT::BusinessHours); } my $due = $bizhours->first_after($date->Unix); $date->Set(Format => 'unix', Value => $due); $ARGS{'Due_Date'} = $date->AsString; } } #Process basics updates my ($oldstate, $newstate); $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State'); my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$Ticket); my @LinkActions = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); my @DateActions = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS); push (@Actions, @UpdateActions, @BasicActions, @LinkActions, @DateActions); $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State'); if ($newstate ne $oldstate) { push (@Actions, loc("State changed from [_1] to [_2]", $oldstate, $newstate)); } } unless ($id) { Abort('No incident specified'); } ($Type, undef) = $m->comp('Elements/Type', Ticket => $Ticket->Id); if ($Type eq 'Report') { $name = "Incident Report"; } else { $name = $Type; } my $Title = loc("[_1] #[_2]: [_3]", $name, $Ticket->Id, $Ticket->Subject); my $TimeWorked = $Ticket->TimeWorked; if ($Ticket->TimeLeft > 0 ) { $TimeWorked = $Ticket->TimeWorked."/".$Ticket->TimeLeft; } my $attachments = $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket); <%ARGS> $id => undef $Queue=>undef