Bug in RTIR 1.0.6rc1

Looking at the code in /opt/rt3/share/html/RTIR/Display.html and
…/Incident/BulkReply.html. I have made the example from Display.html,
BulkReply.html has a similar code snipplet.

The Due is set when an Action is done like:

— Original code —
if (defined $ARGS{‘Action’}) {
if ($ARGS{‘Action’} =~ /^(Steal|Kill|Take|SetTold)$/) {
my $action = $1;
my ($res, $msg)=$Ticket->$action();
push(@Actions, $msg);
} elsif ($ARGS{‘Action’} eq ‘Respond’ && @UpdateActions) {
my $date = RT::Date->new($RT::SystemUser);
$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);
$ARGS{‘Due_Date’} = $date->AsString;
}
}

Here, the OverdueAfter is added and then the next BusinessHour taken:
$due = first_after(“now + OverdueAfter”) [something like this].

Now, if we have a weekend on Sat/Sun and OverdueAfter is two days, this
would result in

now = Fr 23:00, plus 2 days from Overdue = Sun 23:00, next business hour
is Mon 0:00. This leaves you 1h.

Shouldn’t that be done with $bizhours->add_seconds?
This would set the due to Tue 23:00, skipping the weekend.

— Changed code —
if (defined $ARGS{‘Action’}) {
if ($ARGS{‘Action’} =~ /^(Steal|Kill|Take|SetTold)$/) {
my $action = $1;
my ($res, $msg)=$Ticket->$action();
push(@Actions, $msg);
} elsif ($ARGS{‘Action’} eq ‘Respond’ && @UpdateActions) {
my $date = RT::Date->new($RT::SystemUser);
$date->SetToNow;
### removed: $date->AddDays($RT::OverdueAfter);
use Business::Hours;
my $bizhours = new Business::Hours;
if ($RT::BusinessHours) {
$bizhours->business_hours(%$RT::BusinessHours);
}
my $due = $bizhours->add_seconds($date->Unix, $RT::OverdueAfter *
86400); ### changed
$date->Set(Format => ‘unix’, Value => $due);
$ARGS{‘Due_Date’} = $date->AsString;
}
}

And to answer the question for feedback on RTIR 1.2: too much custom
code by now to move over :-/

Best regards,

Ruediger Riediger

Dr. Ruediger Riediger Sun Microsystems GmbH
NSG - SunCERT Komturstr. 18a
mailto:Ruediger.Riediger@Sun.com D-12099 Berlin
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
PGP 2048RSA/0x2C5020E9 964C E189 0FF0 8882 2BAB 65E2 6912 1FF2