%# BEGIN LICENSE BLOCK %# %# Copyright (c) 1996-2002 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/Search/Elements/RefineTabs', path => $path, Queue => $Queue, current_tab => $current_tab, Title => $title, Format => $Format, Query => $Query, Rows => $Rows, OrderBy => $OrderBy, Order => $Order, QueryString => $QueryString, &> <& /Elements/ListActions, actions => \@results &>
> <& /RTIR/Search/Elements/ShowResults, Queue => $Queue, Query => $Query, QueryString => $QueryString, BaseURL => $BaseURL, Format => $Format, RTIRCheck => $RTIRCheck, &> [Select All] [Unselect All] <& /Elements/Submit, Name => "SubmitTicket", Caption => $SubmitCaption, Label => loc("Reject") &>
<%INIT> $Format = $RT::RTIRSearchResultFormats->{'RejectReports'}; my $title = loc("Reject Incident Reports"); my $SubmitCaption = loc("Reject selected incident reports"); $m->comp( '/RTIR/Elements/Header', Title => $title, Refresh => $session{'tickets_refresh_interval'} ); my ( @results ); if ( $ARGS{'BulkReject'} ) { #Iterate through each ticket we've been handed while ( my $t = $session{'tickets'}->Next ) { my @tempresults; $m->out(''); $m->flush_buffer; next unless ( $ARGS{ "UpdateTicket" . $t->Id } ); my $State = $m->scomp( "/RTIR/Elements/ShowRTIRField", Ticket => $t, Name => 'State' ); $State =~ s/\s+$//; if ( $State eq 'new' ) { # If we don't own the thing we're linking to, change the owner if ( $t->OwnerObj->id != $session{'CurrentUser'}->id && $t->OwnerObj->id != $RT::Nobody->id ) { @tempresults = loc( "You may not reject tickets that belong to another user."); } else { @tempresults = (); if ( $t->OwnerObj->id != $session{'CurrentUser'}->id && $t->OwnerObj->id == $RT::Nobody->id ) { $ARGS{'Action'} = 'Take'; my $action = $ARGS{'Action'}; push @tempresults, "Action: " . $ARGS{'Action'}; my ( $res, $msg ) = $t->$action(); push( @tempresults, $msg ); } my ( $oldstate, $newstate ); $oldstate = $t->FirstCustomFieldValue('_RTIR_State'); push @tempresults, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $t ); $newstate = $t->FirstCustomFieldValue('_RTIR_State'); if ( $newstate ne $oldstate ) { push( @tempresults, loc( "State changed from [_1] to [_2]", $oldstate, $newstate ) ); } } } else { push @tempresults, loc( "Cannot reject Incident Report #[_1]. Only new reports may be rejected.", $t->id ); } @tempresults = map { loc( "Ticket [_1]: [_2]", $t->Id, $_ ) } @tempresults; @results = ( @results, @tempresults ); } } # We can only reject new tickets, so set the states. my @states = ['new']; if ( !$Query ) { $Query = $m->comp( '/RTIR/Elements/NewQuery', Queue => $Queue, states => @states ); } my $QueryString = $m->comp( '/Elements/QueryString', Query => $Query, Format => $Format, Rows => $Rows, OrderBy => $OrderBy, Order => $Order, Page => $Page ); if ( !$BaseQuery ) { $BaseQuery = $m->comp( '/RTIR/Elements/BaseQuery', Queue => $Queue ); } $Query = "$BaseQuery AND ( $Query )"; my $path = "RTIR/Search/Refine.html?$QueryString&ResultPage=$BaseURL¤t_tab=$current_tab&Queue=$Queue"; <%ARGS> $Status => 'rejected' $RTIRCheck => 'None' $Query => undef $BaseQuery => undef $Queue => 'Incident Reports' $Format => undef $Rows => 50 $Page => 1 $OrderBy => 'id' $Order => 'ASC' $BaseURL => $RT::WebPath . "/RTIR/Report/BulkReject.html?" $current_tab => 'RTIR/Report/BulkReject.html'