[Rt-commit] rt branch 5.0/chart-table-business-hours-css created. rt-5.0.2-260-gbc467db5fd

BPS Git Server git at git.bestpractical.com
Thu Jun 2 23:33:03 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/chart-table-business-hours-css has been created
        at  bc467db5fde24eeba5cff4d81ac8a1c598e3f7cd (commit)

- Log -----------------------------------------------------------------
commit bc467db5fde24eeba5cff4d81ac8a1c598e3f7cd
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 3 05:21:16 2022 +0800

    Test business hour css classes in search chart table

diff --git a/t/web/custom-date-ranges.t b/t/web/custom-date-ranges.t
new file mode 100644
index 0000000000..6d9cc46788
--- /dev/null
+++ b/t/web/custom-date-ranges.t
@@ -0,0 +1,166 @@
+use warnings;
+use strict;
+use RT::Test;
+
+RT->Config->Set(
+    ServiceAgreements => (
+        Default => '2h',
+        Levels  => {
+            '2h' => { Response => 2 * 60, BusinessHours => 'Default',     Timezone => 'UTC' },
+            '4h' => { Response => 4 * 60, BusinessHours => 'Just Monday', Timezone => 'UTC' },
+        },
+    )
+);
+RT->Config->Set(
+    ServiceBusinessHours => (
+        'Default' => {
+            1 => { Name => 'Monday',    Start => '9:00', End => '18:00' },
+            2 => { Name => 'Tuesday',   Start => '9:00', End => '18:00' },
+            3 => { Name => 'Wednesday', Start => '9:00', End => '18:00' },
+            4 => { Name => 'Thursday',  Start => '9:00', End => '18:00' },
+            5 => { Name => 'Friday',    Start => '9:00', End => '18:00' },
+        },
+        'Just Monday' => {
+            1 => { Name => 'Monday', Start => '9:00', End => '18:00' },
+        },
+    )
+);
+
+my $queue = RT::Test->load_or_create_queue( Name => 'General' );
+ok( $queue->SetSLADisabled(0), 'Enabled SLA' );
+
+RT::Test->create_ticket(
+    Queue    => 'General',
+    Status   => 'resolved',
+    Created  => '2021-12-10 00:00:00',
+    Resolved => '2021-12-15 18:00:00',
+    SLA      => '2h',
+) for 1 .. 3;
+
+
+RT::Test->create_ticket(
+    Queue    => 'General',
+    Status   => 'resolved',
+    Created  => '2021-12-10 00:00:00',
+    Resolved => '2021-12-30 18:00:00',
+    SLA      => '4h',
+) for 1 .. 2;
+
+RT::Test->create_ticket(
+    Queue    => 'General',
+    Status   => 'resolved',
+    Created  => '2021-12-05 00:00:00',
+    Resolved => '2021-12-30 18:00:00',
+    SLA      => '4h',
+);
+
+
+my ( $baseurl, $m ) = RT::Test->started_ok;
+ok( $m->login(), 'logged in' );
+
+diag "Test Date Ranges GroupBy with business hours in SLA";
+
+$m->get_ok("/Search/Chart.html?Query=id>0");
+$m->form_with_fields("GroupBy");
+$m->select( 'GroupBy', 'Created to Resolved(Business Hours).Default' );
+$m->submit_form_ok;
+
+my @monday_rows = $m->dom->find('span.business_hours_just_monday')->each;
+is( @monday_rows, 2, '2 rows with Just Monday BH' );
+
+is( $monday_rows[0]->text, '27 hours', 'GroupBy Just Monday 1st row label' );
+$m->text_like( qr/27 hours\s*2/, 'GroupBy Just Monday 1st row ticket count' );
+
+is( $monday_rows[1]->text, '36 hours', 'GroupBy Just Monday 2nd row label' );
+$m->text_like( qr/36 hours\s*1/, 'GroupBy Just Monday 2nd row ticket count' );
+
+my @default_rows = $m->dom->find('span.business_hours_default')->each;
+is( @default_rows, 1, '1 row with Default BH' );
+is( $default_rows[0]->text, '36 hours', 'GroupBy Default row label' );
+$m->text_like( qr/36 hours\s*3/, 'GroupBy Default ticket count' );
+
+
+diag "Test custom date ranges GroupBy with business hours in SLA";
+
+$m->get_ok('/Prefs/CustomDateRanges.html');
+$m->form_name('CustomDateRanges');
+
+$m->select( 'from',          'Created' );
+$m->select( 'to',            'Resolved' );
+$m->select( 'business_time', 1 );
+
+$m->submit_form_ok( { fields => { name => 'Resolution Time' }, button => 'Save' } );
+$m->text_contains('Created Resolution Time');
+
+$m->get_ok("/Search/Chart.html?Query=id>0");
+$m->form_with_fields("GroupBy");
+$m->select( 'GroupBy', 'Resolution Time.Hour' );
+$m->submit_form_ok;
+
+ at monday_rows = $m->dom->find('span.business_hours_just_monday')->each;
+is( @monday_rows,          2,          '2 rows with Just Monday BH' );
+is( $monday_rows[0]->text, '27 hours', 'GroupBy Just Monday 1st row label' );
+$m->text_like( qr/27 hours\s*2/, 'GroupBy Just Monday 1st row ticket count' );
+
+is( $monday_rows[1]->text, '36 hours', 'GroupBy Just Monday 2nd row label' );
+$m->text_like( qr/36 hours\s*1/, 'GroupBy Just Monday 2nd row ticket count' );
+
+ at default_rows = $m->dom->find('span.business_hours_default')->each;
+is( @default_rows, 1, '1 row with Default BH' );
+is( $default_rows[0]->text, '36 hours', 'GroupBy Default row label' );
+
+
+diag "Test custom date ranges with specified business hours";
+$m->get_ok('/Prefs/CustomDateRanges.html');
+$m->form_name('CustomDateRanges');
+$m->select( '0-business_time', 'Just Monday' );
+
+$m->submit_form_ok( { button => 'Save' } );
+$m->text_contains('Updated Resolution Time');
+
+$m->get_ok("/Search/Chart.html?Query=id>0");
+$m->form_with_fields("GroupBy");
+$m->select( 'GroupBy', 'Resolution Time.Hour' );
+$m->submit_form_ok;
+ at monday_rows = $m->dom->find('span.business_hours_just_monday')->each;
+is( @monday_rows,          3,         '3 rows with Just Monday BH' );
+is( $monday_rows[0]->text, '9 hours', 'GroupBy Just Monday 1st row label' );
+$m->text_like( qr/9 hours\s*3/, 'GroupBy Just Monday 1st row ticket count' );
+
+is( $monday_rows[1]->text, '27 hours', 'GroupBy Just Monday 2nd row label' );
+$m->text_like( qr/27 hours\s*2/, 'GroupBy Just Monday 2nd row ticket count' );
+
+is( $monday_rows[2]->text, '36 hours', 'GroupBy Just Monday 3rd row label' );
+$m->text_like( qr/36 hours\s*1/, 'GroupBy Just Monday 3rd row ticket count' );
+
+
+diag "Test custom date ranges Calculation";
+# Can't use form_with_fields('GroupBy') as SaveSearch form that also has the field, which will warn.
+$m->form_number(3);
+$m->select( 'ChartFunction', 'SUM(Resolution Time)' );
+
+$m->submit_form_ok;
+
+ at monday_rows = $m->dom->find('span.business_hours_just_monday')->each;
+is( @monday_rows,          6,         '6 cells with Just Monday BH' );
+is( $monday_rows[0]->text, '9 hours', 'GroupBy Just Monday 1st row label' );
+is( $monday_rows[1]->text, '27h',     'GroupBy Just Monday 1st row value' );
+
+is( $monday_rows[2]->text, '27 hours', 'GroupBy Just Monday 2nd row label' );
+is( $monday_rows[3]->text, '54h',      'GroupBy Just Monday 2nd row value' );
+
+is( $monday_rows[4]->text, '36 hours', 'GroupBy Just Monday 3rd row label' );
+is( $monday_rows[5]->text, '36h',      'GroupBy Just Monday 3rd row value' );
+
+
+diag "Test custom date ranges Calculation with normal group by";
+$m->form_number(3);
+$m->select( 'GroupBy', 'Status' );
+
+$m->submit_form_ok;
+
+ at monday_rows = $m->dom->find('span.business_hours_just_monday')->each;
+is( @monday_rows,          1,      '1 cell with Just Monday BH' );
+is( $monday_rows[0]->text, '117h', 'GroupBy Just Monday row value' );
+
+done_testing;

commit 757d9325ca19632252962c3988c6795783713ba8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat May 28 15:23:22 2022 +0800

    Distinguish business hours by adding related css classes in search chart table
    
    Users can add corresponding css rules to highlight different
    configurations, e.g.
    
        span.business_hours_just_monday {
          background-color: #aaf;
        }
    
    or even append business hours info:
    
        span.business_hours_just_monday:after {
          content: " (Just Monday)"
        }

diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index 9a89536b35..90d0e43d12 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -353,6 +353,24 @@ our %GROUPINGS_META = (
         Show     => 1,
         Sort     => 'duration',
         Distinct => 1,
+        Display => sub {
+            my $self = shift;
+            my %args = (@_);
+            my $value = $args{VALUE};
+            my $format = $args{FORMAT} || 'text';
+            if ( $format eq 'html' ) {
+                RT::Interface::Web::EscapeHTML(\$value);
+                my $css_class;
+                if ( my $style = $self->__Value('_css_class') ) {
+                    $css_class = $style->{$args{NAME}};
+                };
+                return $value unless $css_class;
+                return qq{<span class="$css_class">$value</span>};
+            }
+            else {
+                return $value;
+            }
+        },
     },
 );
 
@@ -824,9 +842,17 @@ sub _DoSearch {
         $tickets->FromSQL( $self->{_query} );
         my @groups = grep { $_->{TYPE} eq 'grouping' } map { $self->ColumnInfo($_) } $self->ColumnsList;
         my %info;
+
+        my %bh_class = map { $_ => 'business_hours_' . HTML::Mason::Commands::CSSClass( lc $_ ) }
+            keys %{ RT->Config->Get('ServiceBusinessHours') || {} };
+
         while ( my $ticket = $tickets->Next ) {
+            my $bh = $ticket->SLA ? RT->Config->Get('ServiceAgreements')->{Levels}{ $ticket->SLA }{BusinessHours} : '';
+
             my @keys;
             my $max = 1;
+            my @extra_keys;
+            my %css_class;
             for my $group ( @groups ) {
                 my $value;
 
@@ -922,6 +948,10 @@ sub _DoSearch {
                                 );
                             }
                         }
+
+                        if ( $business_time ) {
+                            push @extra_keys, join ' => ', $group->{FIELD}, $bh_class{$bh} || 'business_hours_none';
+                        }
                     }
                     else {
                         my %ranges = RT::Ticket->CustomDateRanges;
@@ -944,6 +974,11 @@ sub _DoSearch {
                                     );
                                 }
                             }
+                            if ( ref $spec && $spec->{business_time} ) {
+                                # 1 means the corresponding one in SLA, which $bh already holds
+                                $bh = $spec->{business_time} unless $spec->{business_time} eq '1';
+                                push @extra_keys, join ' => ', $group->{FIELD}, $bh_class{$bh} || 'business_hours_none';
+                            }
                         }
                     }
 
@@ -955,6 +990,7 @@ sub _DoSearch {
                 }
                 push @keys, $value;
             }
+            push @keys, @extra_keys;
 
             # @keys could contain arrayrefs, so we need to expand it.
             # e.g. "open", [ "root", "foo" ], "General" )
@@ -1097,6 +1133,14 @@ sub _DoSearch {
                 }
             }
             my $item = $self->NewItem();
+
+            # Has extra css info
+            for my $key (@keys) {
+                if ( $key =~ /(.+) => (.+)/ ) {
+                    $row->{_css_class}{$1} = $2;
+                }
+            }
+
             $item->LoadFromHash($row);
             $self->AddRecord($item);
         }
@@ -1407,12 +1451,57 @@ sub DurationAsString {
     my %args = @_;
     my $v = $args{'VALUE'};
     my $max_unit = $args{INFO} && ref $args{INFO}[-1] && $args{INFO}[-1]{business_time} ? 'hour' : 'year';
+    my $format = $args{FORMAT} || 'text';
+
+    my $css_class;
+    if (   $format eq 'html'
+        && $self->can('__Value')
+        && $args{INFO}
+        && ref $args{INFO}[-1]
+        && $args{INFO}[-1]{business_time} )
+    {
+
+        # 1 means business hours in SLA, its css is already generated and saved in _css_class.
+        if ( $args{INFO}[-1]{business_time} eq '1' ) {
+            my $style = $self->__Value('_css_class');
+            my $field;
+            if ( $args{INFO}[1] =~ /^CustomDateRange/ ) {
+                $field = $args{INFO}[-2];
+            }
+            elsif ( $args{INFO}[1] =~ /^DateTimeInterval/ ) {
+                $field = join ' to ', $args{INFO}[-3], $args{INFO}[-2];
+            }
+
+            $css_class = $style->{$field} if $style && $field;
+        }
+        else {
+            $css_class = 'business_hours_' . HTML::Mason::Commands::CSSClass( lc $args{INFO}[-1]{business_time} )
+        }
+    }
 
     unless ( ref $v ) {
-        return $self->loc("(no value)") unless defined $v && length $v;
-        return RT::Date->new( $self->CurrentUser )->DurationAsString(
-            $v, Show => 3, Short => 1, MaxUnit => $max_unit,
-        );
+        my $value;
+        if ( defined $v && length $v ) {
+            $value = RT::Date->new( $self->CurrentUser )->DurationAsString(
+                $v,
+                Show    => 3,
+                Short   => 1,
+                MaxUnit => $max_unit,
+            );
+        }
+        else {
+            $value = $self->loc("(no value)");
+        }
+
+        if ( $format eq 'html' ) {
+            RT::Interface::Web::EscapeHTML(\$value);
+            return $value unless $css_class;
+            return qq{<span class="$css_class">$value</span>};
+        }
+        else {
+            return $value;
+        }
+
     }
 
     my $date = RT::Date->new( $self->CurrentUser );
@@ -1422,6 +1511,14 @@ sub DurationAsString {
             if defined $e && length $e;
         $e = $self->loc("(no value)") unless defined $e && length $e;
     }
+
+    if ( $format eq 'html' ) {
+        for my $key ( keys %res ) {
+            RT::Interface::Web::EscapeHTML(\$res{$key});
+            next unless $css_class;
+            $res{$key} = qq{<span class="$css_class">$res{$key}</span>};
+        }
+    }
     return \%res;
 }
 
@@ -1522,7 +1619,7 @@ sub FormatTable {
         $i = 0;
         my $last;
         while ( my $entry = $self->Next ) {
-            my $value = $entry->LabelValue( $column );
+            my $value = $entry->LabelValue( $column, 'html' );
             if ( !$last || $last->{'value'} ne $value ) {
                 push @{ $body[ $i++ ]{'cells'} }, $last = { type => 'label', value => $value };
                 $last->{even} = $g++ % 2
@@ -1608,7 +1705,7 @@ sub FormatTable {
 
         while ( my $entry = $self->Next ) {
             my $query = $entry->Query;
-            my $value = $entry->LabelValue( $column ) || {};
+            my $value = $entry->LabelValue( $column, 'html' ) || {};
             $value = { '' => $value } unless ref $value;
             foreach my $e ( @subs ) {
                 push @{ $body[ $i ]{'cells'} }, {
@@ -1625,7 +1722,7 @@ sub FormatTable {
             my $total_code = $self->LabelValueCode( $column );
             foreach my $e ( @subs ) {
                 my $total = $total{ $e };
-                $total = $total_code->( $self, %$info, VALUE => $total )
+                $total = $total_code->( $self, %$info, VALUE => $total, FORMAT => 'html' )
                     if $total_code;
                 push @{ $footer[0]{'cells'} }, { type => 'value', value => $total };
             }
diff --git a/lib/RT/Report/Tickets/Entry.pm b/lib/RT/Report/Tickets/Entry.pm
index 2f90254fbd..da539c4ebf 100644
--- a/lib/RT/Report/Tickets/Entry.pm
+++ b/lib/RT/Report/Tickets/Entry.pm
@@ -67,11 +67,11 @@ and ensuring that dates are in local not DB timezones.
 sub LabelValue {
     my $self  = shift;
     my $name = shift;
+    my $format = shift || 'text';
 
     my $raw = $self->RawValue( $name, @_ );
-
     if ( my $code = $self->Report->LabelValueCode( $name ) ) {
-        $raw = $code->( $self, %{ $self->Report->ColumnInfo( $name ) }, VALUE => $raw );
+        $raw = $code->( $self, %{ $self->Report->ColumnInfo( $name ) }, VALUE => $raw, FORMAT => $format );
         return $self->loc('(no value)') unless defined $raw && length $raw;
         return $raw;
     }
diff --git a/share/html/Search/Elements/ChartTable b/share/html/Search/Elements/ChartTable
index 008962e530..14a6aaddc3 100644
--- a/share/html/Search/Elements/ChartTable
+++ b/share/html/Search/Elements/ChartTable
@@ -97,11 +97,11 @@ foreach my $section (qw(thead tbody tfoot)) {
                         . $eh->('&') . $base_query
                         . '">'
                     );
-                    $m->out( $eh->( $cell->{'value'} ) );
+                    $m->out( $cell->{value} );
                     $m->out('</a>');
                 }
                 else {
-                    $m->out( $eh->( $cell->{'value'} ) );
+                    $m->out( $cell->{value} );
                 }
             }
             else {

commit f8d8c0b7135d20d4eef46efd20a82377fe551ca4
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat May 28 14:25:58 2022 +0800

    Support to explicitly bind Business Hours for CustomDateRanges
    
    Previously "Business Hours" could only be inferred from ticket's SLA and
    not hardcoded.
    
    As %ServiceBusinessHours config doesn't have timezone bound(it could be
    customized in SLA configurations), we use system timezone config
    consistently in this case for now.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index c58ba20758..1efea68e3b 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -5000,7 +5000,7 @@ sub ProcessCustomDateRanges {
                 }
             }
 
-            if ( $spec->{business_time} != $args_ref->{"$id-business_time"} ) {
+            if ( $spec->{business_time} ne $args_ref->{"$id-business_time"} ) {
                 $spec->{business_time} = $args_ref->{"$id-business_time"};
                 $updated ||= 1;
             }
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 5ae9184c55..68a183e61c 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -2589,20 +2589,26 @@ sub CustomDateRange {
         my $schedule;
         my $timezone;
 
-        # Prefer the schedule/timezone specified in %ServiceAgreements for current object
-        if ( $self->isa('RT::Ticket') && !$self->QueueObj->SLADisabled && $self->SLA ) {
-            if ( my $config = RT->Config->Get('ServiceAgreements') ) {
-                if ( ref( $config->{QueueDefault}{ $self->QueueObj->Name } ) eq 'HASH' ) {
-                    $timezone = $config->{QueueDefault}{ $self->QueueObj->Name }{Timezone};
-                }
+        if ( $date_range_spec{business_time} eq '1' ) {
+            # Prefer the schedule/timezone specified in %ServiceAgreements for current object
+            if ( $self->isa('RT::Ticket') && !$self->QueueObj->SLADisabled && $self->SLA ) {
+                if ( my $config = RT->Config->Get('ServiceAgreements') ) {
+                    if ( ref( $config->{QueueDefault}{ $self->QueueObj->Name } ) eq 'HASH' ) {
+                        $timezone = $config->{QueueDefault}{ $self->QueueObj->Name }{Timezone};
+                    }
 
-                # Each SLA could have its own schedule and timezone
-                if ( my $agreement = $config->{Levels}{ $self->SLA } ) {
-                    $schedule = $agreement->{BusinessHours};
-                    $timezone ||= $agreement->{Timezone};
+                    # Each SLA could have its own schedule and timezone
+                    if ( my $agreement = $config->{Levels}{ $self->SLA } ) {
+                        $schedule = $agreement->{BusinessHours};
+                        $timezone ||= $agreement->{Timezone};
+                    }
                 }
             }
         }
+        else {
+            $schedule = $date_range_spec{business_time};
+        }
+
         $timezone ||= RT->Config->Get('Timezone');
         $schedule ||= 'Default';
 
diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index 6b028bc653..9a89536b35 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -1039,7 +1039,7 @@ sub _DoSearch {
                             $value = $ticket->CustomDateRange(
                                 '',
                                 {   value         => "$end - $start",
-                                    business_time => 1,
+                                    business_time => $extra_info->{business_time},
                                     format        => sub { return $_[0] },
                                 }
                             );
@@ -1712,7 +1712,7 @@ sub _SetupCustomDateRanges {
         my %extra_info;
         my $spec = $ranges{$name};
         if ( ref $spec && $spec->{business_time} ) {
-            $extra_info{business_time} = 1;
+            $extra_info{business_time} = $spec->{business_time};
         }
 
         push @new_groupings, $name => $extra_info{business_time} ? 'DurationInBusinessHours' : 'Duration';
diff --git a/share/html/Elements/EditCustomDateRanges b/share/html/Elements/EditCustomDateRanges
index 427d401339..033e74a504 100644
--- a/share/html/Elements/EditCustomDateRanges
+++ b/share/html/Elements/EditCustomDateRanges
@@ -55,7 +55,7 @@
       <th class="collection-as-table"><&|/l&>From Value<br>if Unset</&></th>
       <th class="collection-as-table"><&|/l&>To</&></th>
       <th class="collection-as-table"><&|/l&>To Value<br>if Unset</&></th>
-      <th class="collection-as-table"><&|/l&>Business<br>Hours?</&></th>
+      <th class="collection-as-table"><&|/l&>Business<br>Hours</&></th>
       <th class="collection-as-table text-left">
         <div class="custom-control custom-checkbox">
           <input type="checkbox" name="DeleteAll" value="1" id="custom-date-ranges-delete-all" class="checkbox custom-control-input" onclick="setCheckbox(this, /^\d+-Delete$/)" />
@@ -77,7 +77,10 @@
       <td class="collection-as-table"><& /Elements/SelectCustomDateRangeField, Name => "$id-to_fallback", Default => $date_range_spec{to_fallback} &></td>
       <td class="collection-as-table">
         <select name="<% $id %>-business_time" class="form-control selectpicker">
-          <option value="1" <% $date_range_spec{business_time} ? 'selected="selected"' : '' |n%>><&|/l&>Yes</&></option>
+          <option value="1" <% ($date_range_spec{business_time} // '') eq 1 ? 'selected="selected"' : '' |n%>><&|/l&>SLA</&></option>
+% for my $bh ( @bhs ) {
+          <option value="<% $bh %>" <% ($date_range_spec{business_time} // '') eq $bh ? 'selected="selected"' : '' |n%>><% loc($bh) %></option>
+% }
           <option value="0" <% $date_range_spec{business_time} ? '': 'selected="selected"' |n%>><&|/l&>No</&></option>
         </select>
       </td>
@@ -102,7 +105,10 @@
       <td class="collection-as-table"><& /Elements/SelectCustomDateRangeField, Name => 'to_fallback' &></td>
       <td class="collection-as-table">
         <select name="business_time" class="form-control selectpicker">
-          <option value="1"><&|/l&>Yes</&></option>
+          <option value="1"><&|/l&>SLA</&></option>
+% for my $bh ( @bhs ) {
+          <option value="<% $bh %>"><% loc($bh) %></option>
+% }
           <option value="0" selected="selected"><&|/l&>No</&></option>
         </select>
       </td>
@@ -112,6 +118,11 @@
   </table>
 </div>
 
+<%INIT>
+my @bhs = sort keys %{ RT->Config->Get('ServiceBusinessHours') || {} };
+
+</%INIT>
+
 <%ARGS>
 %CustomDateRanges => ()
 $ObjectType => 'RT::Ticket'
diff --git a/share/html/Elements/ShowCustomDateRanges b/share/html/Elements/ShowCustomDateRanges
index d077318c17..a228f684ee 100644
--- a/share/html/Elements/ShowCustomDateRanges
+++ b/share/html/Elements/ShowCustomDateRanges
@@ -53,7 +53,7 @@
       <th class="collection-as-table"><&|/l&>From Value<br>if Unset</&></th>
       <th class="collection-as-table"><&|/l&>To</&></th>
       <th class="collection-as-table"><&|/l&>To Value<br>if Unset</&></th>
-      <th class="collection-as-table"><&|/l&>Business<br>Hours?</&></th>
+      <th class="collection-as-table"><&|/l&>Business<br>Hours</&></th>
     </tr>
 % my $i = 0;
 % for my $name ( sort keys %CustomDateRanges ) {
@@ -65,7 +65,17 @@
       <td class="collection-as-table"><% $date_range_spec{from_fallback} || '' %></td>
       <td class="collection-as-table"><% $date_range_spec{to} %></td>
       <td class="collection-as-table"><% $date_range_spec{to_fallback} || '' %></td>
-      <td class="collection-as-table"><% $date_range_spec{business_time} ? loc('Yes') : loc('No') %></td>
+      <td class="collection-as-table">
+% if ( $date_range_spec{business_time} ) {
+%   if ( $date_range_spec{business_time} eq '1' ) {
+        <% loc('SLA') %>
+%   } else {
+        <% $date_range_spec{business_time} %>
+%   }
+% } else {
+        <% loc('No') %>
+% }
+      </td>
     </tr>
 % }
   </table>

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list