[rt-users] Forcing Status Changes

Mario Gomide mario.gomide at agricultura.gov.br
Mon Jul 30 10:33:13 EDT 2007


Hey everyone!

I'm still trying to solve this problem.
The scrip is working fine: Only the pre-defined changes of status are 
accepted. Other pre-defined status changes are denied

The problem is that whenever a denied change occurs, the result message 
is: Status changed from A to B.

I've tried to do some modifications to Transaction_Overlay.pm in the 
part bellow, but with no success.

    elsif ( $type =~ /Status/ ) {
        if ( $self->Field eq 'Status' ) {
            if ( $self->NewValue eq 'deleted' ) {
                return ( $self->loc( "[_1] deleted", $obj_type ) );
            }
            else {
                return (
                    $self->loc(
                        "Status changed from [_1] to [_2]",
                        "'" . $self->loc( $self->OldValue ) . "'",
                        "'" . $self->loc( $self->NewValue ) . "'"
                    )
                );

            }
        }

So, what should I do?

Thanks to all.
Mario Gomide


Mario Gomide wrote:
> Hi Kenn, hi Gene!
>
> I had some trouble with the logging part, but I fixed it. Then I had 
> this problem:
> [error]: Scrip Prepare XX died. - Undefined subroutine 
> &Scalar::Util::weaken called at 
> /usr/local/rt3/lib/RT/Action/Generic.pm line 107.
>
> This was also fixed after updating Scalar::Util via CPAN with the 
> command:
> #cpan -fi Scalar::Util
> but still got nothing... so I rebooted and it began to work, and now 
> my scrip is running and logging.
>
> Apparently, the scrip is working fine, and now back to my original 
> problem: When a ticket with status "A" cannot change to status "B", 
> the result text shows that this status change occurred (Status changed 
> from A to B), even though it in fact didn't ocurr (the status is 
> unchanged).
> How can I, in this case, show an error message like "ERROR: Status 
> cannot be changed from A to B! Status remains A." on the results part 
> after modifying a ticket?
> I've tried to set in the scrip, inside the "if" statement:
> return $self->loc("TEXT TELLING THE USER HE CANT CHANGE FROM STATUS A 
> TO B");
> but my text doesn't appear... since I'm sort of new to perl and 
> customizing RT, this was like a blind guess...
>
> Any ideas?
> Anyway, thanks so much for your help so far!
>
> Mario
>
>
> Kenneth Crocker escreveu:
>> Mario,
>>
>>
>>     Gene is right (he helped me a bunch when I created several scrips 
>> that change ticket status for a workflow design)). The entries to 
>> your log will help a great deal. I had several scrips that made 
>> several changes (one at a time) and when it ran into an error, the 
>> status did not get changed. I'd take a look at your log and see what 
>> is happening. That will help in debugging your code.
>>
>>
>> Kenn
>> LBNL
>



More information about the rt-users mailing list