%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header, Title => $title &>
-<& /Ticket/Elements/Tabs,
- current_tab => "Search/Bulk.html",
- Title => $title,
- Format => $ARGS{'Format'}, # we don't want the locally modified one
- Query => $Query,
- Rows => $Rows,
- OrderBy => $OrderBy,
- Order => $Order,
- SavedSearchId => $SavedSearchId,
- SavedChartSearchId => $SavedChartSearchId,
- &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
-<form method="post" action="<% RT->Config->Get('WebPath') %>/Search/Bulk.html" enctype="multipart/form-data">
-% foreach my $var qw(Query Format OrderBy Order Rows Page SavedChartSearchId) {
+<form method="post" action="<% RT->Config->Get('WebPath') %>/Search/Bulk.html" enctype="multipart/form-data" name="BulkUpdate" id="BulkUpdate">
+% foreach my $var (qw(Query Format OrderBy Order Rows Page SavedChartSearchId)) {
<input type="hidden" class="hidden" name="<%$var%>" value="<%$ARGS{$var} || ''%>" />
%}
<& /Elements/CollectionList,
<hr />
-<& /Elements/Submit, Label => loc('Update'), CheckAll => 1, ClearAll => 1 &>
+<& /Elements/Submit, Label => loc('Update'), CheckboxNameRegex => '/^UpdateTicket\d+$/', CheckAll => 1, ClearAll => 1 &>
<br />
<&|/Widgets/TitleBox, title => $title &>
<table>
<table>
<tr><td align="right"><&|/l&>Update Type</&>:</td>
<td><select name="UpdateType">
- <option value="private" <% $ARGS{UpdateType} && $ARGS{UpdateType} eq 'private' ? 'selected="selected"' : '' %> ><&|/l&>Comments (not sent to requestors)</&></option>
+ <option value="private" <% $ARGS{UpdateType} && $ARGS{UpdateType} eq 'private' ? 'selected="selected"' : '' %> ><&|/l&>Comments (Not sent to requestors)</&></option>
<option value="response" <% $ARGS{UpdateType} && $ARGS{UpdateType} eq 'response' ? 'selected="selected"' : '' %>><&|/l&>Reply to requestors</&></option>
</select>
</td></tr>
&><em><% $CF->FriendlyType %></em></td>
</td></tr>
% } # end if while
-% if (exists $session{'Attachments'}) {
-<tr><td><&|/l&>Attached file</&>:</td>
-<td>
-<&|/l&>Check box to delete</&><br />
-% foreach my $attach_name (keys %{$session{'Attachments'}}) {
-<input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br />
-% } # end of foreach
-</td>
-</tr>
-% } # end of if
- <tr><td align="right"><&|/l&>Attach</&>:</td><td><input name="Attach" type="file" />
- <input type="submit" class="button" name="AddMoreAttach" value="<&|/l&>Add More Files</&>" />
- <input type="hidden" class="hidden" name="UpdateAttach" value="1" /></td></tr>
+<& /Ticket/Elements/AddAttachments, %ARGS &>
+
<tr><td class="labeltop"><&|/l&>Message</&>:</td><td>
%# Currently, bulk update always starts with Comment not Reply selected, so we check this unconditionally
% my $IncludeSignature = RT->Config->Get('MessageBoxIncludeSignatureOnComment');
my (@results);
-# {{{ deal with deleting uploaded attachments
+# deal with deleting uploaded attachments
foreach my $key (keys %ARGS) {
if ($key =~ m/^DeleteAttach-(.+)$/) {
delete $session{'Attachments'}{$1};
}
$session{'Attachments'} = { %{$session{'Attachments'} || {}} };
}
-# }}}
-# {{{ store the uploaded attachment in session
-if ($ARGS{'Attach'}) { # attachment?
+# store the uploaded attachment in session
+if ( defined $ARGS{'Attach'} && length $ARGS{'Attach'} ) { # attachment?
my $attachment = MakeMIMEEntity(
AttachmentFieldName => 'Attach'
);
$file_path => $attachment,
};
}
-# }}}
# delete temporary storage entry to make WebUI clean
unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
delete $session{'Attachments'};
}
-# }}}
$Page ||= 1;
my @watchresults =
ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS );
- foreach my $type qw(MergeInto DependsOn MemberOf RefersTo) {
+ foreach my $type (qw(MergeInto DependsOn MemberOf RefersTo)) {
$ARGS{ $Ticket->id . "-" . $type } = $ARGS{"Ticket-$type"};
$ARGS{ $type . "-" . $Ticket->id } = $ARGS{"$type-Ticket"};
}
@linkresults =
ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS );
- foreach my $type qw(MergeInto DependsOn MemberOf RefersTo) {
+ foreach my $type (qw(MergeInto DependsOn MemberOf RefersTo)) {
delete $ARGS{ $type . "-" . $Ticket->id };
delete $ARGS{ $Ticket->id . "-" . $type };
}
}
}
}
- my @tempresults = (
+ my @statusresults =
+ ProcessTicketStatus( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+ my @tempresults = (
@watchresults, @basicresults, @dateresults,
- @updateresults, @linkresults, @cfresults
+ @updateresults, @linkresults, @cfresults,
+ @statusresults
);
@tempresults =
- map { loc( "Ticket [_1]: [_2]", $Ticket->Id, $_ ) } @tempresults;
+ map {
+ $_ =~ /^Ticket \d+:/ ? $_ :
+ loc( "Ticket [_1]: [_2]", $Ticket->Id, $_ )
+ } @tempresults;
@results = ( @results, @tempresults );
}