AutoOpen If <status>

This may be old hat, but I found this useful to do and can’t see any harm
in it becoming the default.

This change allows ‘Open If New’ etc conditions to be trivially
created.

[Context - I want to ‘On Owner Change’ ‘Open If New’ - since if a reply
from RT AutoTakes the ticket (another local change) and resolves it the
simpler ‘On Owner Change’ ‘Open’ causes it to become reopened,
undesireably]

John

*** AutoOpen.pm.orig 2003-12-11 18:22:54.000000000 +0000
— AutoOpen_Local.pm 2003-12-11 18:23:28.000000000 +0000
*** 1,6 ****
— 1,11 ----

  • {{{ sub Prepare

    sub Prepare {
    my $self = shift;

  • # If passed an argument, don't autoopen unless status matches it.
    
  • my $arg = $self->Argument;
    
  • return unless ($arg && $self->TicketObj->Status eq $arg);
    # if the ticket is already open or the ticket is new and the message
    

is more mail from the
# requestor, don’t reopen it.

*** 17,19 ****
— 22,28 ----
}

1;

  • return (1);
    
  • }
  • 1;

This part of the patch looks odd. :slight_smile: Where’s the open
bracket for the close bracket?

This part of the patch looks odd. :slight_smile: Where’s the open
bracket for the close bracket?


*** 17,19 ****
— 22,28 ----
}

1;

  • return (1);
    
  • }
  • 1;

Um yes - deliberate mistake left as an exercise for the reader. [Cut and
paste error

This should be cleaner:

*** 1,6 ****
— 1,11 ----
sub Prepare {
my $self = shift;

  • # If passed an argument, don't autoopen unless status matches it.
    
  • my $arg = $self->Argument;
    
  • return undef unless ($arg && $self->TicketObj->Status eq $arg);
    # if the ticket is already open or the ticket is new and the
    

message is more mail from the
# requestor, don’t reopen it.

]

Caveat - because of the IsInbound in AutoOpen.pm, ‘On Owner Change’ ‘Open
If New’ doesn’t work if the new owner is also the requestor. Unlikely to
matter often, but may cause confusion.

John