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

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Wed Sep 15 04:25:26 EDT 2004


Author: leira
Date: Wed Sep 15 04:25:26 2004
New Revision: 1488

Added:
   rtir/branches/1.1/lib/RT/
   rtir/branches/1.1/lib/RT/Action/
   rtir/branches/1.1/lib/RT/Action/RTIR_ChangeChildOwnership.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_ChangeParentOwnership.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_OpenParent.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_ResolveChildren.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_SetDueBySLA.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_SetDueCorrespond.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_SetDueToNow.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_SetDue_Correspond
   rtir/branches/1.1/lib/RT/Action/RTIR_SetHowReported.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_SetStartsByBizHours.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_SetStartsToNow.pm
   rtir/branches/1.1/lib/RT/Action/RTIR_UnsetDue.pm
Modified:
   rtir/branches/1.1/etc/initialdata
Log:
Move most RTIR ScripActions into .pm files, for easier maintainability.


Modified: rtir/branches/1.1/etc/initialdata
==============================================================================
--- rtir/branches/1.1/etc/initialdata	(original)
+++ rtir/branches/1.1/etc/initialdata	Wed Sep 15 04:25:26 2004
@@ -265,6 +265,54 @@
     },
 );
 
+ at ScripActions = (
+
+    {  Name        => 'Set Due to Now',    # loc
+       Description => 'Set the due date to the current time' ,                                            # loc
+       ExecModule => 'RTIR_SetDueToNow',
+    },
+    {  Name        => 'Set Starts to Now',    # loc
+       Description => 'Set the starts date to the current time' ,                                            # loc
+       ExecModule => 'RTIR_SetStartsToNow',
+    },
+    {  Name        => 'Set Due by SLA',    # loc
+       Description => 'Set the due date according to SLA' ,                                            # loc
+       ExecModule => 'RTIR_SetDueBySLA',
+    },
+    {  Name        => 'Set Due Correspond',    # loc
+       Description => 'Set the due date for correspondence' ,                                            # loc
+       ExecModule => 'RTIR_SetDueCorrespond',
+    },
+    {  Name        => 'Unset Due',    # loc
+       Description => 'Unset the due date' ,                                            # loc
+       ExecModule => 'RTIR_UnsetDue',
+    },
+    {  Name        => 'Set Starts by Business Hours',    # loc
+       Description => 'Set the starts date according to Business Hours' ,                                            # loc
+       ExecModule => 'RTIR_SetStartsByBizHours',
+    },
+    {  Name        => 'Set How Reported',    # loc
+       Description => 'Set how the Incident Report was reported' ,                                            # loc
+       ExecModule => 'RTIR_SetHowReported',
+    },
+    {  Name        => 'Resolve Children',    # loc
+       Description => "Resolve an Incident's children",                                            # loc
+       ExecModule => 'RTIR_ResolveChildren',
+    },
+    {  Name        => 'Change Child Ownership',    # loc
+       Description => "Change the ownership of Incident's children",                                            # loc
+       ExecModule => 'RTIR_ChangeChildOwnership',
+    },
+    {  Name        => 'Change Parent Ownership',    # loc
+       Description => 'Change the ownership of the parent Incident' ,                                            # loc
+       ExecModule => 'RTIR_ChangeParentOwnership',
+    },
+    {  Name        => 'Open Parent',    # loc
+       Description => 'Open the parent Incident when a child reopens' ,                                            # loc
+       ExecModule => 'RTIR_OpenParent',
+    },
+);
+
 @Scrips = (
     {  Description    => 'NotifyOnLaunch',
        Queue          => 'Investigations',
@@ -278,266 +326,208 @@
        Template       => 'NewMessage' },
     {  Description => "DetectUserResponse",
        Queue          => 'Incident Reports',
-       ScripCondition => 'On Correspond',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
 # ------------------------------------------------------------------- #
-if ($self->TicketObj->Owner ne $self->TransactionObj->Creator) {
-  my $date = RT::Date->new($RT::SystemUser);
-  $date->SetToNow;
-  $self->TicketObj->SetDue($date->ISO);
+if ($self->TransactionObj->Type eq 'Correspond' && 
+    $self->TicketObj->Owner ne $self->TransactionObj->Creator) {
+    return 1;
+} else {
+    return 0;
 }
-  return 1;
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+# ------------------------------------------------------------------- #	],
+       ScripAction      => 'Set Due to Now',
        Template       => 'Blank' },
     {  Description => "DetectUserResponse",
        Queue            => 'Investigations',
-       ScripCondition => 'On Correspond',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
 # ------------------------------------------------------------------- #
-if ($self->TicketObj->Owner ne $self->TransactionObj->Creator) {
-  my $date = RT::Date->new($RT::SystemUser);
-  $date->SetToNow;
-  $self->TicketObj->SetDue($date->ISO);
+if ($self->TransactionObj->Type eq 'Correspond' && 
+    $self->TicketObj->Owner ne $self->TransactionObj->Creator) {
+    return 1;
+} else {
+    return 0;
 }
-  return 1;
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+# ------------------------------------------------------------------- #	],
+       ScripAction      => 'Set Due to Now',
        Template       => 'Blank' },
     {  Description => "DetectUserResponse",
        Queue            => 'Blocks',
-       ScripCondition => 'On Correspond',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
 # ------------------------------------------------------------------- #
-if ($self->TicketObj->Owner ne $self->TransactionObj->Creator) {
-  my $date = RT::Date->new($RT::SystemUser);
-  $date->SetToNow;
-  $self->TicketObj->SetDue($date->ISO);
+if ($self->TransactionObj->Type eq 'Correspond' && 
+    $self->TicketObj->Owner ne $self->TransactionObj->Creator) {
+    return 1;
+} else {
+    return 0;
 }
-  return 1;
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+# ------------------------------------------------------------------- #	],
+       ScripAction      => 'Set Due to Now',
        Template       => 'Blank' },
     {  Description => "SetStartsDate",
        Queue            => 'Incidents',
        ScripCondition => 'On Create',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-if ($self->TicketObj->StartsObj->AsString eq "Not set") {
-  my $date = RT::Date->new($RT::SystemUser);
-  $date->SetToNow;
-  $self->TicketObj->SetStarts($date->ISO);
-}
-  return 1;
-# ------------------------------------------------------------------- #	],
+       ScripAction      => 'Set Starts to Now',
        CustomPrepareCode => '1',
        Template       => 'Blank' },
-    {  Description => "SetDates",
+    {  Description => "SetDue",
        Queue            => 'Incident Reports',
        ScripCondition => 'On Create',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-my $sla;
-my $date = RT::Date->new($RT::SystemUser);
-$date->SetToNow;
-use Business::Hours;
-my $bizhours = new Business::Hours;
-if ($RT::BusinessHours) {
-  $bizhours->business_hours(%$RT::BusinessHours);
-}
-
-if ($self->TicketObj->FirstCustomFieldValue('_RTIR_SLA')) {
-  $sla = $self->TicketObj->FirstCustomFieldValue('_RTIR_SLA');
-} elsif ($bizhours->first_after($date->Unix) != $date->Unix) {
-  $sla = "Full service: out of hours";
-} else {
-  $sla = "Full service";
-}
-
-my $addminutes = $RT::SLA->{$sla};
-if ($self->TicketObj->StartsObj->AsString eq "Not set") {
-  my $starts = $bizhours->first_after($date->Unix);
-  $date->Set(Format => 'unix', Value => $starts);
-  $self->TicketObj->SetStarts($date->ISO);
-  my $due = $bizhours->add_seconds($date->Unix, $addminutes * 60);
-  $date->Set(Format => 'unix', Value => $due);
-  $self->TicketObj->SetDue($date->ISO);
-}
-my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
-$cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA');
-unless ($cf->Id) { 
-    return(1);
-}
-$self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $sla);
-return 1;
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Set Due by SLA',
+       Template       => 'Blank' },
+    {  Description => "SetStarts",
+       Queue            => 'Incident Reports',
+       ScripCondition => 'On Create',
+       ScripAction      => 'Set Starts by Business Hours',
        Template       => 'Blank' },
-    {  Description => "SetDates",
+    {  Description => "SetStarts",
        Queue            => 'Investigations',
        ScripCondition => 'On Create',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-my $date = RT::Date->new($RT::SystemUser);
-$date->SetToNow;
-if ($self->TicketObj->StartsObj->AsString eq "Not set") {
-  $self->TicketObj->SetStarts($date->ISO);
-}
-if ($self->TicketObj->DueObj->AsString eq "Not set") {
-  $date->AddDays($RT::OverdueAfter);
-  use Business::Hours;
-  my $bizhours = new Business::Hours;
-  if ($RT::BusinessHours) {
-    $bizhours->business_hours(%$RT::BusinessHours);
-  }
-  my $due = $bizhours->first_after($date->Unix);
-  $date->Set(Format => 'unix', Value => $due);
-  $self->TicketObj->SetDue($date->ISO);
-}
-  return 1;
-# ------------------------------------------------------------------- #	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Set Starts by Business Hours',
        Template       => 'Blank' },
-    {  Description => "SetDates",
+    {  Description => "SetStarts",
        Queue            => 'Blocks',
        ScripCondition => 'On Create',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-my $date = RT::Date->new($RT::SystemUser);
-$date->SetToNow;
-if ($self->TicketObj->StartsObj->AsString eq "Not set") {
-  $self->TicketObj->SetStarts($date->ISO);
-}
-if ($self->TicketObj->DueObj->AsString eq "Not set") {
-  $date->AddDays($RT::OverdueAfter);
-  use Business::Hours;
-  my $bizhours = new Business::Hours;
-  if ($RT::BusinessHours) {
-    $bizhours->business_hours(%$RT::BusinessHours);
-  }
-  my $due = $bizhours->first_after($date->Unix);
-  $date->Set(Format => 'unix', Value => $due);
-  $self->TicketObj->SetDue($date->ISO);
-}
-  return 1;
-# ------------------------------------------------------------------- #	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Set Starts by Business Hours',
+       Template       => 'Blank' },
+    {  Description => "SetDue",
+       Queue            => 'Investigations',
+       ScripCondition => 'On Create',
+       ScripAction      => 'Set Due Correspond',
+       Template       => 'Blank' },
+    {  Description => "SetDue",
+       Queue            => 'Blocks',
+       ScripCondition => 'On Create',
+       ScripAction      => 'Set Due Correspond',
        Template       => 'Blank' },
     {  Description => "UnsetDue",
        Queue            => 'Incident Reports',
-       ScripCondition => 'On Status Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
 # ------------------------------------------------------------------- #
-my $date = RT::Date->new($RT::SystemUser);
-if ($self->TransactionObj->NewValue eq 'rejected' ||
-    $self->TransactionObj->NewValue eq 'resolved') {
-  $date->Set(Format => 'unix', Value=> 0);
-  $self->TicketObj->SetDue($date->ISO);
-} elsif ( ( $self->TransactionObj->OldValue eq 'rejected' ||
-            $self->TransactionObj->OldValue eq 'resolved') &&
-           $self->TransactionObj->NewValue eq 'open') {
-  $date->SetToNow;
-  use Business::Hours;
-  my $bizhours = new Business::Hours;
-  if ($RT::BusinessHours) {
-    $bizhours->business_hours(%$RT::BusinessHours);
-  }
-  my $due = $bizhours->first_after($date->Unix);
-  $date->Set(Format => 'unix', Value => $due);
-  $self->TicketObj->SetDue($date->ISO);
-}
+if (($self->TransactionObj->Type eq "Status" or
+    ($self->TransactionObj->Type eq "Set" and 
+     $self->TransactionObj->Field eq "Status")) and
+     ($self->TransactionObj->NewValue eq 'rejected' ||
+      $self->TransactionObj->NewValue eq 'resolved')) {
   return 1;
-# ------------------------------------------------------------------- #	],
-       CustomPrepareCode => '1',
+} else {
+  return 0;
+}
+# ------------------------------------------------------------------- # ],
+       ScripAction      => 'Unset Due',
        Template       => 'Blank' },
     {  Description => "UnsetDue",
        Queue            => 'Investigations',
-       ScripCondition => 'On Status Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
 # ------------------------------------------------------------------- #
-my $date = RT::Date->new($RT::SystemUser);
-if ($self->TransactionObj->NewValue eq 'rejected' ||
-    $self->TransactionObj->NewValue eq 'resolved') {
-  $date->Set(Format => 'unix', Value=> 0);
-  $self->TicketObj->SetDue($date->ISO);
-} elsif ( ( $self->TransactionObj->OldValue eq 'rejected' ||
-            $self->TransactionObj->OldValue eq 'resolved') &&
-           $self->TransactionObj->NewValue eq 'open') {
-  $date->SetToNow;
-  use Business::Hours;
-  my $bizhours = new Business::Hours;
-  if ($RT::BusinessHours) {
-    $bizhours->business_hours(%$RT::BusinessHours);
-  }
-  my $due = $bizhours->first_after($date->Unix);
-  $date->Set(Format => 'unix', Value => $due);
-  $self->TicketObj->SetDue($date->ISO);
+if (($self->TransactionObj->Type eq "Status" or
+    ($self->TransactionObj->Type eq "Set" and 
+     $self->TransactionObj->Field eq "Status")) and
+     ($self->TransactionObj->NewValue eq 'rejected' ||
+      $self->TransactionObj->NewValue eq 'resolved')) {
+  return 1;
+} else {
+  return 0;
 }
-
-return 1;
-# ------------------------------------------------------------------- #	],
-       CustomPrepareCode => '1',
+# ------------------------------------------------------------------- # ],
+       ScripAction      => 'Unset Due',
        Template       => 'Blank' },
     {  Description => "UnsetDue",
        Queue            => 'Blocks',
-       ScripCondition => 'On Status Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
 # ------------------------------------------------------------------- #
-my $date = RT::Date->new($RT::SystemUser);
-if ($self->TransactionObj->NewValue eq 'open' ||
-    $self->TransactionObj->NewValue eq 'rejected' ||
-    $self->TransactionObj->NewValue eq 'resolved') {
-  $date->Set(Format => 'unix', Value=> 0);
-  $self->TicketObj->SetDue($date->ISO);
-} elsif ($self->TransactionObj->NewValue eq 'stalled') {
-  $date->SetToNow;
-  $date->AddDays($RT::OverdueAfter);
-  use Business::Hours;
-  my $bizhours = new Business::Hours;
-  if ($RT::BusinessHours) {
-    $bizhours->business_hours(%$RT::BusinessHours);
-  }
-  my $due = $bizhours->first_after($date->Unix);
-  $date->Set(Format => 'unix', Value => $due);
-  $self->TicketObj->SetDue($date->ISO);
+if ($self->TransactionObj->Type eq "Status" or
+   ($self->TransactionObj->Type eq "Set" and 
+    $self->TransactionObj->Field eq "Status")) and
+    ($self->TransactionObj->NewValue eq 'open' ||
+     $self->TransactionObj->NewValue eq 'rejected' ||
+     $self->TransactionObj->NewValue eq 'resolved') {
+  return 1;
+} else {
+  return 0;
 }
+# ------------------------------------------------------------------- # ],
+       ScripAction      => 'Unset Due',
+       Template       => 'Blank' },
+    {  Description => "UnsetDue",
+       Queue            => 'Blocks',
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
+# ------------------------------------------------------------------- #
+if ($self->TransactionObj->Type eq "Status" or
+   ($self->TransactionObj->Type eq "Set" and 
+    $self->TransactionObj->Field eq "Status")) and
+    ($self->TransactionObj->NewValue eq 'stalled') {
   return 1;
-# ------------------------------------------------------------------- #	],
-       CustomPrepareCode => '1',
+} else {
+  return 0;
+}
+# ------------------------------------------------------------------- # ],
+       ScripAction      => 'Set Due Correspond',
        Template       => 'Blank' },
-    {  Description => "SetHowReported",
+    {  Description => "SetDueReopen",
        Queue            => 'Incident Reports',
-       ScripCondition => 'On Create',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
 # ------------------------------------------------------------------- #
-my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
-$cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_HowReported');
-unless ($cf->Id) { 
-    return(1);
-}
-my $Values = $self->TicketObj->CustomFieldValues($cf->id);
-if (!$Values->Next) {
-  $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => "Email");
+if (($self->TransactionObj->Type eq "Status" or
+    ($self->TransactionObj->Type eq "Set" and 
+     $self->TransactionObj->Field eq "Status")) and
+     (( $self->TransactionObj->OldValue eq 'rejected' ||
+        $self->TransactionObj->OldValue eq 'resolved') &&
+      $self->TransactionObj->NewValue eq 'open')) {
+  return 1;
+} else {
+  return 0;
 }
+# ------------------------------------------------------------------- # ],
+       ScripAction      => 'Set Due by SLA',
+       Template       => 'Blank' },
+    {  Description => "SetDueReopen",
+       Queue            => 'Investigations',
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
+# ------------------------------------------------------------------- #
+if (($self->TransactionObj->Type eq "Status" or
+    ($self->TransactionObj->Type eq "Set" and 
+     $self->TransactionObj->Field eq "Status")) and
+     (( $self->TransactionObj->OldValue eq 'rejected' ||
+        $self->TransactionObj->OldValue eq 'resolved') &&
+      $self->TransactionObj->NewValue eq 'open')) {
   return 1;
+} else {
+  return 0;
+}
+# ------------------------------------------------------------------- # ],
+       ScripAction      => 'Set Due by SLA',
+       Template       => 'Blank' },
+    {  Description => "SetDueReopen",
+       Queue            => 'Blocks',
+       ScripCondition => 'User Defined',
+       CustomIsApplicableCode => q[
 # ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+if (($self->TransactionObj->Type eq "Status" or
+    ($self->TransactionObj->Type eq "Set" and 
+     $self->TransactionObj->Field eq "Status")) and
+     (( $self->TransactionObj->OldValue eq 'rejected' ||
+        $self->TransactionObj->OldValue eq 'resolved') &&
+      $self->TransactionObj->NewValue eq 'open')) {
+  return 1;
+} else {
+  return 0;
+}
+# ------------------------------------------------------------------- # ],
+       ScripAction      => 'Set Due by SLA',
+       Template       => 'Blank' },
+    {  Description => "SetHowReported",
+       Queue            => 'Incident Reports',
+       ScripCondition => 'On Create',
+       ScripAction      => 'Set How Reported',
        Template       => 'Blank' },
     {  Description => "SetRTIRState",
        Queue            => 'Blocks',
@@ -719,229 +709,42 @@
     {  Description => "ResolveAllChildren",
        Queue            => 'Incidents',
        ScripCondition   => 'On Status Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-if ($self->TransactionObj->NewValue eq 'resolved' or 
-    $self->TransactionObj->NewValue eq 'rejected') {
-  my $members = $self->TicketObj->Members;
-  while (my $link = $members->Next) {
-    my $member= $link->BaseObj;
-    if ($member->QueueObj->Name eq 'Blocks' or
-        $member->QueueObj->Name eq 'Investigations' or
-        $member->QueueObj->Name eq 'Incident Reports') {
-      $member->Resolve();
-    }
-  }
-}
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Resolve Children',
        Template          => 'Blank', },
     {  Description => "FixOwnership",
        Queue            => 'Incidents',
        ScripCondition   => 'On Owner Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-{
-  # change owner of child Incident Reports, Investigations, Blocks
-  while (my $link = $self->TicketObj->Members->Next) {
-    my $member= $link->BaseObj;
-    if ( ($member->QueueObj->Name eq 'Incident Reports' ||
-          $member->QueueObj->Name eq 'Investigations' ||
-          $member->QueueObj->Name eq 'Blocks' ) &&
-          $member->OwnerObj->id != $self->TransactionObj->NewValue) {
-      my ($res, $msg); 
-      my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
-      $user->Load($self->TransactionObj->Creator);
-      my $t = new RT::Ticket($user);
-      $t->Load($member->id);
-      if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
-        if ($self->TransactionObj->CurrentUser->id == $RT::Nobody->id) {
-          ($res, $msg) = $t->Take();
-        } else {
-          ($res, $msg) = $t->Steal();
-	}
-      } else {
-          ($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
-      }
-      $RT::Logger->debug("FixOwnership Scrip: ".$msg)
-    }
-  }
-  return 1;
-}
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Change Child Ownership',
        Template          => 'Blank', },
     {  Description => "FixOwnership",
        Queue            => 'Incident Reports',
        ScripCondition   => 'On Owner Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-{
-  # change owner of parent Incident(s)
-  while (my $link = $self->TicketObj->MemberOf->Next) {
-    my $incident= $link->TargetObj;
-    if ( $incident->QueueObj->Name eq 'Incidents' &&
-         $incident->OwnerObj->id != $self->TransactionObj->NewValue) {
-      my ($res, $msg); 
-      my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
-      $user->Load($self->TransactionObj->Creator);
-      my $t = new RT::Ticket($user);
-      $t->Load($incident->id);
-      if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
-          ($res, $msg) = $t->Steal();
-      } else {
-          ($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
-      }
-      $RT::Logger->debug("FixOwnership Scrip: ".$msg)
-    }
-  }
-  return 1;
-}
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Change Parent Ownership',
        Template          => 'Blank', },
     {  Description => "FixOwnership",
        Queue            => 'Investigations',
        ScripCondition   => 'On Owner Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-{
-  # change owner of parent Incident(s)
-  while (my $link = $self->TicketObj->MemberOf->Next) {
-    my $incident= $link->TargetObj;
-    if ( $incident->QueueObj->Name eq 'Incidents' &&
-         $incident->OwnerObj->id != $self->TransactionObj->NewValue) {
-      my ($res, $msg); 
-      my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
-      $user->Load($self->TransactionObj->Creator);
-      my $t = new RT::Ticket($user);
-      $t->Load($incident->id);
-      if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
-          ($res, $msg) = $t->Steal();
-      } else {
-          ($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
-      }
-      $RT::Logger->debug("FixOwnership Scrip: ".$msg)
-    }
-  }
-  return 1;
-}
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Change Parent Ownership',
        Template          => 'Blank', },
     {  Description => "FixOwnership",
        Queue            => 'Blocks',
        ScripCondition   => 'On Owner Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-{
-  # change owner of parent Incident(s)
-  while (my $link = $self->TicketObj->MemberOf->Next) {
-    my $incident= $link->TargetObj;
-    if ( $incident->QueueObj->Name eq 'Incidents' &&
-         $incident->OwnerObj->id != $self->TransactionObj->NewValue) {
-      my ($res, $msg); 
-      my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
-      $user->Load($self->TransactionObj->Creator);
-      my $t = new RT::Ticket($user);
-      $t->Load($incident->id);
-      if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
-          ($res, $msg) = $t->Steal();
-      } else {
-          ($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
-      }
-      $RT::Logger->debug("FixOwnership Scrip: ".$msg)
-    }
-  }
-  return 1;
-}
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Change Parent Ownership',
        Template          => 'Blank', },
     {  Description => "ReopenIncident",
        Queue            => 'Incident Reports',
        ScripCondition   => 'On Status Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-# If if the child becomes not-closed, make sure the Incident is re-opened
-if ($self->TransactionObj->NewValue ne 'rejected' &&
-    $self->TransactionObj->NewValue ne 'resolved') {
-  my $parents = $self->TicketObj->MemberOf;
-  while (my $link = $parents->Next) {
-    my $member = $link->TargetObj;
-    if ($member->QueueObj->Name eq 'Incidents') {
-      if ($member->Status eq 'rejected' ||
-          $member->Status eq 'resolved') {
-        $member->Open();
-      }
-    }
-  }
-}
-return 1;
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Open Parent',
        Template          => 'Blank', },
     {  Description => "ReopenIncident",
        Queue            => 'Investigations',
        ScripCondition   => 'On Status Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-# If if the child becomes not-closed, make sure the Incident is re-opened
-if ($self->TransactionObj->NewValue ne 'rejected' &&
-    $self->TransactionObj->NewValue ne 'resolved') {
-  my $parents = $self->TicketObj->MemberOf;
-  while (my $link = $parents->Next) {
-    my $member = $link->TargetObj;
-    if ($member->QueueObj->Name eq 'Incidents') {
-      if ($member->Status eq 'rejected' ||
-          $member->Status eq 'resolved') {
-        $member->Open();
-      }
-    }
-  }
-}
-return 1;
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Open Parent',
        Template          => 'Blank', },
     {  Description => "ReopenIncident",
        Queue            => 'Blocks',
        ScripCondition   => 'On Status Change',
-       ScripAction      => 'User Defined',
-       CustomCommitCode => q[
-# ------------------------------------------------------------------- #
-# If if the child becomes not-closed, make sure the Incident is re-opened
-if ($self->TransactionObj->NewValue ne 'rejected' &&
-    $self->TransactionObj->NewValue ne 'resolved') {
-  my $parents = $self->TicketObj->MemberOf;
-  while (my $link = $parents->Next) {
-    my $member = $link->TargetObj;
-    if ($member->QueueObj->Name eq 'Incidents') {
-      if ($member->Status eq 'rejected' ||
-          $member->Status eq 'resolved') {
-        $member->Open();
-      }
-    }
-  }
-}
-return 1;
-# ------------------------------------------------------------------- #
-	],
-       CustomPrepareCode => '1',
+       ScripAction      => 'Open Parent',
        Template          => 'Blank', },
 );
 

Added: rtir/branches/1.1/lib/RT/Action/RTIR_ChangeChildOwnership.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_ChangeChildOwnership.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,111 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_ChangeChildOwnership;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Change the ownership of children.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    # change owner of child Incident Reports, Investigations, Blocks
+    while (my $link = $self->TicketObj->Members->Next) {
+	my $member= $link->BaseObj;
+	if ( ($member->QueueObj->Name eq 'Incident Reports' ||
+	      $member->QueueObj->Name eq 'Investigations' ||
+	      $member->QueueObj->Name eq 'Blocks' ) &&
+	     $member->OwnerObj->id != $self->TransactionObj->NewValue) {
+	    my ($res, $msg); 
+	    my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
+	    $user->Load($self->TransactionObj->Creator);
+	    my $t = new RT::Ticket($user);
+	    $t->Load($member->id);
+	    if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
+		if ($self->TransactionObj->CurrentUser->id == $RT::Nobody->id) {
+		    ($res, $msg) = $t->Take();
+		} else {
+		    ($res, $msg) = $t->Steal();
+		}
+	    } else {
+		($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
+	    }
+	}
+    }
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_ChangeChildOwnership_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_ChangeChildOwnership_Vendor.pm});
+eval "require RT::Action::RTIR_ChangeChildOwnership_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_ChangeChildOwnership_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_ChangeParentOwnership.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_ChangeParentOwnership.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,105 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_ChangeParentOwnership;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Change the ownership of parent incident.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    # change owner of parent Incident(s)
+    while (my $link = $self->TicketObj->MemberOf->Next) {
+	my $incident= $link->TargetObj;
+	if ( $incident->QueueObj->Name eq 'Incidents' &&
+	     $incident->OwnerObj->id != $self->TransactionObj->NewValue) {
+	    my ($res, $msg); 
+	    my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
+	    $user->Load($self->TransactionObj->Creator);
+	    my $t = new RT::Ticket($user);
+	    $t->Load($incident->id);
+	    if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
+		($res, $msg) = $t->Steal();
+	    } else {
+		($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
+	    }
+	}
+    }
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_ChangeParentOwnership_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_ChangeParentOwnership_Vendor.pm});
+eval "require RT::Action::RTIR_ChangeParentOwnership_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_ChangeParentOwnership_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_OpenParent.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_OpenParent.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,102 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_OpenParent;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Re-open the parent incident
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    # If the child becomes not-closed, make sure the Incident is re-opened
+    if ($self->TransactionObj->NewValue ne 'rejected' &&
+	$self->TransactionObj->NewValue ne 'resolved') {
+	my $parents = $self->TicketObj->MemberOf;
+	while (my $link = $parents->Next) {
+	    my $member = $link->TargetObj;
+	    if ($member->QueueObj->Name eq 'Incidents') {
+		if ($member->Status eq 'rejected' ||
+		    $member->Status eq 'resolved') {
+		    $member->Open();
+		}
+	    }
+	}
+    }
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_OpenParent_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_OpenParent_Vendor.pm});
+eval "require RT::Action::RTIR_OpenParent_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_OpenParent_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_ResolveChildren.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_ResolveChildren.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,102 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetResolveChildren;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Check if the Incident is being closed.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    if ($self->TransactionObj->NewValue eq 'resolved' or 
+	$self->TransactionObj->NewValue eq 'rejected') {
+	return 1;
+    } else {
+	return 0;
+    }
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Resolve all children.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $members = $self->TicketObj->Members;
+    while (my $link = $members->Next) {
+	my $member= $link->BaseObj;
+	if ($member->QueueObj->Name eq 'Blocks' or
+	    $member->QueueObj->Name eq 'Investigations' or
+	    $member->QueueObj->Name eq 'Incident Reports') {
+	    $member->Resolve();
+	}
+    }
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_SetResolveChildren_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetResolveChildren_Vendor.pm});
+eval "require RT::Action::RTIR_SetResolveChildren_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetResolveChildren_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_SetDueBySLA.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_SetDueBySLA.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,127 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetDueBySLA;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Look up the SLA and set the Due date accordingly.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $date = RT::Date->new($RT::SystemUser);
+    $date->SetToNow;
+    use Business::Hours;
+    my $bizhours = new Business::Hours;
+    if ($RT::BusinessHours) {
+	$bizhours->business_hours(%$RT::BusinessHours);
+    }
+
+    my $sla;
+    if ($self->TicketObj->FirstCustomFieldValue('_RTIR_SLA')) {
+	$sla = $self->TicketObj->FirstCustomFieldValue('_RTIR_SLA');
+    } elsif ($bizhours->first_after($date->Unix) != $date->Unix) {
+	$sla = "Full service: out of hours";
+    } else {
+	$sla = "Full service";
+    }
+
+    # now that we know the SLA, set the value
+    my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
+    $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA');
+    unless ($cf->Id) { 
+	return(1);
+    }
+    $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $sla);
+
+    # look up how many minutes to add for this SLA
+    my $addminutes = $RT::SLA->{$sla};
+
+    # find the next business time
+    my $starts = $bizhours->first_after($date->Unix);
+    $date->Set(Format => 'unix', Value => $starts);
+
+    # add the SLA minutes to that
+    my $due = $bizhours->add_seconds($date->Unix, $addminutes * 60);
+    $date->Set(Format => 'unix', Value => $due);
+
+    # set the due date
+    $self->TicketObj->SetDue($date->ISO);
+
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_SetDueBySLA_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetDueBySLA_Vendor.pm});
+eval "require RT::Action::RTIR_SetDueBySLA_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetDueBySLA_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_SetDueCorrespond.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_SetDueCorrespond.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,112 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetDueCorrespond;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Look up the SLA and set the Due date accordingly.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $bizhours = $self->GetBusinessHours();
+
+    my $date = RT::Date->new($RT::SystemUser);
+    $date->SetToNow;
+
+    $date->AddDays($RT::OverdueAfter);
+
+    my $due = $bizhours->first_after($date->Unix);
+    $date->Set(Format => 'unix', Value => $due);
+    $self->TicketObj->SetDue($date->ISO);
+
+    return 1;
+
+}
+
+# }}}
+
+sub GetBusinessHours {
+    my $self = shift;
+
+    use Business::Hours;
+    my $bizhours = new Business::Hours;
+    if ($RT::BusinessHours) {
+	$bizhours->business_hours(%$RT::BusinessHours);
+    }
+
+    return $bizhours;
+}
+
+eval "require RT::Action::RTIR_SetDueCorrespond_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetDueCorrespond_Vendor.pm});
+eval "require RT::Action::RTIR_SetDueCorrespond_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetDueCorrespond_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_SetDueToNow.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_SetDueToNow.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,96 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetDueToNow;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Determine if it's a User Response.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    if ($self->TicketObj->Owner ne $self->TransactionObj->Creator) {
+	return 1;
+    } else {
+	return 0;
+    }
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Set the Due date to now.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $date = RT::Date->new($RT::SystemUser);
+    $date->SetToNow;
+    $self->TicketObj->SetDue($date->ISO);
+
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_SetDueToNow_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetDueToNow_Vendor.pm});
+eval "require RT::Action::RTIR_SetDueToNow_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetDueToNow_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_SetDue_Correspond
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_SetDue_Correspond	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,117 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetDatesBySLA;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Look up the SLA and set the Due date accordingly.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $date = RT::Date->new($RT::SystemUser);
+    $date->SetToNow;
+    use Business::Hours;
+    my $bizhours = new Business::Hours;
+    if ($RT::BusinessHours) {
+	$bizhours->business_hours(%$RT::BusinessHours);
+    }
+
+    my $sla;
+    if ($self->TicketObj->FirstCustomFieldValue('_RTIR_SLA')) {
+	$sla = $self->TicketObj->FirstCustomFieldValue('_RTIR_SLA');
+    } elsif ($bizhours->first_after($date->Unix) != $date->Unix) {
+	$sla = "Full service: out of hours";
+    } else {
+	$sla = "Full service";
+    }
+
+    my $addminutes = $RT::SLA->{$sla};
+    my $due = $bizhours->add_seconds($date->Unix, $addminutes * 60);
+    $date->Set(Format => 'unix', Value => $due);
+    $self->TicketObj->SetDue($date->ISO);
+
+    my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
+    $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA');
+    unless ($cf->Id) { 
+	return(1);
+    }
+    $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $sla);
+
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_SetDatesBySLA_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetDatesBySLA_Vendor.pm});
+eval "require RT::Action::RTIR_SetDatesBySLA_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetDatesBySLA_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_SetHowReported.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_SetHowReported.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,97 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetHowReported;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+If the HowReported field isn't set, assume it's email.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
+    $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_HowReported');
+    unless ($cf->Id) { 
+	return(1);
+    }
+    my $Values = $self->TicketObj->CustomFieldValues($cf->id);
+    if (!$Values->Next) {
+	$self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => "Email");
+    }
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_SetHowReported_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetHowReported_Vendor.pm});
+eval "require RT::Action::RTIR_SetHowReported_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetHowReported_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_SetStartsByBizHours.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_SetStartsByBizHours.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,113 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetStartsByBizHours;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Determine if the Starts date is already set.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    if ($self->TicketObj->StartsObj->AsString eq "Not set") {
+	return 1;
+    } else {
+	return 0;
+    }
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Look up the SLA and set the Starts and Due dates accordingly.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $date = RT::Date->new($RT::SystemUser);
+    $date->SetToNow;
+
+    my $bizhours = $self->GetBusinessHours();
+
+    my $starts = $bizhours->first_after($date->Unix);
+    $date->Set(Format => 'unix', Value => $starts);
+    $self->TicketObj->SetStarts($date->ISO);
+
+    return 1;
+}
+
+# }}}
+
+sub GetBusinessHours {
+    my $self = shift;
+
+    use Business::Hours;
+    my $bizhours = new Business::Hours;
+    if ($RT::BusinessHours) {
+	$bizhours->business_hours(%$RT::BusinessHours);
+    }
+
+    return $bizhours;
+}
+
+eval "require RT::Action::RTIR_SetStartsByBizHours_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetStartsByBizHours_Vendor.pm});
+eval "require RT::Action::RTIR_SetStartsByBizHours_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetStartsByBizHours_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_SetStartsToNow.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_SetStartsToNow.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,96 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_SetStartsToNow;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Determine if the Starts date is already set.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    if ($self->TicketObj->StartsObj->AsString eq "Not set") {
+	return 1;
+    } else {
+	return 0;
+    }
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Set the Starts date to now.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $date = RT::Date->new($RT::SystemUser);
+    $date->SetToNow;
+    $self->TicketObj->SetStarts($date->ISO);
+
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_SetStartsToNow_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetStartsToNow_Vendor.pm});
+eval "require RT::Action::RTIR_SetStartsToNow_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_SetStartsToNow_Local.pm});
+
+1;

Added: rtir/branches/1.1/lib/RT/Action/RTIR_UnsetDue.pm
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/lib/RT/Action/RTIR_UnsetDue.pm	Wed Sep 15 04:25:26 2004
@@ -0,0 +1,93 @@
+# {{{ BEGIN BPS TAGGED BLOCK
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# }}} END BPS TAGGED BLOCK
+#
+package RT::Action::RTIR_UnsetDue;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+=head2 Prepare
+
+Always run this.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+
+    return 1;
+}
+
+# {{{ sub Commit
+
+=head2 Commit
+
+Set the Due date accordingly.
+
+=cut
+
+sub Commit {
+    my $self = shift;
+
+    my $date = RT::Date->new($RT::SystemUser);
+
+    $date->Set(Format => 'unix', Value=> 0);
+    $self->TicketObj->SetDue($date->ISO);
+
+    return 1;
+}
+
+# }}}
+
+eval "require RT::Action::RTIR_UnsetDue_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_UnsetDue_Vendor.pm});
+eval "require RT::Action::RTIR_UnsetDue_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RTIR_UnsetDue_Local.pm});
+
+1;


More information about the Rt-commit mailing list