%# The best book on programming for the layman is "Alice in Wonderland"; %# but that's because it's the best book on anything for the layman. <%INIT> my $Workflows = RT::Templates->new($session{'CurrentUser'}); my $QueueObj = RT::Queue->new($session{'CurrentUser'}); $QueueObj->Load($Queue) if $Queue; if ($QueueObj->Id) { $Workflows->LimitToQueue($Queue); } else { $Workflows->LimitToGlobal(); } $Workflows->Limit( FIELD => 'Content', VALUE => '%===Create-Ticket:%', OPERATOR => 'LIKE' ); require RT::Workflow; my $List = RT::Workflow->new($session{'CurrentUser'}); if ( $Workflows->Count ) { $List->Load($Workflows->First->Id); } else { $List->Create( Queue => $Queue, Name => ($Queue ? 'Default Approval' : 'Global Approval') ); } return $List if $LoadOnly; $m->print('