%# 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='.$id, Title => $Title &> <& /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_class=> 'inverse' &> <& '/RTIR/'.$Type.'/Elements/ShowBasics', Ticket => $Ticket &> <& /Ticket/Elements/ShowCustomFields, Ticket => $Ticket &> <& /Elements/TitleBoxEnd &>

<& /Elements/TitleBoxStart, title => loc('People'), title_class=> 'inverse' &> <& /RTIR/Incident/Elements/ShowPeople, Ticket => $Ticket &> <& /Elements/TitleBoxEnd &>

<& /Elements/TitleBoxStart, title => loc("Dates"), title_class=> 'inverse', color => "#663366" &> <& /RTIR/Incident/Elements/ShowDates, Ticket => $Ticket &> <& /Elements/TitleBoxEnd &>
<& /Ticket/Elements/ShowAttachments, Ticket => $Ticket &> <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket, DisplayPath => '/RTIR/Display.html' &>
<& /RTIR/Elements/ShowHistory , Ticket => $Ticket, Collapsed => $ARGS{'Collapsed'}, ShowHeaders => $ARGS{'ShowHeaders'} &> <%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; # if this is our first response, set Started if ($Ticket->StartedObj->Unix <= 0) { $ARGS{'Started_Date'} = $date->ISO; } $date->AddDays($RT::overdueafter); $ARGS{'Due_Date'} = $date->ISO; } } #Process basics updates 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); } unless ($id) { Abort('No incident specified'); } $Type = $m->scomp('Elements/Type', Ticket => $Ticket->Id); $Type =~ s/\s+$//; if ($Type eq 'Report') { $name = "Incident Report"; } else { $name = $Type; } my $Title = loc("[_1] #[_2]: [_3]", $name, $Ticket->Id, $Ticket->Subject); <%ARGS> $id => undef $Queue=>undef