[Rt-commit] [svn] r1571 - in rtir/branches/1.1-TESTING: etc lib/RT/Action

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Mon Sep 27 23:18:52 EDT 2004


Author: leira
Date: Mon Sep 27 23:18:52 2004
New Revision: 1571

Modified:
   rtir/branches/1.1-TESTING/etc/RTIR_Config.pm
   rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueBySLA.pm
   rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueToNow.pm
Log:
RT-Ticket: 6085
RT-Status: resolved
RT-Action: correspond
When a correspondence comes in, set the due date to a configurable value, not just "now."

By default, it's "now within business hours", i.e. now if it's in business hours, or the next business minute if it's outside of business hours.


Modified: rtir/branches/1.1-TESTING/etc/RTIR_Config.pm
==============================================================================
--- rtir/branches/1.1-TESTING/etc/RTIR_Config.pm	(original)
+++ rtir/branches/1.1-TESTING/etc/RTIR_Config.pm	Mon Sep 27 23:18:52 2004
@@ -27,12 +27,18 @@
 	   'Reduced service' =>  { BusinessMinutes => 120, 
 				   RealMinutes => 0,
 			       },
+	   'Now (in business hours)' =>  { BusinessMinutes => 0, 
+					   RealMinutes => 0,
+			       },
 #	   '60 Real Minutes' =>  { BusinessMinutes => undef, 
 #				   RealMinutes => 60,
 #			       },
        }
     );
 
+# Set the SLA for responses
+Set ($SLA_Response_InHours, 'Now (in business hours)');
+Set ($SLA_Response_OutOfHours, 'Now (in business hours)');
 
 # Set the defaults for RTIR custom fields
 # default values are case-sensitive

Modified: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueBySLA.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueBySLA.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueBySLA.pm	Mon Sep 27 23:18:52 2004
@@ -81,7 +81,7 @@
     if (! $self->TicketObj->FirstCustomFieldValue('_RTIR_SLA')) {
 	my $cf = RT::CustomField->new($self->CurrentUser);
 
-	$cf->LoadByNameAndQueue(Queue => $self->QueueObj->Id, Name => '_RTIR_SLA');
+	$cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA');
 	unless ($cf->Id) { 
 	    return(1);
 	}

Modified: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueToNow.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueToNow.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueToNow.pm	Mon Sep 27 23:18:52 2004
@@ -79,8 +79,28 @@
 sub Commit {
     my $self = shift;
 
+    use RT::IR;
+
+    # create a new SLA object
+    my $SLAObj = RT::IR::SLAInit();
+
+    # set the Business::Hours
+    my $bh = RT::IR::BusinessHours();
+
+    # Set the defaults from the RTIR_Config.pm file
+    print STDERR "Setting in hours: " . $RT::SLA_Response_InHours . "\n";
+    print STDERR "Setting out of hours: " . $RT::SLA_Response_OutOfHours . "\n";
+
+    $SLAObj->SetInHoursDefault($RT::SLA_Response_InHours);
+    $SLAObj->SetOutOfHoursDefault($RT::SLA_Response_OutOfHours);
+
+    $SLAObj->SetBusinessHours($bh);
+
+    # get the due date
+    my $due = $SLAObj->Due(time(), $SLAObj->SLA(time()));
+
     my $date = RT::Date->new($RT::SystemUser);
-    $date->SetToNow;
+    $date->Set(Format => 'unix', Value => $due);
     $self->TicketObj->SetDue($date->ISO);
 
     return 1;


More information about the Rt-commit mailing list