Hi there, another question about RT-Extension-SLA. First of all i must tell you that I´m really a starter with Perl. I have to modify the Extension because we need some kind of "floating" SLA.
When a ticket arrives before 12.00 am it´s necessary to set SLA to next day 23:59:59, if it arrives later than 12.00 am i need to set it two days later 23:59:59. I used the function SetToMidnight with the due date as Argument. So I´ve tried to get the difference between these two dates, if it is more than 12 hours than the ticket was created later than 12 am, if less, earlier than 12 am. Here´s some code I´ve started with, so maybe you can tell me how I can finish it ?? use strict; use warnings; package RT::Action::SLA_SetFloatingDue; use RT::Date; use Time::Local; use base qw(RT::Action::SLA); =head2 Prepare Checks if the ticket has service level defined. =cut sub Prepare { my $self = shift; unless ( $self->TicketObj->FirstCustomFieldValue('SLA') ) { $RT::Logger->error('SLA::SetDue scrip has been applied to ticket #' . $self->TicketObj->id . ' that has no SLA defined'); return 0; } return 1; } =head2 Commit Set the Due date accordingly to SLA. =cut sub Commit { my $self = shift; my $ticket = $self->TicketObj; my $due=$ticket->DueObj; my $midnight = RT::Date::SetToMidnight($due); $midnight = $midnight->Unix; $due = $due->Unix; my $diff = RT::Date::Diff($due,$midnight); $RT::Logger->debug("Midnight" . $midnight); # This is only for test reasons, later we have to change it to correct settings return $self->TicketObj->SetDue($due); } 1; And this is the error message : [error]: Scrip Commit 25 died. - Undefined subroutine &RT::Action::SLA_SetFloatingDue::Diff called at /opt/rt3/local/plugins/RT-Exten sion-SLA/lib/RT/Action/SLA_SetFloatingDue.pm line 47.
_______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com 2010 RT Training Sessions! San Francisco, CA, USA - Feb 22 & 23 Dublin, Ireland - Mar 15 & 16 Boston, MA, USA - April 5 & 6 Washington DC, USA - Oct 25 & 26 Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com