X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FApprovals%2Findex.html;h=4c10c762cd288cf29e70865b24621a274f54215b;hp=cfd5ab4d5e897f4be3dbe80ab1bf721025d98d9f;hb=de9d037528895f7151a9aead6724ce2df95f9586;hpb=fc6209f398899f0211cfcedeb81a3cd65e04a941 diff --git a/rt/share/html/Approvals/index.html b/rt/share/html/Approvals/index.html index cfd5ab4d5..4c10c762c 100755 --- a/rt/share/html/Approvals/index.html +++ b/rt/share/html/Approvals/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,10 @@ %# %# END BPS TAGGED BLOCK }}} <& /Elements/Header, Title => loc("My approvals") &> -<& /Approvals/Elements/Tabs, Title => loc("My approvals") &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@actions &> -
+ <& Elements/PendingMyApproval, %ARGS &> <& /Elements/Submit, Label => loc('Go!') &>
@@ -64,13 +64,17 @@ foreach my $arg ( keys %ARGS ) { my $ticket = LoadTicket($1); - if ( $ARGS{ "Approval-" . $ticket->Id . "-Notes" } ) { - my $notes = MIME::Entity->build( - Data => [ $ARGS{ "Approval-" . $ticket->Id . "-Notes" } ] - ); - RT::I18N::SetMIMEEntityToUTF8($notes); # convert text parts into utf-8 + my $skip_update = 0; + $m->callback( CallbackName => 'BeforeApproval', + skip_update => \$skip_update, + Ticket => $ticket, + actions => \@actions); + next if $skip_update; - my ( $notesval, $notesmsg ) = $ticket->Correspond( MIMEObj => $notes ); + if ( $ARGS{ "Approval-" . $ticket->Id . "-Notes" } ) { + my ( $notesval, $notesmsg ) = $ticket->Correspond( + Content => $ARGS{ "Approval-" . $ticket->Id . "-Notes" } + ); if ($notesval) { push ( @actions, loc("Approval #[_1]: Notes recorded",$ticket->Id )); } else { @@ -79,11 +83,11 @@ foreach my $arg ( keys %ARGS ) { } my ($val, $msg); - if ( $ARGS{$arg} eq 'deny' ) { - ( $val, $msg ) = $ticket->SetStatus('rejected'); + if ( $ARGS{$arg} eq 'deny' && $ticket->Status !~ /^(rejected|deleted)/ ) { + ( $val, $msg ) = $ticket->SetStatus('rejected'); } - elsif ( $ARGS{$arg} eq 'approve' ) { - ( $val, $msg ) = $ticket->SetStatus('resolved'); + elsif ( $ARGS{$arg} eq 'approve' && $ticket->Status ne 'resolved') { + ( $val, $msg ) = $ticket->SetStatus('resolved'); } push ( @actions, loc("Approval #[_1]: [_2]",$ticket->id, $msg )) if ($msg); }