[rt-users] Subject required

David Chandek-Stark david.chandek.stark at duke.edu
Mon Sep 29 15:56:20 EDT 2008


I happened to be working on this at the moment b/c the addition of the 
WYSIWYG editor in RT 3.8 broke my previous client-side method of requiring 
a description in a new ticket. After concluding that the client side 
methods were not very sustainable, I decided to try my hand at a 
server-side validation method. What I came up with uses the "Initial" 
callback of /Ticket/Display.html (haven't yet looked at the SelfService 
UI) and appears to work:

<%INIT>
if ( defined($ARGSRef->{'id'}) && ($ARGSRef->{'id'} eq 'new') && 
     defined($ARGSRef->{'Subject'}) && ($ARGSRef->{'Subject'} eq '')
   ) {
    my $msg = 'Ticket creation error: Subject required.';
    my $QueueObj = new RT::Queue($session{'CurrentUser'});
    $QueueObj->Load($ARGSRef->{'Queue'}) || Abort(loc("Queue could not be 
loaded."));
    my $key = Digest::MD5::md5_hex( rand(1024) );
    push @{ $session{"Actions"}->{$key} ||= [] }, $msg;
    $session{'i'}++;
    RT::Interface::Web::Redirect( RT->Config->Get('WebURL') . 
"Ticket/Create.html?Queue=" . $QueueObj->id . "&results=" . $key );
}
</%INIT>
<%ARGS>
$ARGSRef
$TicketObj
</%ARGS>

Some of this code I copied from /Ticket/Display.html w/o completely 
understanding how it works ...

Cheers,
David

rt-users-bounces at lists.bestpractical.com wrote on 09/29/2008 08:43:50 AM:

> On Mon, Sep 29, 2008 at 02:38:43PM +0200, Emmanuel Lacour wrote:
> > On Mon, Sep 29, 2008 at 02:18:09PM +0200, Marco Avvisano wrote:
> > > 
> > >  It's possible in 3.8.1 configure a way to ensure that a ticket 
> will always 
> > > have a Subject?
> > > 
> > 
> > No, you have to modify RT. I think there is an example at
> > http://wiki.bestpractical.com/.
> > 
> 
>  http://wiki.bestpractical.com/view/MandatorySubject
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> 
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20080929/9efd8cb7/attachment.htm>


More information about the rt-users mailing list