%#
%# 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">
+<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} || ''%>" />
%}
<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>
<tr><td class="label"> <&|/l&>Make subject</&>: </td>
<td class="value"> <input name="Subject" size="20" value="<% $ARGS{Subject} || '' %>"/> </td></tr>
<tr><td class="label"> <&|/l&>Make priority</&>: </td>
-<td class="value"> <& /Elements/SelectPriority, Name => "Priority", Default => $ARGS{Priority} &> </td></tr>
+% my $rel = ($ARGS{Priority} =~ s/^R//);
+<td class="value"> <& /Elements/SelectPriority, Name => "Priority", Default => $ARGS{Priority} &>
+<select name="Priority-Mode">
+<option value="absolute" <% !$rel && 'selected' %>>absolute</option>
+<option value="relative" <% $rel && 'selected' %>>relative</option>
+</select>
+</td></tr>
<tr><td class="label"> <&|/l&>Make queue</&>: </td>
<td class="value"> <& /Elements/SelectQueue, Name => "Queue", Default => $ARGS{Queue} &> </td></tr>
<tr><td class="label"> <&|/l&>Make Status</&>: </td>
<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;
$Format ||= RT->Config->Get('DefaultSearchResultFormat');
# inject _CHECKBOX to the first field.
-$Format =~ s/'?([^']+)'?,/'___CHECKBOX__$1',/;
+$Format =~ s/'?([^']+)'?,/'___CHECKBOX__$1',/; #'
my $Tickets = RT::Tickets->new( $session{'CurrentUser'} );
$Tickets->FromSQL($Query);
my $cf_add_keys;
@$cf_add_keys = grep { /^Bulk-Add-CustomField/ } keys %ARGS;
+if ( defined($ARGS{'Priority'})
+ and ($ARGS{'Priority-Mode'} || '') eq 'relative' ) {
+ # magic in Ticket::SetPriority
+ $ARGS{'Priority'} = 'R'.$ARGS{'Priority'};
+}
+delete $ARGS{'Priority-Mode'};
+
unless ( $ARGS{'AddMoreAttach'} ) {
# Add session attachments if any to be processed by ProcessUpdateMessage
$ARGS{'UpdateAttachments'} = $session{'Attachments'} if ( $session{'Attachments'} );
}
}
}
- 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 );
}