[Rt-commit] r8663 - rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action
ruz at bestpractical.com
ruz at bestpractical.com
Tue Aug 21 06:52:08 EDT 2007
Author: ruz
Date: Tue Aug 21 06:52:04 2007
New Revision: 8663
Modified:
rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueToNow.pm
Log:
* a little bit of debugging
* just run actions, now check
* other minor things
Modified: rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueToNow.pm
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueToNow.pm (original)
+++ rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueToNow.pm Tue Aug 21 06:52:04 2007
@@ -47,27 +47,28 @@
package RT::Action::RTIR_SetDueToNow;
use strict;
+use warnings;
+
use RT::IR;
use base 'RT::Action::RTIR';
-=head2 Prepare
+=head1 NAME
-Determine if it's a User Response.
+RT::Action::RTIR_SetDueToNow - set due date to now
-=cut
+=head1 DESCRIPTION
+Set Due date of a ticket to now.
-sub Prepare {
- my $self = shift;
+=head1 METHODS
- if ($self->TicketObj->Owner ne $self->TransactionObj->Creator) {
- return 1;
- } else {
- return 0;
- }
-}
+=head2 Prepare
-# {{{ sub Commit
+Always commit action.
+
+=cut
+
+sub Prepare { return 1 }
=head2 Commit
@@ -78,30 +79,25 @@
sub Commit {
my $self = shift;
- # create a new SLA object
my $SLAObj = RT::IR::SLAInit();
-
- # Set the defaults from the RTIR_Config.pm file
$SLAObj->SetInHoursDefault(RT->Config->Get('SLA_Response_InHours'));
$SLAObj->SetOutOfHoursDefault(RT->Config->Get('SLA_Response_OutOfHours'));
-
- # set the Business::Hours
- my $bh = RT::IR::BusinessHours();
- $SLAObj->SetBusinessHours($bh);
+ $SLAObj->SetBusinessHours( RT::IR::BusinessHours() );
# get the due date
my $time = 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);
+ $date->Set( Format => 'unix', Value => $due );
+ my ($status, $msg) = $self->TicketObj->SetDue( $date->ISO );
+ $RT::Logger->error($msg) unless $status;
+
+ $RT::Logger->debug( "Set Due to now: ". $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";
More information about the Rt-commit
mailing list