rt 4.2.16
[freeside.git] / rt / share / html / Approvals / index.html
index 09392c9..d9b22d7 100755 (executable)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -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 {