<html>
<head>
</head>
<body>
HI <br>
I'm trying to auto open tickets <u><b>onl</b></u>y  for users who don't have
ticket modification rights<br>
<br>
if I remove 
<pre class="moz-signature" cols="$mailwrapcol">$self->TicketObj->CurrentUserHasRight('ModifyTicket')</pre>
it works, otherwise I get following error in rt.log<br>
<pre class="moz-signature" cols="$mailwrapcol">[Fri Apr 30 05:57:34 2004] [info]: RT::Scrip=HASH(0x9606ec8): Couldn't prepare Open Tickets for Users (/usr/local/apps/rt-3.0.8//lib/RT/Scrip_Overlay.pm:346)</pre>
Is it possible to access the current users from the scrip action???<br>
<br>
Thanks<br>
--------------------------------------------------------------------------------------<br>
<pre class="moz-signature" cols="$mailwrapcol">package RT::Action::AutoOpenForUsers;<br>require RT::Action::Generic;<br><br>use strict;<br>use vars qw/@ISA/;<br>@ISA=qw(RT::Action::Generic);<br><br>#Do what we need to do and send it out.<br><br>#What does this type of Action does<br><br># {{{ sub Describe<br>sub Describe  {<br>  my $self = shift;<br>  return (ref $self );<br>}<br># }}}<br><br><br># {{{ sub Prepare<br>sub Prepare {<br>    my $self = shift;<br><br>    # if the user has status change right don't auto change it for them<br>    # if the ticket is already open or new then don't (re)open either.<br><br>    if ( ($self->TicketObj->CurrentUserHasRight('ModifyTicket'))<br>         || ( $self->TicketObj->Status eq 'open' )<br>         || ( $self->TicketObj->Status eq 'new' ) ) {<br><br>        return undef;<br>    }<br>    else {<br>        return (1);<br>    }<br>}<br># }}}<br><br>sub Commit {<br>    my $self = shift;<br>    my $oldstatus = $self-&gt
;TicketObj->Status();<br><br>    my $newstatus = ($oldstatus eq 'stalled') ? 'open' : 'new';<br><br>    $self->TicketObj->__Set( Field => 'Status', Value => $newstatus );<br>    $self->TicketObj->_NewTransaction(<br>                         Type     => 'Status',<br>                         Field    => 'Status',<br>                         OldValue => $oldstatus,<br>                         NewValue => $newstatus,<br>                         Data => 'Ticket auto-opened ticket for users'<br>        );<br><br><br>    return(1);<br>}<br><br>eval "require RT::Action::AutoOpenForUsers_Vendor";<br>die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/AutoOpenForUsers_Vendor.pm});<br>eval "require RT::Action::AutoOpenForUsers_Local";<br>die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/AutoOpenForUsers_Local.pm});<br><br>1;<br><br>mysql> select * from ScripActions where id=16;<br>+----+------------------------+-----------------------
---------+------------------+----------+---------+---------+---------------+-------------+<br>| id | Name                   | Description                    | ExecModule       | Argument | Creator | Created | LastUpdatedBy | LastUpdated |<br>+----+------------------------+--------------------------------+------------------+----------+---------+---------+---------------+-------------+<br>| 16 | Open Tickets for Users | Open tickets on correspondence | AutoOpenForUsers | NULL     |       0 | NULL    |             0 | NULL        |<br>+----+------------------------+--------------------------------+------------------+----------+---------+---------+---------------+-------------+<br><br><br><br><br>-- 


warm regards
Vinita Vigine Murugiah
Email : <a class="moz-txt-link-abbreviated" href="mailto:vinita@cs.mu.oz.au">vinita@cs.mu.oz.au</a>                     Ph : (03) 8344 1273
</pre>
</body>
</html>