[Rt-devel] PATCH: Another callback for /Ticket/Display.html
Drew Taylor
DTaylor at cidc.com
Mon Jul 31 17:32:53 EDT 2006
I came across another scenario where I needed a new callback:
/Ticket/Display.html before the redirect (approx line 154).
Scenario: When resolving a ticket via /Ticket/Update.html, I want to
conditionally require entering a value for a custom field (eg: resolving
a ticket to add a new user and specifying their new email address). So I
have a callback (BeforeMessageBox) that adds appropriate fields for the
CFs I want filled in. This works great. However, by default
/Ticket/Display.html does not update Custom Fields - just Basics and
Links. So I'm using a new Callback (BeforeActions) to give me a chance
to save these CF's.
Here's another feature request: give me a standard way to see if a form
has been submitted. In other projects I've used a hidden field
"_form_submitted" which served this purpose. Something similar would be
useful in a lot of places IMHO.
Here's the patch for /Tickets/Display.html
--- /Ticket/Display.html.orig 2006-03-04 22:51:08.000000000 +0000
+++ /Ticket/Display.html 2006-07-31 21:15:23.000000000 +0000
@@ -146,11 +146,16 @@
push (@Actions, @BasicActions, @results);
}
+# only run as the result of a form submission (eg. from
/Ticket/Update.html)
+if ( $ARGS{"SubmitTicket"} ) {
+ $m->comp('/Elements/Callback', _CallbackName => 'BeforeActions',
+ TicketObj => \$TicketObj, Tickets => \$Tickets, Actions =>
\@Actions,
+ ARGSRef => \%ARGS);
+}
+
# This code does automatic redirection if any updates happen.
# It doesn't work for the client.
-
-
if (@Actions) {
# We've done something, so we need to clear the decks to avoid
# resubmission on refresh.
Thanks,
Drew
More information about the Rt-devel
mailing list