%# 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 => loc("Bulk reply") &> <& /RTIR/Incident/Elements/Tabs, Ticket => $Incident, current_tab => "RTIR/Display.html?id=".$Incident->Id, current_subtab => "RTIR/Incident/BulkReply.html", Title => loc("Bulk reply") &> <& /RTIR/Elements/ListActions, actions => \@results &>
<& /RTIR/Elements/TicketHeader, Type => 'Report', %ARGS &> % my $i; <%PERL> $session{'tickets'}->RedoSearch(); while (my $Ticket = $session{'tickets'}->Next) { next unless ($ARGS{"UpdateTicket".$Ticket->Id}); $i++; <& /RTIR/Elements/TicketRow, Type => 'Report', Ticket => $Ticket, i=> $i, %ARGS &> % }
% if ($ARGS{Status} ne 'resolved' && $ARGS{Status} ne 'rejected' && $i == 0) { (<&|/l&>No tickets selected) % } else {
<& /Elements/TitleBoxStart, title => loc('Reply to selected tickets') &> <& /RTIR/Elements/UpdateData, %ARGS &>
<&|/l&>Owner: <& /Elements/SelectOwner, Name=>"Owner", Default => ($ARGS{Owner}||$session{'CurrentUser'}->Id||undef), &> <&|/l&>Worked: <&|/l&>minutes
<&|/l&>Update Type:
<&|/l&>Subject: (<&|/l&>uses subjects from tickets)
<& /Elements/TitleBoxEnd &> <& /Elements/Submit, Name => "ProcessReply" &> % }
<%INIT> my (@results, @statusresults); my ($CommentDefault, $ResponseDefault); if (($ARGS{'Action'} eq 'Comment') or ($ARGS{'UpdateType'} eq 'private')) { $CommentDefault = "SELECTED"; } else { $ResponseDefault = "SELECTED"; } my $Incident = LoadTicket($ARGS{'id'}); # 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 $do_comment_reply=0; # Prepare for ticket updates $ARGS{'UpdateContent'} =~ s/\r\n/\n/g; chomp ($ARGS{'UpdateContent'}) ; if (($ARGS{ProcessReply} && $ARGS{Status} eq 'resolved' || $ARGS{Status} eq 'rejected') || $ARGS{'UpdateContent'} && $ARGS{'UpdateContent'} ne '' && $ARGS{'UpdateContent'} ne "-- \n" . $session{'CurrentUser'}->UserObj->Signature) { $do_comment_reply=1; } my (@updateresults, @basicresults, @watchresults); if ($do_comment_reply) { @statusresults = ProcessTicketBasics(TicketObj => $Incident, ARGSRef => \%ARGS); } #Iterate through each ticket we've been handed while (my $Ticket = $session{'tickets'}->Next) { my ($oldstate, $newstate); $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State'); if ($do_comment_reply) { next unless ($ARGS{"UpdateTicket".$Ticket->Id}); ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@updateresults); @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS); @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS); } my $date; if (@updateresults) { $date = RT::Date->new($RT::SystemUser); $date->SetToNow; $date->AddDays($RT::OverdueAfter); use Business::Hours; my $bizhours = new Business::Hours; if ($RT::BusinessHours) { $bizhours->business_hours(%$RT::BusinessHours); } my $due = $bizhours->first_after($date->Unix); $date->Set(Format => 'unix', Value => $due); $ARGS{'Due_Date'} = $date->AsString; } my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS); my @tempresults = (@basicresults, @watchresults, @updateresults, @dateresults); $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State'); if ($newstate ne $oldstate) { push (@tempresults, loc("State changed from [_1] to [_2]", $oldstate, $newstate)); } @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults; @results = (@results, @tempresults); } @results = (@statusresults, @results);