Setting the DueData upon ticket creation

Hi All,

I struggle with a (small) issue. I bet there is a simple solution for
this, however…

Here’s what I do

  1. I send an email, which has month:MM, day:DD, year:YYYY, hour:HH,
    min:NN fields in the body
  2. I want to extract those fields and create ticket’s DueDate with those
    values.

I was looking at Request Tracker Wiki?
SetTicketPropertiesViaMail

However somehow I cannot set the DueDate.

In my scrip, instead of

if( $content =~ m/^\QSet-Owner:\E\s*(\S+)\s*$/m ) {

  $self->TicketObj->SetOwner( $1 );

}

I use

if( $content =~ m/^\Qmonth:\E\s*(\S+)\s*$/m ) {

  my $month = $1;

}

and so on for every field.

However, I cannot set the DueDate later on. I tried with
$self->TicketObj->SetDue($date)

however I have problems with creating proper $date field.

Any ideas?

Michael

Michael Bochynski wrote:

Hi All,

I struggle with a (small) issue. I bet there is a simple solution for
this, however…

Here’s what I do

  1. I send an email, which has month:MM, day:DD, year:YYYY, hour:HH,
    min:NN fields in the body
  2. I want to extract those fields and create ticket’s DueDate with those
    values.

I was looking at Request Tracker Wiki?
SetTicketPropertiesViaMail

However somehow I cannot set the DueDate.

In my scrip, instead of

if( $content =~ m/^\QSet-Owner:\E\s*(\S+)\s*$/m ) {

  $self->TicketObj->SetOwner( $1 );

}

I use

if( $content =~ m/^\Qmonth:\E\s*(\S+)\s*$/m ) {

  my $month = $1;

}
If you define variable with ‘my’ then it would be local to the block
it’s defined in.
So try something like:
<<<
my ($month, $day);
if( $content =~ m/^\Qmonth:\E\s*(\S+)\s*$/im ) {
$month = $1;
}
if( $content =~ m/^\Qday:\E\s*(\S+)\s*$/im ) {
$month = $1;
}

my $date = “$month-$day”;

and so on for every field.

However, I cannot set the DueDate later on. I tried with
$self->TicketObj->SetDue($date)
don’t forget ; at the end of lines.

also I’m sure RT log has entries that scrip action has errors.
Please, analize logs.

Ruslan,

Michael Bochynski wrote:

Hi All,

I struggle with a (small) issue. I bet there is a simple solution
for
this, however…

Here’s what I do

  1. I send an email, which has month:MM, day:DD, year:YYYY, hour:HH,
    min:NN fields in the body
  2. I want to extract those fields and create ticket’s DueDate with
    those
    values.

I was looking at Request Tracker Wiki?
SetTicketPropertiesViaMail

However somehow I cannot set the DueDate.

In my scrip, instead of

if( $content =~ m/^\QSet-Owner:\E\s*(\S+)\s*$/m ) {

  $self->TicketObj->SetOwner( $1 );

}

I use

if( $content =~ m/^\Qmonth:\E\s*(\S+)\s*$/m ) {

  my $month = $1;

}
If you define variable with ‘my’ then it would be local to the block
it’s defined in.
So try something like:
<<<
my ($month, $day);
if( $content =~ m/^\Qmonth:\E\s*(\S+)\s*$/im ) {
$month = $1;
}
if( $content =~ m/^\Qday:\E\s*(\S+)\s*$/im ) {
$month = $1;
}

my $date = “$month-$day”;

and so on for every field.

However, I cannot set the DueDate later on. I tried with
$self->TicketObj->SetDue($date)
don’t forget ; at the end of lines.

:slight_smile: I know … it happens from time to time :wink:

also I’m sure RT log has entries that scrip action has errors.
Please, analize logs.

I did it …
and still problems.

When I use SetSubject ($date) it works, it sets the subject as
7-25-2005. However the same var for SetDate craps out with the following
errors:
[Fri Jul 15 16:06:45 2005] [error]: error: couldn’t parse head; error
near:
0

(/usr/local/rt3.2.1//lib/RT/Template_Overlay.pm:341)
[Fri Jul 15 16:06:46 2005] [warning]:
at /usr/local/rt3.2.1//lib/RT/Date.pm line 170
RT::date::Set(‘RT::Date=HASH(0xc774e20)’, ‘Format’, ‘ISO’,
‘Value’, ‘7-25-2006’) called
at /usr/local/rt3.2.1//lib/RT/Transaction_Overlay.pm line 694
RT::Transaction::ANON(‘RT::Transaction=HASH(0xc8aac34)’)
called at /usr/local/rt3.2.1//lib/RT/Transaction_Overlay.pm line 515
RT::Transaction::BriefDescription(‘RT::Transaction=HASH
(0xc8aac34)’) called
at /usr/local/rt3.2.1//lib/RT/Transaction_Overlay.pm line 458
RT::Transaction::Description(‘RT::Transaction=HASH(0xc8aac34)’)
called at /usr/local/rt3.2.1//lib/RT/Ticket_Overlay.pm line 3827
RT::ticket::_Set(‘RT::Ticket=HASH(0xc75d8f8)’, ‘Field’, ‘Due’,
‘Value’, ‘7-25-2006’) called
at /usr/local/lib/perl5/site_perl/5.8.4/DBIx/SearchBuilder/Record.pm
line 408
DBIx::SearchBuilder::Record::ANON(‘RT::Ticket=HASH
(0xc75d8f8)’, ‘7-25-2006’) called at (eval 22955) line 23
eval 'my $AttachObj = $self->TransactionObj->Attachments->First;

Do I have to format the $date to a date format? If so, how?

Michael Bochynski wrote:

Ruslan,

Michael Bochynski wrote:

Hi All,

[snip]

and so on for every field.

However, I cannot set the DueDate later on. I tried with
$self->TicketObj->SetDue($date)

don’t forget ; at the end of lines.

:slight_smile: I know … it happens from time to time :wink:

also I’m sure RT log has entries that scrip action has errors.
Please, analize logs.

I did it …
and still problems.

When I use SetSubject ($date) it works, it sets the subject as
7-25-2005. However the same var for SetDate craps out with the following
errors:
[Fri Jul 15 16:06:45 2005] [error]: error: couldn’t parse head; error
near:
0

(/usr/local/rt3.2.1//lib/RT/Template_Overlay.pm:341)
[Fri Jul 15 16:06:46 2005] [warning]:
at /usr/local/rt3.2.1//lib/RT/Date.pm line 170
RT::date::Set(‘RT::Date=HASH(0xc774e20)’, ‘Format’, ‘ISO’,
‘Value’, ‘7-25-2006’) called
[snip]

Do I have to format the $date to a date format? If so, how?
Date should be in ISO format. ISO: “YYYY-MM-DD hh:mm:ss”.

Hi all,
Right now there are 20 tables of RT in the database. I wanted to introduce
RI between the tables. After analysing the RT codes to an extent, i feel
that it shouldn’t impact any perl codes. If any person has more
information on this then it will be helpful.

Regards,
Ahalya Nathan
Senior Programmer / Analyst
Information Technology, Metropolitan Utilities District
(402) 449-8218 phone
(402) 449-8131 fax
ahalya_nathan@mudnebr.com

As I understand you have FK mysql schema I sent to the list.
Also RTx-Shredder distribution has rtx-validator script(which is out of
the date) and API to check RI.

MySQL(4.0.x) has bug so you can’t create some FKs in other case code RT
would fail on delete operations.

Regards, Ruslan.

Ahalya_Nathan@mudnebr.com wrote: