%# 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/Incident/Elements/Tabs, current_tab => $current_tab, current_subtab => $current_subtab, Title => $Title, Ticket => $TicketObj &> <& /Elements/ListActions, actions => \@results &> <%PERL> if ( $TicketObj && !$TicketObj->CurrentUserHasRight('ModifyTicket') ) { $m->out( loc('You are not allowed to split from #[_2].', $TicketObj->id ) ); return; } if ( $ChildObj && !$ChildObj->CurrentUserHasRight('ModifyTicket') ) { $m->out( loc('You are not allowed to link with #[_2].', $ChildObj->id ) ); return; } % if ( $TicketObj ) {
% } else { % } % if ( $ChildObj ) { % } % if ( $TicketObj ) { % } <&| /Widgets/TitleBox, title => $Title &> % if ( $TicketObj ) { % my $Type = RT::IR::TicketType( Ticket => $TicketObj ); % } % if ( $ChildObj ) { % my $Type = RT::IR::TicketType( Ticket => $ChildObj ); % } % if ( $ChildObj ) { % } else { % } <& Elements/Create, Title => $Title, TicketObj => $TicketObj, QueueObj => $QueueObj, ChildObj => $ChildObj, %ARGS &>
<% loc('Split from') %>: <% loc("[_1] #[_2]: [_3]", $Type, $TicketObj->Id, $TicketObj->Subject) %>
<% loc('Link with') %>: <% loc("[_1] #[_2]: [_3]", $Type, $ChildObj->Id, $ChildObj->Subject) %>
<&|/l&>Owner: <% $ChildObj->OwnerObj->Name %> <& /Elements/SelectOwner, Name => 'Owner', QueueObj => $QueueObj, Default => $ARGS{'Owner'} || $session{'CurrentUser'}->Id &>
<&|/l&>Message: <%PERL> unless ( exists $ARGS{'Content'} ) { my $Transactions; if ( $TicketObj ) { $Transactions = $TicketObj->Transactions; } elsif ( $ChildObj ) { $Transactions = $ChildObj->Transactions; } if ( $Transactions ) { $ARGS{'Content'} = $m->scomp("/RTIR/Elements/TransactionData", Transactions => $Transactions, Type => 'messages', Include => ['Create', 'Correspond'], ) || ''; $ARGS{'Content'} =~ s/\>/>/g; } } <& /Elements/MessageBox, Default => $ARGS{'Content'} &>
  <&| /Widgets/TitleBox, title => loc('The Basics'), title_class => 'inverse', color => "#993333", &>
<&|/l&>Priority:
<&|/l&>Final Priority:
<&|/l&>Time Worked:
<&|/l&>Time Left:
<&| /Widgets/TitleBox, title => loc("Dates"), title_class=> 'inverse', color => "#663366", &>
<&|/l&>Starts:
<&|/l&>Due:
% if ( $Split ) { <& /Elements/Submit, Name => 'CreateIncident', Label => loc("Split") &> % } else { <& /Elements/Submit, Name => 'CreateIncident', Label => loc("Create") &> % } <&| /Widgets/TitleBox, title => loc("Run Investigation"), title_class=> 'inverse', color => "#663366", &> <& /RTIR/Investigation/Elements/Create, %ARGS, NamePrefix => 'Investigation', Queue => 'Investigations', Status => 'new', SkipField => { Owner => 1, Attachments => 1, DateFields => 1 }, &> <& /Elements/Submit, Name => 'CreateWithInvestigation', Label => loc("Create Incident and run Investigation"), &> <%INIT> my @results; # if there isn't a subject, but there is a child, use that one my $ChildObj; if ( $Child ) { $ChildObj = LoadTicket( $Child ); $Child = $ARGS{'Child'} = $ChildObj->id; $ARGS{'Subject'} ||= $ChildObj->Subject; } my $QueueObj = RT::Queue->new( $session{'CurrentUser'} ); $QueueObj->Load( 'Incidents' ) || Abort( loc("Queue could not be loaded.") ); $m->comp( '/RTIR/Create.html:ProcessAttachments', %ARGS ); my $checks_failure = 0; if ( $CreateIncident ) { my ($status, @msg) = $m->comp('/Elements/ValidateCustomFields', CustomFields => $QueueObj->TicketCustomFields, ARGSRef => \%ARGS, ); unless ( $status ) { push @results, loc( "Invalid value(s) of the custom fields:" ), @msg; $checks_failure = 1; } } if ( !$checks_failure && $CreateIncident ) { my ($inc_obj, @tmp) = $m->comp( '/RTIR/Investigation/Elements/Create:Process', %ARGS, $Child? ('MemberOf-new' => $Child): (), NamePrefix => '', DefaultsNamePrefix => '', ); push @results, @tmp; my $inv_obj; if ( $inc_obj && $CreateWithInvestigation ) { my (@tmp); ($inv_obj, @tmp) = $m->comp( '/RTIR/Investigation/Elements/Create:Process', %ARGS, NamePrefix => 'Investigation', DefualtsNamePrefix => '', ); push @results, @tmp; if ( $inv_obj ) { my($id, $msg) = $inv_obj->AddLink( Type => 'MemberOf', Target => $inc_obj->id ); #XXX: correct message on success push @results, $msg if !$id || $msg; } } if( $inc_obj ) { return $m->comp('Display.html', id => $inc_obj->id, results => \@results ); } } <%ARGS> $Title => loc("Create a new Incident") $QuoteTransaction => undef $CreateWithInvestigation => 0 $CreateIncident => $CreateWithInvestigation $Split => 0 # Split source $TicketObj => undef $Child => undef $current_tab => "RTIR/Create.html?Queue=Incidents" $current_subtab => "RTIR/Create.html?Queue=Incidents"