[rt-users] setting the DueData upon ticket creation

Michael Bochynski mbochynski at audiumcorp.com
Fri Jul 15 12:23:02 EDT 2005


Ruslan,

On Fri, 2005-07-15 at 11:32 -0400, Ruslan U. Zakirov wrote:
> 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 http://wiki.bestpractical.com/index.cgi?
> > 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.

:) I know .. it happens from time to time ;)
> 
> 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?

> 
> >
> > however I have problems with creating proper $date field.
> >
> > Any ideas?
> >
> > Michael
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >
> > Be sure to check out the RT Wiki at http://wiki.bestpractical.com
> >
> 
> 
> 



More information about the rt-users mailing list