[Rt-commit] r4240 - in rtir/branches/1.9-EXPERIMENTAL: .
lib/RT/Action
ruz at bestpractical.com
ruz at bestpractical.com
Sun Dec 4 19:08:14 EST 2005
Author: ruz
Date: Sun Dec 4 19:08:13 2005
New Revision: 4240
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueBySLA.pm
Log:
r419 at cubic-pc: cubic | 2005-12-05 03:09:08 +0300
r398 at cubic-pc: cubic | 2005-12-04 13:32:45 +0300
* use one time value for all changes
Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueBySLA.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueBySLA.pm (original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueBySLA.pm Sun Dec 4 19:08:13 2005
@@ -74,23 +74,20 @@
sub Commit {
my $self = shift;
+ my $time = time;
# TODO: return if it isn't an Incident Report
# now that we know the SLA, set the value of the CF
- if (! $self->TicketObj->FirstCustomFieldValue('_RTIR_SLA')) {
- my $cf = RT::CustomField->new($self->CurrentUser);
+ unless ( $self->TicketObj->FirstCustomFieldValue('_RTIR_SLA') ) {
+ my $cf = RT::CustomField->new( $self->CurrentUser );
+ $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA');
+ return unless $cf->Id;
- $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA');
- unless ($cf->Id) {
- return(1);
- }
+ my $SLAObj = RT::IR::SLAInit();
+ my $sla = $SLAObj->SLA( $time );
- my $SLAObj = RT::IR::SLAInit();
- my $sla = $SLAObj->SLA(time());
-
- $self->TicketObj->AddCustomFieldValue(Field => $cf->id,
- Value => $sla);
+ $self->TicketObj->AddCustomFieldValue( Field => $cf->id, Value => $sla );
}
@@ -98,11 +95,11 @@
my $SLAObj = RT::IR::SLAInit();
# TODO: specify a start date, but default to now
- my $due = $SLAObj->Due(time(), $SLAObj->SLA(time()));
+ my $due = $SLAObj->Due( $time, $SLAObj->SLA( $time ) );
- my $date = RT::Date->new($RT::SystemUser);
- $date->Set(Format => 'unix', Value => $due);
- $self->TicketObj->SetDue($date->ISO);
+ my $date = RT::Date->new( $RT::SystemUser );
+ $date->Set( Format => 'unix', Value => $due );
+ $self->TicketObj->SetDue( $date->ISO );
return 1;
}
More information about the Rt-commit
mailing list