Due date is not set when number of days is above 21

I have a problem where the due date does not get set when the number of days is above 22.
The following is the config:

‘Business Hours’ => {
1 => { Name => ‘Monday’, Start => ‘08:00’, End => ‘16:30’ },
2 => { Name => ‘Tuesday’, Start => ‘08:00’, End => ‘16:30’ },
3 => { Name => ‘Wednesday’, Start => ‘08:00’, End => ‘16:30’ },
4 => { Name => ‘Thursday’, Start => ‘08:00’, End => ‘16:30’ },
5 => { Name => ‘Friday’, Start => ‘08:00’, End => ‘16:30’ },
}

‘22-BDays’ => {
Resolve => { BusinessMinutes => 8.5 * 60 * 22 },
BusinessHours => ‘Business Hours’,
}

However, with a config like the one below where it’s 21 days, the due date is set as expected.

‘21-BDays’ => {
Resolve => { BusinessMinutes => 8.5 * 60 * 21 },
BusinessHours => ‘Business Hours’,
}

Is there a reason why the due date would not be set when the number of days is more than 21?

I believe it’s a bug, not sure if it’s been fixed. Where the business hours module only handles up to some value in one computation. So where ever the conversion from 22 days is made into business hours time, you need to split that up into a couple of conversions

Thank you for your response, I suspected it could be a bug as I saw nothing in the config that could influence this. I wonder if we can expect to have a fix soon, or if one may submit a pull request. Perhaps I can take a crack at it.

My quick look says a fix would look something like this:

diff --git a/lib/RT/SLA.pm b/lib/RT/SLA.pm
index 791e76dc0..0cc649808 100644
--- a/lib/RT/SLA.pm
+++ b/lib/RT/SLA.pm
@@ -191,8 +191,9 @@ sub CalculateTime {
                             my $bhours = $self->BusinessHours( $agreement->{ 'BusinessHours' } );
                             my $time = $bhours->between( $last_time, $txn->CreatedObj->Unix );
                             if ( $time > 0 ) {
-                                $res = $bhours->add_seconds( $res, $time );
-                            }
+                                for my $i (0..3) {
+                                    $res = $bhours->add_seconds( $res, $time / 4 );
+                                }
                         }
                         else {
                             my $time = $txn->CreatedObj->Unix - $last_time;
@@ -209,9 +210,9 @@ sub CalculateTime {

         if ( defined $agreement->{'BusinessMinutes'} ) {
             if ( $agreement->{'BusinessMinutes'} ) {
-                $res = $bhours->add_seconds(
-                    $res, 60 * $agreement->{'BusinessMinutes'},
-                );
+                    for my $i (0..3) {
+                        $res = $bhours->add_seconds( $res, (60 * $agreement->{'BusinessMinutes'}) / 4 );
+                    }
             }
             else {
                 $res = $bhours->first_after( $res );

Ref:

I am sure it can be made smarter than just dividing by 4 though

I suspected it could be a bug as I saw nothing in the config that could influence this. I wonder if we can expect to have a fix soon, or if one may submit a pull request. Perhaps I can take a crack at it.