Setting the Due Date upon ticket creation ... REVISITIED

RT version 3.4.1
MySQL version 4.1

I cannot set the due date of my ticket as explained in the wiki at:

 http://wiki.bestpractical.com/index.cgi?SetTicketPropertiesViaMail

Actually, I do not see the Scrip referenced in the RT log at all!

Would anybody be able to point me in the right direction???

I have set up the scrip in my queue as follows:

Description: Set Due Date
Condition: On Correspond
Action: User Defined
Template: Global Template: BLANK
Stage: Transaction Create

Custom condition: (I have nothing here)

Custom action preparation code:
my $content = $AttachObj->Content;

my $AttachObj = $self->TransactionObj->Attachments->First;

go out if content is not text!

unless( $AttachObj->ContentType =~ /^text/ ) {
return 1;
}

if( $content =~ m/^\QSet-Start:\E\s*(\S+)\s*$/m ) {
$self->TicketObj->SetDue($1);
}

strip special commands from email content

$content =~ s/^\QSet-Start:\E\s*(\S+)\s*$//gm;

silently overwrite attachment content

$AttachObj->__Set( Field => ‘Content’, Value => $content );

1;

Custom action cleanup code: (I also have nothing here)

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET

RT version 3.4.1
MySQL version 4.1

I cannot set the due date of my ticket as explained in the wiki at:

 http://wiki.bestpractical.com/index.cgi?SetTicketPropertiesViaMail

Actually, I do not see the Scrip referenced in the RT log at all!
This is impossible, because of error in your scrip, see below.
I can imagine only one thing your scrip never triggers condition.

Would anybody be able to point me in the right direction???

I have set up the scrip in my queue as follows:

Description: Set Due Date
Condition: On Correspond
Action: User Defined
Template: Global Template: BLANK
Stage: Transaction Create

Custom condition: (I have nothing here)

Custom action preparation code:
my $content = $AttachObj->Content;
$AttachObj is not defined!!!

[snip]
Best regards, Ruslan.

I have it working just fine, however I use several steps to actually
create the due date from bits and pieces. Users on the web form, outside
RT, can set up the date using drop down boxes. If you want, I can share
the scrip with you.

One thing i encountered, that if you choose the time to, let’s say, 9pm
and month to November, it automatically changes the hour, based on the
daylight saving changes. Can I set it somewhere in RT, so it will not
apply daylight changes?

Additionally, I want to set up the Subject, however it seems that the
line
if( $content =~ m/^\QSet-Subject:\E\s*(\S+)\s*$/m ) {
$some_var = $1;
}

doesn’t work if in the email “Set-Subject: DATA” DATA has whitespaces.
Is it the expression not working properly with whitespaces or something else?

MichaelOn Wed, 2005-07-27 at 13:07 -0500, Ennis William McCaffrey wrote:

RT version 3.4.1
MySQL version 4.1

I cannot set the due date of my ticket as explained in the wiki at:

 http://wiki.bestpractical.com/index.cgi?SetTicketPropertiesViaMail

Actually, I do not see the Scrip referenced in the RT log at all!

Would anybody be able to point me in the right direction???

I have set up the scrip in my queue as follows:

Description: Set Due Date
Condition: On Correspond
Action: User Defined
Template: Global Template: BLANK
Stage: Transaction Create

Custom condition: (I have nothing here)

Custom action preparation code:
my $content = $AttachObj->Content;

my $AttachObj = $self->TransactionObj->Attachments->First;

go out if content is not text!

unless( $AttachObj->ContentType =~ /^text/ ) {
return 1;
}

if( $content =~ m/^\QSet-Start:\E\s*(\S+)\s*$/m ) {
$self->TicketObj->SetDue($1);
}

strip special commands from email content

$content =~ s/^\QSet-Start:\E\s*(\S+)\s*$//gm;

silently overwrite attachment content

$AttachObj->__Set( Field => ‘Content’, Value => $content );

1;

Custom action cleanup code: (I also have nothing here)

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET


The rt-users Archives

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Ruslan:

I’ve changed the Scrip to read as follows, but it still does not work.

Do I have the $AttachObj defined correctly here?

Custom action preparation code:
my $AttachObj = $self->TransactionObj->Attachments->First;

go out if content is not text!

unless( $AttachObj->ContentType =~ /^text/ ) {
return 1;
}

my $content = $AttachObj->Content;
if( $content =~ m/^\QSet-Start:\E\s*(\S+)\s*$/m ) {
$self->TicketObj->SetDue($1);
}

strip special commands from email content

$content =~ s/^\QSet-Start:\E\s*(\S+)\s*$//gm;

silently overwrite attachment content

$AttachObj->__Set( Field => ‘Content’, Value => $content );

1;

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET

Michael:

I have a web form (written in PHP) which allows a user to enter information and
have an email sent to the appropriate queue, which opens a ticket in RT in that
queue.

I have as the first line of the email the following:

	Set-Start: 2005-January-01 00:00:00

However, the Script never gets run (I see nothing referenced in the RT log for
my Script number which is 175)

And (of course) nothing ever gets done since the scrip never runs.

Based upon what Rsuland says I wonder if I actually have two independent
problems:

  1. that the script never runs

and

  1. that the scrip doesn’t do what I want it to

And of course I need to tackle number 1 first.

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET

Michael, Ruslan:

I changed the PHP code to set the first line of the email as follows:

Set-Start: 2005-01-01 00:00:00

However the scrip still does not execute.

Any suggestions on getting the scrip to execute in the first place?

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET

Michael:

I have a web form (written in PHP) which allows a user to enter information and
have an email sent to the appropriate queue, which opens a ticket in RT in that
queue.

I have as the first line of the email the following:

            Set-Start: 2005-January-01 00:00:00

However, the Script never gets run (I see nothing referenced in the RT log for
my Script number which is 175)

And (of course) nothing ever gets done since the scrip never runs.

Based upon what Rsuland says I wonder if I actually have two independent
problems:

  1. that the script never runs
    Check this first. Start from debug log level. See
    http://wiki.bestpractical.com/?Debug

and

  1. that the scrip doesn’t do what I want it to

And of course I need to tackle number 1 first.

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET


The rt-users Archives

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Best regards, Ruslan.

Ruslan:

My site config is as follows concerning logging:

Mail loops will generate a critical log message.

Set($LogToSyslog , ‘debug’);
Set($LogToScreen , ‘error’);
Set($LogToFile , debug);
Set($LogDir, ‘/usr/local/rt3/var/log’);
Set($LogToFileNamed , “rt.log”); #log to rt.log

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET

And which I’ve just changed to the following (since I noticed no ;'s on one
debug statement):

Mail loops will generate a critical log message.

Set($LogToSyslog , ‘debug’);
Set($LogToScreen , ‘error’);
Set($LogToFile , ‘debug’);
Set($LogDir, ‘/usr/local/rt3/var/log’);
Set($LogToFileNamed , “rt.log”); #log to rt.log

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET

So if you don’t see anything about your scrip in the log then RT never runs it.On 7/27/05, Ennis William McCaffrey ennis@mail.twcgb.net wrote:

Ruslan:

My site config is as follows concerning logging:

Mail loops will generate a critical log message.

Set($LogToSyslog , ‘debug’);
Set($LogToScreen , ‘error’);
Set($LogToFile , debug);
Set($LogDir, ‘/usr/local/rt3/var/log’);
Set($LogToFileNamed , “rt.log”); #log to rt.log

Ennis McCaffrey

Best regards, Ruslan.

Do you know that you have to restart apache when you change Config file?On 7/27/05, Ennis William McCaffrey ennis@mail.twcgb.net wrote:

And which I’ve just changed to the following (since I noticed no ;'s on one
debug statement):

And make sure that RT actually logs anything to the log file :slight_smile:
Make sure that your RT/web server has W access to this file

MichaelOn Wed, 2005-07-27 at 15:16 -0400, Ruslan Zakirov wrote:

So if you don’t see anything about your scrip in the log then RT never
runs it.

On 7/27/05, Ennis William McCaffrey ennis@mail.twcgb.net wrote:

Ruslan:

My site config is as follows concerning logging:

Mail loops will generate a critical log message.

Set($LogToSyslog , ‘debug’);
Set($LogToScreen , ‘error’);
Set($LogToFile , debug);
Set($LogDir, ‘/usr/local/rt3/var/log’);
Set($LogToFileNamed , “rt.log”); #log to rt.log

Ennis McCaffrey


Best regards, Ruslan.

Ruslan:

Yes, I just restarted it.

The scrip still does not run.

I’m going to check the mailing list archives for references on why scripts do
not run.

Thanks, Ruslan!

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET

Michael:

Yes, the log is being written to:

-rw-rw-rw- 1 root root 3084921 Jul 27 14:17 rt.log

Probably not the best ownership and permissions; but it is getting written to.

Ennis McCaffrey

Time Warner Cable
Digital Network Engineer

1001 West Kennedy Avenue
PO Box 145
Kimberly, WI 54136

(920) 831-9220 Office
(920) 378-0416 Cell

Ennis@Mail.TWCGB.NET

Hi,

Michael, Ruslan:

I changed the PHP code to set the first line of the email as follows:

Set-Start: 2005-01-01 00:00:00

That’s your text from email?
When I have the spaces in the line, scrip fails to load the text after
the “Set-Start:” and there is nothing in the logs. I wanted to use it
for setting a subject, but if a text has spaces, the scrip does not pick
up the text.

Ruslan, any ideas?

However the scrip still does not execute.

Exactly the same behavior I have when there are spaces after “:”

Michael