<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=915042516-09022006><FONT face=Arial
color=#0000ff size=2>What doesn't work about it? It doesn't reset the
date? It always resets the date even if information was already filled
out?</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Cristiano da Costa
[mailto:crsurf@gmail.com] <BR><B>Sent:</B> Thursday, February 09, 2006 5:33
AM<BR><B>To:</B> Schultz, Eric<BR><B>Cc:</B>
rt-users@lists.bestpractical.com<BR><B>Subject:</B> Re: [rt-users] Filling
Dates fields with scrip<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Hello Eric<BR></DIV>
<DIV> </DIV>
<DIV>I want to set a different SLA if user filled the field Start, bellow is
my code, but doesnīt work.<BR><BR>Can you give me some tip?<BR></DIV>
<DIV> </DIV>
<DIV>
<P>my $now = RT::Date->new($RT::SystemUser);<BR>my $sla =
RT::Date->new($RT::SystemUser);<BR>$now->SetToNow;<BR>$sla->SetToNow;<BR>$sla->AddSeconds(+14400);</P>
<P>if ( $self->TicketObj->Starts eq '1970-01-01 00:00:00' )
{<BR>$self->TicketObj->SetStarts( $now->ISO );<BR>}<BR>else {<BR>$sla
= $self->TicketObj->Starts;<BR>$sla->AddSeconds(+14400);<BR>}</P>
<P>if ( $self->TicketObj->Started eq '1970-01-01 00:00:00' )
{<BR>$self->TicketObj->SetStarted( $now->ISO );<BR>}<BR>if (
$self->TicketObj->Due eq '1970-01-01 00:00:00' )
{<BR>$self->TicketObj->SetDue( $sla->ISO ); <BR>}<BR>return 1;</P>
<P>Sds</P>
<P>Cristiano</P></DIV><BR><BR>
<DIV><SPAN class=gmail_quote>On 2/1/06, <B class=gmail_sendername>Schultz,
Eric</B> <<A
href="mailto:ESchultz@corp.untd.com">ESchultz@corp.untd.com</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">I
don't think the dates will ever be 'undef'. Instead, check for a
default date. I believe that date is '1970-01-01 00:00:00' in our
system.<BR><BR>if ( $self->TicketObj->Started eq '1970-01-01 00:00:00'
)
{<BR><BR><BR>________________________________<BR><BR> From:
<A
href="mailto:rt-users-bounces@lists.bestpractical.com">rt-users-bounces@lists.bestpractical.com</A>
[mailto:<A href="mailto:rt-users-bounces@lists.bestpractical.com">
rt-users-bounces@lists.bestpractical.com</A>] On Behalf Of Cristiano da
Costa<BR> Sent: Wednesday,
February 01, 2006 8:31
AM<BR> To: <A
href="mailto:rt-users@lists.bestpractical.com">rt-users@lists.bestpractical.com
</A><BR> Subject: [rt-users]
Filling Dates fields with
scrip<BR><BR><BR><BR> Hello<BR><BR> I
want to fill the fields Starts, Started and Due after ticket creation, for
this Iīm using the code bellow on custom action in "on create" condition
<BR><BR><BR> my $now =
RT::Date->new($RT::SystemUser);<BR> my
$sla =
RT::Date->new($RT::SystemUser);<BR> $now->SetToNow;<BR> $sla->SetToNow;<BR> $sla->AddSeconds(+3600);<BR> $self->TicketObj->SetStarts(
$now->ISO
);<BR> $self->TicketObj->SetStarted(
$now->ISO
);<BR> $self->TicketObj->SetDue(
$sla->ISO );<BR> return
1;<BR><BR> This works, but if
user that create tickts already fill these fields I donīt want to overwrite
the user information, I tryed the following code in place of the code above,
but doesnīt work. <BR><BR> my
$now =
RT::Date->new($RT::SystemUser);<BR> my
$sla =
RT::Date->new($RT::SystemUser);<BR> $now->SetToNow;<BR> $sla->SetToNow;<BR> $sla->AddSeconds(+3600);<BR> if
( $self->TicketObj->Starts == undef ){
<BR> $self->TicketObj->SetStarts(
$now->ISO
);<BR> }<BR> if
( $self->TicketObj->Started == undef
){<BR> $self->TicketObj->SetStarted(
$now->ISO
);<BR> }<BR> if
( $self->TicketObj->Due == undef ){
<BR> $self->TicketObj->SetDue(
$sla->ISO
);<BR> }<BR> return
1;<BR><BR> How can I test if
user already fill these
fields?<BR><BR><BR><BR> Thanks<BR><BR><BR><BR> Cristiano
<BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>