Skip to content

Commit 660e1ff

Browse files
committed
Prefill group as Cc on group summary quick ticket creation
The group summary "Quick ticket creation" portlet passed the group via a hidden AddGroupCc field, which only added the group as a Cc watcher after the ticket was created (in Display.html) and never prefilled the visible Cc field on the create form. So clicking Create landed on a create form with an empty Cc field. The ticket create Cc field now accepts groups directly via group:NAME tokens, so prefill it with the group like the user summary portlet does with Requestors. This makes the group visible in the Cc field and flows it through the normal watcher processing, so the special AddGroupCc handling in Create.html and Display.html is no longer needed.
1 parent 7a23a85 commit 660e1ff

4 files changed

Lines changed: 16 additions & 26 deletions

File tree

devel/docs/UPGRADING-6.0

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ been moved to the .main-container element. If you've customized CSS styles
194194
targeting body with id like C<body#comp-Ticket-Display>, update them to
195195
C<.main-container#comp-Ticket-Display> or just C<#comp-Ticket-Display>.
196196

197+
=item *
198+
199+
The group summary "Quick ticket creation" portlet no longer submits the
200+
group to C</Ticket/Create.html> via a hidden C<AddGroupCc> field. The ticket
201+
create Cc field now accepts groups directly, so the portlet prefills C<Cc>
202+
with a C<group:NAME> token instead, and the special C<AddGroupCc> handling
203+
has been removed from C</Ticket/Create.html> and C</Ticket/Display.html>. If
204+
you have a link or customization that passes C<AddGroupCc> to the create
205+
form, change it to pass C<Cc=group:NAME> (or C<Cc=group:ID>).
206+
197207
=back
198208

199209
=head1 DEPRECATED CODE

share/html/Group/Elements/Portlets/CreateTicket

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
%# END BPS TAGGED BLOCK }}}
4848
<&| /Widgets/TitleBox, title => loc('Quick ticket creation'), class => "group create-ticket" &>
4949
<form name="CreateTicket" action="<%RT->Config->Get('WebPath')%>/Ticket/Create.html">
50-
<input type="hidden" name="AddGroupCc" value="<%$Group->Id%>">
50+
<input type="hidden" name="Cc" value="<% $group_cc %>">
5151
<div class="row mt-2">
5252
<div class="col-auto label">
5353
<&|/l&>Create a ticket with this group as Cc in Queue</&>
@@ -61,6 +61,11 @@
6161
</div>
6262
</form>
6363
</&>
64+
<%INIT>
65+
# A group name containing the field delimiter (comma) can't round-trip as a
66+
# "group:NAME" token, so fall back to the id in that case.
67+
my $group_cc = $Group->Name =~ /,/ ? 'group:' . $Group->Id : 'group:' . $Group->Name;
68+
</%INIT>
6469
<%ARGS>
6570
$Group
6671
</%ARGS>

share/html/Ticket/Create.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@
5959
<input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
6060
<input type="hidden" name="QueueChanged" value="0" />
6161

62-
% if ( $ARGS{'AddGroupCc'} ){
63-
<input type="hidden" class="hidden" name="AddGroupCc" value="<% $ARGS{'AddGroupCc'} %>" />
64-
% }
65-
6662
% if ( $ARGS{'ChangedField'} ) {
6763
% for my $field ( ref $ARGS{ChangedField} eq 'ARRAY' ? @{ $ARGS{ChangedField} } : $ARGS{ChangedField} ) {
6864
<input type="hidden" class="hidden" name="ChangedField" value="<% $field %>" />
@@ -333,5 +329,4 @@
333329
$MemberOf => undef
334330
$QuoteTransaction => undef
335331
$CloneTicket => undef
336-
$AddGroupCc => undef
337332
</%ARGS>

share/html/Ticket/Display.html

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -186,26 +186,6 @@
186186

187187
$title = loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject || '');
188188

189-
if ( $ARGS{'id'} and $ARGS{'id'} eq 'new' ) {
190-
if ( $ARGS{'AddGroupCc'} ){
191-
my $group = RT::Group->new($session{'CurrentUser'});
192-
my ($ret, $msg) = $group->LoadUserDefinedGroup($ARGS{'AddGroupCc'});
193-
194-
unless ( $ret ){
195-
RT::Logger->warn("Unable to load group " . $ARGS{'AddGroupCc'} . ", $msg. Not adding as Cc.");
196-
return;
197-
}
198-
199-
( $ret, $msg ) = $TicketObj->AddWatcher(
200-
Type => 'Cc',
201-
PrincipalId => $group->Id
202-
);
203-
204-
RT::Logger->warn("Unable to add group " . $group->Name . ": " . $group->Id . " as a Cc: $msg")
205-
unless $ret;
206-
}
207-
}
208-
209189
$m->callback(
210190
CallbackName => 'BeforeDisplay',
211191
TicketObj => \$TicketObj,

0 commit comments

Comments
 (0)