%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# %# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) %# %# %# LICENSE: %# %# 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. %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA %# 02110-1301 or visit their web page on the internet at %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: %# %# (The following paragraph is not intended to limit the rights granted %# to you to modify and distribute this software under the terms of %# the GNU General Public License and is only of importance to you if %# you choose to contribute your changes and enhancements to the %# community by submitting them to Best Practical Solutions, LLC.) %# %# By intentionally submitting any modifications, corrections or %# derivatives to this work, or any other work intended for use with %# Request Tracker, to Best Practical Solutions, LLC, you confirm that %# you are the copyright holder for those contributions and you grant %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, %# royalty-free, perpetual, license to use, copy, create derivative %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} <& /RTIR/Elements/Header, Title => $Title, &> <& /Elements/Tabs &> % $m->callback(CallbackName => 'BeforeActionList', %ARGS, Actions => \@results, ARGSRef => \%ARGS, Ticket => $SplitObj); <& /Elements/ListActions, actions => \@results &> % if ( $Split && !$SplitObj->CurrentUserHasRight('ModifyTicket') ) { <% loc("You are not allowed to split this [_1].", RT::IR::TicketType(Lifecycle => $QueueObj->Lifecycle)) %> % $m->abort(); % } % unless ( $Split ) {
" method="post" enctype="multipart/form-data" name="TicketCreate"> % } else { " method="post" enctype="multipart/form-data" name="TicketCreate"> % } % if ( $Split ) { % } % if ( $gnupg_widget ) { <& /Elements/Crypt/SignEncryptWidget:ShowIssues, self => $gnupg_widget &> % }
<&| /Widgets/TitleBox, title => loc("Basics"), class=>'ticket-info-basics' &> % if ( $SplitObj ) { % } <& /RTIR/Elements/SelectIncident, Type => $Type, Default => \@Incident, SplitObj => $SplitObj, &> <& /Ticket/Elements/EditBasics, InTable => 1, QueueObj => $QueueObj, fields => [ { name => 'Queue', comp => '/Ticket/Elements/ShowQueue', args => { QueueObj => $QueueObj, }, }, { name => 'Status', comp => '/Ticket/Elements/SelectStatus', args => { Name => "Status", Default => $ARGS{Status} || $QueueObj->LifecycleObj->DefaultOnCreate, DefaultValue => 0, SkipDeleted => 1, Object => $QueueObj, }, }, { name => 'Owner', comp => '/Elements/SelectOwner', args => { Name => "Owner", Default => $ARGS{Owner} || $session{'CurrentUser'}->id || RT->Nobody->Id, DefaultValue => 0, QueueObj => $QueueObj, }, }, { special => 'roles' }, $QueueObj->SLADisabled ? () : ( { name => 'SLA', comp => '/Elements/SelectSLA', args => { Name => 'SLA', Default => $ARGS{SLA} || RT::SLA->GetDefaultServiceLevel(Queue => $QueueObj), DefaultValue => RT::SLA->GetDefaultServiceLevel(Queue => $QueueObj) ? 0 : 1, QueueObj => $QueueObj, }, }), ], &> <& /RTIR/Elements/EditCustomFields, %ARGS, TicketObj => $ticket, QueueObj => $QueueObj, DefaultsFrom => $SplitObj || $IncidentObj[0], CFDefaults => \%CFDefaults, &> <& /Ticket/Elements/EditTransactionCustomFields, %ARGS, QueueObj => $QueueObj, InTable => 1, &>
<&|/l&>Split from: <% $SplitObj->id %>
<& /Elements/EditCustomFieldCustomGroupings, %ARGS, %CFDefaults, Object => $ticket, CustomFieldGenerator => sub { $QueueObj->TicketCustomFields }, Groupings => [ RT::CustomField->CustomGroupings('RTIR::Ticket'), '' ], &> <&| /Widgets/TitleBox, title => loc("Dates"), class=>'ticket-info-dates' &> <& /Ticket/Elements/EditBasics, InTable => 1, QueueObj => $QueueObj, fields => [ { name => 'Starts', comp => '/Elements/SelectDate', args => { Name => 'Starts', Default => $ARGS{'Starts'} || '' }, }, { name => 'Due', comp => '/Elements/SelectDate', args => { Name => 'Due', Default => $ARGS{'Due'} || '' }, }, ], &>
<&| /Widgets/TitleBox, title => loc("Time"), class=>'ticket-info-time' &> <& /Ticket/Elements/EditBasics, InTable => 1, QueueObj => $QueueObj, fields => [ { name => 'Time Estimated', comp => '/Elements/EditTimeValue', args => { Name => "TimeEstimated", Default => $ARGS{'TimeEstimated'} || '', }, }, { name => 'Time Worked', comp => '/Elements/EditTimeValue', args => { Name => "TimeWorked", Default => $ARGS{'TimeWorked'} || '', }, }, { name => 'Time Left', comp => '/Elements/EditTimeValue', args => { Name => "TimeLeft", Default => $ARGS{'TimeLeft'} || '', }, }, ], &>
% if ( RT::IR->IsInvestigationQueue($QueueObj) && @IncidentObj ) { <& /RTIR/Elements/AttachReports, Ticket => \@IncidentObj &> % }
<&| /Widgets/TitleBox, title => $Title, class => 'messagedetails' &> % $m->callback( CallbackName => 'AfterRequestors', ARGSRef => \%ARGS ); % my $roles = $QueueObj->CustomRoles; % $roles->LimitToMultipleValue; % while (my $role = $roles->Next) { % if ($role->EntryHint) { % } % } % if ( $gnupg_widget ) { % } <& /Ticket/Elements/AddAttachments, %ARGS, QueueObj => $QueueObj &>
<&|/l&>Correspondents: <& /Elements/EmailInput, Name => 'Requestors', Default => $ARGS{'Requestors'}, Size => undef, &>
  /> <&|/l&>Don't send any emails to correspondents.
<&|/l&>Cc: <& /Elements/EmailInput, Name => 'Cc', Default => $ARGS{'Cc'}, Size => undef, &>
  <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people will receive future updates.)
<&|/l&>Admin Cc: <& /Elements/EmailInput, Name => 'AdminCc', Default => $ARGS{'AdminCc'}, Size => undef, &>
  <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people will receive future updates.)
<% $role->Name %>: <& /Elements/EmailInput, Name => $role->GroupType, Default => $ARGS{$role->GroupType}, Size => undef, &>
  <% $role->EntryHint %>
<&|/l&>Subject:
  <& /Elements/Crypt/SignEncryptWidget, self => $gnupg_widget, QueueObj => $QueueObj &>
<&|/l&>Message: <%perl> my $include_signature = 1; unless (exists $ARGS{Content}) { my $Transactions; if ($SplitObj) { $Transactions = $SplitObj->Transactions; } elsif (@IncidentObj) { $Transactions = $IncidentObj[0]->Transactions; } if ($Transactions) { # Investigations should quote their included text my $quote = 0; if (RT::IR->IsInvestigationQueue($QueueObj)){ $quote = 1; } $ARGS{Content} = $m->scomp("/RTIR/Elements/TransactionData", Transactions => $Transactions, Type => 'messages', Include => {'Create', 'Correspond'}, QuoteText => $quote); $ARGS{Content} =~ s/\>/>/g if $ARGS{Content}; } } else { $include_signature = 0; } % if ( RT->Config->Get('ArticleOnTicketCreate')) { <& /Articles/Elements/BeforeMessageBox, %ARGS, QueueObj => $QueueObj &> % } % $m->callback( %ARGS, CallbackPage => '/Ticket/Create.html', CallbackName => 'BeforeMessageBox' ); % if ( $ARGS{Content} ) { <& /Elements/MessageBox, Default => $ARGS{Content}, IncludeSignature => $include_signature &> % } else { <& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &> % }
<& /Elements/Submit, Name => "Create", Label => $SubmitCaption, SubmitId => 'create-ticket' &>
<%INIT> # XXX TODO remove this code that maps lifecycles to queues if ($Lifecycle && ! $Queue) { $Queue=ucfirst($Lifecycle); $Queue=~ s/_r/ R/; $ARGS{'Queue'} = $Queue; } my $constituency = $m->{'RTIR_ConstituencyFilter'}; my %CFDefaults; $m->callback( CallbackName => 'Init', CallbackPage => '/Ticket/Create.html', ARGSRef => \%ARGS, ); my $QueueObj = RT::Queue->new( $session{'CurrentUser'} ); $QueueObj->Load( $Queue ); if (!$QueueObj->Name) { Abort( loc("Queue '[_1]' could not be loaded.",$Queue) ); } if ($Queue && !$Lifecycle) { $Lifecycle = $QueueObj->Lifecycle; } my $ticket = RT::Ticket->new($session{'CurrentUser'}); # empty ticket object if (RT::IR->IsCountermeasureQueue($QueueObj) && RT->Config->Get('RTIR_DisableCountermeasures') ) { Abort(loc("Countermeasure queues are disabled via config file")); } my $Type = RT::IR::TicketType( Lifecycle => $Lifecycle); # As of RTIR 4.0, that's only true for Incidents # If there's an RTIR specific create page for this kind of ticket, show that if ( $m->comp_exists("/RTIR/$Type/Create.html") ) { RT::Interface::Web::Redirect(RT::IR->HREFTo( "$Type/Create.html?" . $m->comp('/Elements/QueryString', %ARGS ))); } my (@results, $checks_failure, $skip_create); $skip_create = !$ARGS{'Create'}; my $SplitObj; if ( $Split ) { $SplitObj = LoadTicket( $Split ); $ARGS{'Split'} = $Split = $SplitObj->id; unless (@Incident) { @Incident = map $_->id, @{ RT::IR->Incidents( $SplitObj )->ItemsArrayRef || [] }; $DECODED_ARGS->{Incident} = \@Incident; } } my @IncidentObj; foreach my $id ( grep $_, @Incident ) { my $error = 1; my $inc = RT::Ticket->new( $session{'CurrentUser'} ); $inc->Load( $id ); unless ( $inc->id ) { push @results, loc("Couldn't load incident #[_1]", $id ); } elsif ( !RT::IR->IsIncidentQueue($inc->QueueObj) ) { push @results, loc('Ticket #[_1] is not an Incident', $id ); } else { my $incident_constituency = RT::IR->ConstituencyFor($inc); if ($constituency && $incident_constituency ne $constituency) { push @results, loc("Incident constituency '[_1]' does not match current constituency '[_2]'", $incident_constituency, $constituency); } if(!$constituency) { $constituency = RT::IR->ConstituencyFor($inc); } push @IncidentObj, $inc; $error = 0; } $checks_failure += $error; } @Incident = map $_->id, @IncidentObj; my $children_config = RT->Config->Get('RTIR_IncidentChildren')->{ $Type }; if ( @Incident > 1 && !$children_config->{'Multiple'} ) { push @{ $m->{'request_args'} }, Incident => $Incident[-1]; @Incident = ($Incident[-1]); } $Subject ||= $IncidentObj[0]->Subject if @IncidentObj; ProcessAttachments(ARGSRef => \%ARGS); my $gnupg_widget = $m->comp('/Elements/Crypt/SignEncryptWidget:new', Arguments => \%ARGS ); $m->comp( '/Elements/Crypt/SignEncryptWidget:Process', self => $gnupg_widget, QueueObj => $QueueObj, ); if ( !$skip_create && $gnupg_widget ) { my $status = $m->comp('/Elements/Crypt/SignEncryptWidget:Check', self => $gnupg_widget, Operation => 'Create', QueueObj => $QueueObj, ); $checks_failure = 1 unless $status; } unless ( $skip_create ) { if ( RT::IR->IsInvestigationQueue($QueueObj) && !$ARGS{'Requestors'} ) { push @results, loc( "You must enter a correspondent" ); $checks_failure = 1; } if ( $children_config->{'Required'} && !@IncidentObj ) { push @results, loc( "You must enter an Incident ID" ); $checks_failure = 1; } } unless ( $skip_create ) { my $ticket_status = $m->comp('/Elements/ValidateCustomFields', CustomFields => $QueueObj->TicketCustomFields,, ARGSRef => \%ARGS, ); my $txn_status = $m->comp('/Elements/ValidateCustomFields', CustomFields => $QueueObj->TicketTransactionCustomFields, ARGSRef => \%ARGS, NamePrefix => "Object-RT::Transaction--CustomField-", Object => RT::Transaction->new( $session{CurrentUser} ) ); unless ( $ticket_status && $txn_status ) { push @results, loc( "Invalid value(s) of the custom fields" ); $checks_failure = 1; } } unless ( $skip_create ) { $checks_failure += RT::IR->FilterRTAddresses( ARGSRef => \%ARGS, Fields => { Requestors => 'Requestor', Cc => 'Cc', AdminCc => 'AdminCc' }, results => \@results, ); } # for articles and other things $m->callback( CallbackName => 'BeforeCreate', CallbackPage => '/Ticket/Create.html', ARGSRef => \%ARGS, results => \@results, skip_create => \$skip_create, checks_failure => $checks_failure ); unless ( $skip_create || $checks_failure ) { $ARGS{'new-MemberOf'} = join ' ', @Incident; $m->callback(CallbackName => 'BeforeDisplay', Ticket => $SplitObj, ARGSRef => \%ARGS); push @{ $session{'Actions'}{''} ||= [] }, @results; return $m->comp( 'Display.html', %ARGS, SkipNotification => \@SkipNotification ); } unshift @results, loc("Creation failed:") if $checks_failure && @results; my ($Title, $SubmitCaption); if ( $Split ) { $Title = loc("Split [_1] #[_2]: [_3]", RT::IR::TicketType(Lifecycle => $QueueObj->Lifecycle), $SplitObj->id, $SplitObj->Subject); $SubmitCaption = loc("Split"); } else { if ( RT::IR->IsInvestigationQueue($QueueObj) ) { $Title = loc("Launch a new investigation"); $SubmitCaption = loc("Launch"); } else { $Title = loc("Create a new [_1]", RT::IR::TicketType(Lifecycle => $QueueObj->Lifecycle)); $SubmitCaption = loc("Create"); } } <%ARGS> $Queue => undef $Lifecycle => undef @SkipNotification => () $Subject => undef $QuoteTransaction => undef # Parent Incident(s) @Incident => () $Split => undef