%# 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/Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &> <& Elements/Tabs, Title => $title &> <& /Elements/ListActions, actions => \@results &>
> %if ($ticketcount) { <& /RTIR/Elements/TicketHeader, check => "check", %ARGS &> % my $i; %while (my $Ticket = $session{'tickets'}->Next) { % $i++; <& /RTIR/Elements/TicketRow, Type => 'Report', Ticket => $Ticket, i=> $i, check => "check", %ARGS &> % }
<&|/l&>First page    % if ( $session{'tickets'}->FirstRow >= $session{'tickets_rows_per_page'}-1 ) { <<&|/l&>Previous page    % } % if ( $session{'tickets'}->FirstRow + $session{'tickets_rows_per_page'} < $ticketcount ) { <&|/l&>Next page> % } %#  <&|/l&>Goto page
(<&|/l, ($session{'tickets'}->FirstRow+1), ($session{'tickets'}->FirstRow() + $session{'tickets'}->RowsPerPage() ) &>[_1] - [_2] shown)
% }
<& /Elements/Submit, Name => "SubmitTicket", Caption => $SubmitCaption, Label => loc("Reject") &>
<& /Elements/TitleBoxStart, title => loc('Current search criteria')&> <& /RTIR/Elements/SearchCriteria, Path => $AssocPath, %ARGS &> <& /Elements/TitleBoxEnd&> <& /RTIR/Elements/PickRestriction, Queue => $ARGS{'ValueOfQueue'}, %ARGS &>
<%INIT> my $title = loc("Reject Incident Reports"); my $SubmitCaption = loc("Reject selected incident reports"); my $q = RT::Queue->new($session{'CurrentUser'}); $q->Load("Incident Reports"); my $ticketcount; $session{'i'}++; if ($session{'tickets'}) { if ($ARGS{'DeleteRestriction'}) { $session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'}); } if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) { $session{'tickets'}->ClearRestrictions; $ARGS{'QueueOp'}="="; $ARGS{'ValueOfQueue'}=$q->Id; my $fid; my $CustomFields = $q->CustomFields(); $CustomFields->{'find_disabled_rows'} = 1; while (my $CustomField = $CustomFields->Next()) { if ($CustomField->Name eq '_RTIR_State') { $fid = $CustomField->Id; $session{'tickets'}->LimitCustomField(CUSTOMFIELD => $fid, VALUE => 'new'); } } } } ProcessSearchQuery(ARGS=>\%ARGS); $session{'tickets'}->RedoSearch(); $ticketcount = $session{tickets}->Count(); # Iterate through the ARGS hash and remove anything with a null value. map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS); Abort(loc("No search to operate on.")) unless ($session{'tickets'}); my @results; if ($ARGS{'BulkReject'}) { #Iterate through each ticket we've been handed while (my $t = $session{'tickets'}->Next) { $RT::Logger->debug( "Checking Ticket ".$t->Id ."\n"); 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) { if ($t->OwnerObj->id == $RT::Nobody->id) { $ARGS{'Action'} = 'Take'; } else { $ARGS{'Action'} = 'Steal'; } my $action = $ARGS{'Action'}; push @results, "Action: ".$ARGS{'Action'}; my ($res, $msg)=$t->$action(); push (@results, $msg); push @results, "Msg: ".$msg; } push @results, ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$t); } else { push @results, loc("Cannot reject Incident Report #[_1]. Only new reports may be rejected.", $t->id); } } } <%ARGS> $id => undef $AssocPath => '/RTIR/Report/BulkReject.html' $Status => 'rejected'