1%# BEGIN BPS TAGGED BLOCK {{{ 2%# 3%# COPYRIGHT: 4%# 5%# This software is Copyright (c) 1996-2021 Best Practical Solutions, LLC 6%# <sales@bestpractical.com> 7%# 8%# (Except where explicitly superseded by other copyright notices) 9%# 10%# 11%# LICENSE: 12%# 13%# This work is made available to you under the terms of Version 2 of 14%# the GNU General Public License. A copy of that license should have 15%# been provided with this software, but in any event can be snarfed 16%# from www.gnu.org. 17%# 18%# This work is distributed in the hope that it will be useful, but 19%# WITHOUT ANY WARRANTY; without even the implied warranty of 20%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21%# General Public License for more details. 22%# 23%# You should have received a copy of the GNU General Public License 24%# along with this program; if not, write to the Free Software 25%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 26%# 02110-1301 or visit their web page on the internet at 27%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. 28%# 29%# 30%# CONTRIBUTION SUBMISSION POLICY: 31%# 32%# (The following paragraph is not intended to limit the rights granted 33%# to you to modify and distribute this software under the terms of 34%# the GNU General Public License and is only of importance to you if 35%# you choose to contribute your changes and enhancements to the 36%# community by submitting them to Best Practical Solutions, LLC.) 37%# 38%# By intentionally submitting any modifications, corrections or 39%# derivatives to this work, or any other work intended for use with 40%# Request Tracker, to Best Practical Solutions, LLC, you confirm that 41%# you are the copyright holder for those contributions and you grant 42%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, 43%# royalty-free, perpetual, license to use, copy, create derivative 44%# works based on those contributions, and sublicense and distribute 45%# those contributions and any derivatives thereof. 46%# 47%# END BPS TAGGED BLOCK }}} 48<%init> 49my $TicketObj = RT::Ticket->new($session{CurrentUser}); 50$TicketObj->Load($ARGS{id}); 51$m->abort unless $TicketObj->id && $ARGS{UpdateType}; 52 53$m->abort unless $TicketObj->CurrentUserHasRight('ShowOutgoingEmail'); 54if ( $ARGS{UpdateType} eq 'private' ) { 55 $m->abort 56 unless $TicketObj->CurrentUserHasRight( 'CommentOnTicket' ) || $TicketObj->CurrentUserHasRight( 'ModifyTicket' ); 57} 58else { 59 $m->abort 60 unless $TicketObj->CurrentUserHasRight( 'ReplyToTicket' ) || $TicketObj->CurrentUserHasRight( 'ModifyTicket' ); 61} 62 63my @dryrun = $TicketObj->DryRun( 64 sub { 65 local $ARGS{UpdateContent} ||= "Content"; 66 ProcessUpdateMessage(ARGSRef => \%ARGS, TicketObj => $TicketObj ); 67 ProcessTicketWatchers(ARGSRef => \%ARGS, TicketObj => $TicketObj ); 68 ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj ); 69 ProcessTicketLinks( ARGSRef => \%ARGS, TicketObj => $TicketObj ); 70 ProcessTicketDates( ARGSRef => \%ARGS, TicketObj => $TicketObj ); 71 ProcessObjectCustomFieldUpdates(ARGSRef => \%ARGS, Object => $TicketObj ); 72 ProcessTicketReminders( ARGSRef => \%ARGS, TicketObj => $TicketObj ); 73 } 74); 75my %recips; 76$m->abort unless @dryrun; 77 78my %squelched = ProcessTransactionSquelching( \%ARGS ); 79my $squelched_config = !( RT->Config->Get('SquelchedRecipients', $session{'CurrentUser'}) ); 80my %submitted; 81$submitted{$_} = 1 for split /,/, $ARGS{TxnRecipients}; 82</%init> 83<p> 84<&|/l, RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$TicketObj->Id, 85&>Uncheck boxes to disable notifications to the listed recipients <b>for this transaction only</b>; persistent squelching is managed on the <a href="[_1]">People page</a>.</&> 86</p> 87 88% my @scrips = grep {$_->ActionObj->Action->isa('RT::Action::SendEmail')} 89% map {@{$_->Scrips->Prepared}} @dryrun; 90% if (@scrips) { 91% if ( grep { 92% my $s = $_; 93% my $action = $s->ActionObj->Action; 94% scalar(map { $action->$_ } qw(To Cc Bcc)) 95% } @scrips ) { 96<div class="custom-control custom-checkbox"> 97 <input type="checkbox" id="TxnSendMailToAll" name="TxnSendMailToAll" <% $ARGS{TxnSendMailToAll} ? 'checked="checked"' : '' %> value="1" class="custom-control-input"> 98 <label class="custom-control-label" for="TxnSendMailToAll"><b><% loc('All recipients') %></b></label><br /> 99</div> 100% } 101% for my $scrip (@scrips) { 102 <b><% $scrip->Description || loc('Scrip #[_1]',$scrip->id) %></b><br /> 103 <&|/l, loc($scrip->ConditionObj->Name), loc($scrip->ActionObj->Name), loc($scrip->Template)&>[_1] [_2] with template [_3]</&> 104 <br /> 105% for my $type (qw(To Cc Bcc)) { 106% my $action = $scrip->ActionObj->Action; 107% my @addresses = $action->$type(); 108% next unless @addresses; 109 <ul class="list-group list-group-compact"> 110% for my $addr (@addresses) { 111 <li class="list-group-item"> 112% my $checked = $submitted{$addr->address} ? not $squelched{$addr->address} : $squelched_config; 113% $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => $addr, Type => $type, Checked => \$checked); 114 <div class="form-row"> 115 <div class="col-auto"> 116 <b><%loc($type)%></b>: 117 </div> 118 <div class="col-auto"> 119% my $show_checkbox = 1; 120% if ( grep {$_ eq $addr->address} @{$action->{NoSquelch}{$type}} ) { 121% $show_checkbox = 0; 122% } 123 <div class="custom-control custom-checkbox"> 124% if ( $show_checkbox ) { 125% $recips{$addr->address}++; 126 <input type="checkbox" class="custom-control-input" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" /> 127% } 128 <label <% $show_checkbox ? 'class="custom-control-label"' : '' |n%> 129% if ( $show_checkbox ) { 130 for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" 131% } 132 ><& /Elements/ShowUser, Address => $addr &></label> 133% $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type); 134% unless ( $show_checkbox ) { 135% if ( $type eq 'Cc' ) { 136 (<&|/l&>explicit one-time Cc</&>) 137% } 138% else { 139 (<&|/l&>explicit one-time Bcc</&>) 140% } 141% } 142 </div> 143 </div> 144 </div> 145 </li> 146% } 147 </ul> 148% } 149% if (RT->Config->Get('PreviewScripMessages')) { 150 <textarea class="form-control" cols="80" rows="5"><% Encode::decode( "UTF-8", $scrip->ActionObj->Action->TemplateObj->MIMEObj->as_string )%></textarea> 151% } 152 <br /> 153% } 154% } 155 156% $m->callback( CallbackName => 'AfterRecipients', TicketObj => $TicketObj ); 157 158<input type="hidden" name="TxnRecipients" value="<% join ",",sort keys %recips %>" /> 159% $m->abort(); 160