%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# %# This software is Copyright (c) 1996-2016 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 => loc("Edit [_1] #[_2]: [_3]", $name, $Ticket->Id, $Ticket->Subject), &> <& /Elements/Tabs &> % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket); <& /Elements/ListActions, actions => \@results &> % unless ($Ticket->CurrentUserHasRight('ModifyTicket')) { <% loc("You are not allowed to edit this [_1].", $name) %> % return; % }
<&| /Widgets/TitleBox, title => loc("The Basics"), class => 'ticket-info-basics' &> % if (!RT::IR->IsIncidentQueue($Ticket->QueueObj) ) { % } % if ( RT::IR->IsIncidentQueue($Ticket->QueueObj)) { % } <& /RTIR/Elements/EditCustomFields, %ARGS, TicketObj => $Ticket &>
<&|/l&>Subject:
<&|/l&>Status: % unless ( RT::IR->IsCountermeasureQueue($Ticket->QueueObj) ) { <% loc($Ticket->Status) %> % } else { <& /Elements/SelectStatus, Name => 'Status', Object => $Ticket->QueueObj, DefaultValue => 0, Default => $ARGS{'Status'} || $Ticket->Status, &> % }
<&|/l&>Owner: <& /Elements/SelectOwner, Name => 'Owner', Default => $ARGS{'Owner'} || $Ticket->Owner, TicketObj => $Ticket, QueueObj => $Ticket->QueueObj, &>
<&|/l&>Queue: <& /RTIR/Elements/SelectRTIRQueue, Name => 'Queue', Default => $ARGS{'Queue'} || $Ticket->Queue, TicketObj => $Ticket, Lifecycle => $Ticket->QueueObj->Lifecycle, LimitToConstituency => ($m->{'RTIR_ConstituencyFilter'} || RT::IR->StrictConstituencyLinking) ? 1 : 0, Constituency => RT::IR->ConstituencyFor($Ticket) &>
<%loc("Incident")%>: <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket &>
<&|/l&>Time Worked: <& /Elements/EditTimeValue, Name => 'TimeWorked', Default => $ARGS{'TimeWorked'} || $Ticket->TimeWorked || '', &>
<&|/l&>Priority: <&/Elements/SelectPriority, Name => 'Priority', Default => $ARGS{'Priority'} || $Ticket->Priority &>
<& /Elements/EditCustomFieldCustomGroupings, %ARGS, Object => $Ticket, CustomFieldGenerator => sub { $Ticket->QueueObj->TicketCustomFields }, Groupings => [ RT::CustomField->CustomGroupings('RTIR::Ticket'), '' ], &>
<&| /Widgets/TitleBox, title => loc('Dates'), class => 'ticket-info-dates' &> <& /Ticket/Elements/EditDates, %ARGS, TicketObj => $Ticket &>

% if ( !RT::IR->IsIncidentQueue($Ticket->QueueObj)) { <&| /Widgets/TitleBox, title => loc('People'), class => 'ticket-info-people' &> <& /RTIR/Elements/EditPeople, %ARGS, Ticket => $Ticket &> % } <& /Elements/Submit, Name => 'SaveChanges', Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399", &>
<%INIT> my $Ticket = LoadTicket($id); $id = $ARGS{'id'} = $Ticket->Id; $m->callback(CallbackName => 'Initial', %ARGS, Ticket => $Ticket); my $Type = RT::IR::TicketType( Lifecycle => $Ticket->QueueObj->Lifecycle ); # If it's not an RTIR ticket type, just show the # regular RT ticket display page RT::Interface::Web::Redirect(RT->Config->Get('WebURL').'Ticket/Display.html?'. $m->comp('/Elements/QueryString', %ARGS )) unless $Type; if (RT::IR->IsCountermeasureQueue($Ticket->QueueObj) && RT->Config->Get('RTIR_DisableCountermeasures') ) { Abort(loc("Countermeasure queues are disabled via config file")); } # If there's an RTIR specific display page for this kind of ticket, show that if ( $m->comp_exists("/RTIR/$Type/Edit.html") ) { RT::Interface::Web::Redirect(RT::IR->HREFTo("$Type/Edit.html?" . $m->comp('/Elements/QueryString', %ARGS ))); } my @results; my $checks_failure = 0; if ( $SaveChanges ) { my $status = $m->comp('/Elements/ValidateCustomFields', CustomFields => $Ticket->QueueObj->TicketCustomFields, NamePrefix => "Object-RT::Ticket-$id-CustomField-", ARGSRef => \%ARGS, ); $checks_failure = 1 unless $status; } if ( $SaveChanges ) { $checks_failure += RT::IR->FilterRTAddresses( ARGSRef => \%ARGS, Fields => { map { ("WatcherAddressEmail$_" => $ARGS{"WatcherTypeEmail$_"}) } grep $ARGS{"WatcherTypeEmail$_"}, 1..3 }, results => \@results, ); } # XXX: process even if checks failed as EditPeople doesn't preserve state if ( $SaveChanges && !$OnlySearchForPeople ) { # XXX: ProcessTicketWatchers doesn't like WatcherTypeEmailX with # empty WatcherAddressEmailX delete $ARGS{"WatcherTypeEmail$_"} foreach grep !$ARGS{"WatcherAddressEmail$_"} && $ARGS{"WatcherTypeEmail$_"}, 1..3 ; push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS ); } if ( $SaveChanges && !$checks_failure && !$OnlySearchForPeople ) { my $strict_acl = RT->Config->Set( StrictLinkACL => 0 ); push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS ); RT->Config->Set( StrictLinkACL => $strict_acl ); push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS ); push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS ); push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS ); push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS ); $m->callback( CallbackName => 'AfterProcessing', ARGSRef => \%ARGS, Ticket => $Ticket, results => \@results, ); MaybeRedirectForResults( Actions => \@results, Path => RT->Config->Get('DisplayAfterEdit', $session{'CurrentUser'}) ? RT::IR->HREFTo("Display.html", IncludeWebPath => 0) : RT::IR->HREFTo("Edit.html", IncludeWebPath => 0) , Arguments => { id => $id }, ); } my $name = RT::IR::TicketType( Ticket => $Ticket ); # We still call incident reports "incident reports in some places # XXX TODO just create a ShortTicketType method if (RT::IR->IsReportQueue($Ticket->QueueObj)) { $name = "Incident Report"; } # If they've gone and moved the ticket to somewhere they can't see, etc... # TODO: display the results, even if we can't display the ticket. unless ($Ticket->CurrentUserHasRight('ShowTicket')) { Abort("No permission to view ticket"); } <%ARGS> $id => undef $SaveChanges => 0 $OnlySearchForPeople => undef