[rt-devel] KeywordSelect --requiring a value before a ticket can be created.

Colleen colleen at darksideproductions.net
Tue Jul 9 15:08:03 EDT 2002


I figured this out.

In case anyone is interested:
In Ticket.pm in the subroutine Create, I added:
	KeywordSelect-9 => undef, 
in my %args.

Put $KeywordSelectObj in your initialization line:
      my ($ErrStr, $QueueObj, $KeywordSelectObj, $Owner, $resolved);


Then to force a Keyword to be selected, I also added in the sub Create:

    if (defined($args{'KeywordSelect-9'})) {
        $KeywordSelectObj=RT::KeywordSelect->new($RT::SystemUser);
        $KeywordSelectObj->Load($args{'KeywordSelect-9'});
    }

    unless (defined ($KeywordSelectObj)) {
        $RT::Logger->debug( "$self No Action City given for ticket
creation.");
        return (0, 0,"Could not create ticket. Action City not set".);
    }


This works for multi- and single value KeywordSelects.
(My KeywordSelect-9 is for Action Cities)

--colleen

> -----Original Message-----
> From: Colleen
> Sent: Tuesday, July 02, 2002 2:35 PM
> To: rt-devel at lists.fsck.com
> Subject: [rt-devel] KeywordSelect
> 
> I'm making some modifications in Ticket.pm so that a KeywordSelect-9
> needs to be defined before a ticket can be created.
> 
> In the list of Create (ARGS)  KeywordSelect-<id> is there, but does
> anyone know how I can use it?
> 
> 
> From the comments in Ticket.pm:
> "KeywordSelect-<id> -- an array of keyword ids for that keyword
select"
> 
> I should reference this in my %args, right?
> 
> How do I test whether it has been defined?
> 
> This isn't working:
> 
>     unless (defined (KeywordSelectMagic9)) {
>         $RT::Logger->debug( "$self No Action City given for ticket
> creation.");
>         return (0, 0,'Could not create ticket. Action City not set');
>     }
> 
> Thanks for any help with this.
> 
> 




More information about the Rt-devel mailing list