%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# %# This software is Copyright (c) 1996-2013 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 ( $Type ne 'Incident' ) { % } % if ( $Type eq 'Incident' ) { % } % if ( $constituency_cf && ( $constituency_propagation ne 'reject' || !$is_linked ) ) { % } <& /RTIR/Elements/EditCustomFields, %ARGS, TicketObj => $Ticket &>
<&|/l&>Subject:
<&|/l&>Status: % unless ( $Type eq 'Block' ) { <% loc($Ticket->Status) %> % } else { <& /Elements/SelectStatus, Name => 'Status', QueueObj => $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, &>
<%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 &>
<&|/l&>Constituency: <& /RTIR/Elements/EditRTIRField, TicketObj => $Ticket, Name => 'Constituency', &>
<&| /Widgets/TitleBox, title => loc('Dates'), class => 'ticket-info-dates' &> <& /RTIR/Elements/EditDates, %ARGS, TicketObj => $Ticket &>

% if ( $Type ne 'Incident' ) { <&| /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( Ticket => $Ticket ); return $m->comp( '/Ticket/Display.html', %ARGS ) unless $Type; if( $Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) { Abort(loc("Blocks queue is disabled via config file")); } if ( $m->comp_exists("/RTIR/$Type/Edit.html") ) { return $m->comp("/RTIR/$Type/Edit.html", %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 ); # XXX: edit page has no message box or attachments form $ARGS{UpdateAttachments} = delete $session{'Attachments'}; push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS ); push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS ); push @results, ProcessTicketCustomFieldUpdates( ARGSRef => \%ARGS ); $m->callback( CallbackName => 'AfterProcessing', ARGSRef => \%ARGS, Ticket => $Ticket, results => \@results, ); MaybeRedirectForResults( Actions => \@results, Path => RT->Config->Get('DisplayAfterEdit', $session{'CurrentUser'}) ? "/RTIR/Display.html" : "/RTIR/Edit.html" , Arguments => { id => $id }, ); } my $name; if ($Type eq 'Report') { $name = "Incident Report"; } else { $name = $Type; } my $constituency_cf = RT::IR->CustomFields( Constituency => Ticket => $Ticket ); my $constituency_propagation = RT->Config->Get('_RTIR_Constituency_Propagation'); my $is_linked = 0; if ( $constituency_cf && $constituency_propagation eq 'reject' ) { $is_linked = $Type eq 'Incident' ? RT::IR->IncidentChildren( $Ticket )->Count : RT::IR->Incidents( $Ticket )->Count ; } # 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