<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="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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>