Skip to content

Commit

Permalink
Issue #1826: Adding sysconfig option for displaying date instead of a…
Browse files Browse the repository at this point in the history
…ge when ticket is older than 24 hours.
  • Loading branch information
stefanhaerter committed Feb 6, 2024
1 parent e05b7c7 commit 23e04d6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Kernel/Config/Files/XML/Framework.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8604,6 +8604,13 @@ via the Preferences button after logging in.
<Item ValueType="Checkbox">0</Item>
</Value>
</Setting>
<Setting Name="TimeShowCreatedAt" Required="0" Valid="1">
<Description Translatable="1">Shows creation date instead of age if ticket is older than 24 hours.</Description>
<Navigation>Core::Time</Navigation>
<Value>
<Item ValueType="Checkbox">0</Item>
</Value>
</Setting>
<Setting Name="AdminCustomerUser::RunInitialWildcardSearch" Required="1" Valid="1">
<Description Translatable="1">Runs an initial wildcard search of the existing customer users when accessing the AdminCustomerUser module.</Description>
<Navigation>Frontend::Admin::View::CustomerUser</Navigation>
Expand Down
14 changes: 14 additions & 0 deletions Kernel/Output/HTML/Layout.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,7 @@ sub CustomerAge {
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');

my $Age = defined( $Param{Age} ) ? $Param{Age} : return;
my $CreatedAt = $Param{CreatedAt} || '';
my $Space = $Param{Space} || '<br/>';
my $AgeStrg = '';
my $DayDsc = Translatable('d');
Expand All @@ -2343,6 +2344,19 @@ sub CustomerAge {
$AgeStrg = '-';
}

if ( $Param{CreatedAt} && $ConfigObject->Get('TimeShowCreatedAt') && $Age >= 86400 ) {

my $CreatedAtDateTimeObject = $Kernel::OM->Create(
'Kernel::System::DateTime',
ObjectParams => {
String => $Param{CreatedAt},
},
);

return $CreatedAtDateTimeObject->ToString();

}

# get days
if ( $Age >= 86400 ) {
$AgeStrg .= int( ( $Age / 3600 ) / 24 ) . ' ';
Expand Down
5 changes: 3 additions & 2 deletions Kernel/Output/HTML/TicketOverview/Medium.pm
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,9 @@ sub _Show {

# create human age
$Article{Age} = $LayoutObject->CustomerAge(
Age => $Article{Age},
Space => ' ',
Age => $Article{Age},
Space => ' ',
CreatedAt => $Article{Created},
);

# fetch all std. templates ...
Expand Down
5 changes: 3 additions & 2 deletions Kernel/Output/HTML/TicketOverview/Preview.pm
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,9 @@ sub _Show {

# create human age
$Article{Age} = $LayoutObject->CustomerAge(
Age => $Article{Age},
Space => ' ',
Age => $Article{Age},
Space => ' ',
CreatedAt => $Article{Created},
);

# get queue object
Expand Down
5 changes: 3 additions & 2 deletions Kernel/Output/HTML/TicketOverview/Small.pm
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,9 @@ sub Run {

# create human age
$Article{Age} = $LayoutObject->CustomerAge(
Age => $Article{Age},
Space => ' ',
Age => $Article{Age},
Space => ' ',
CreatedAt => $Article{Created},
);

# get ACL restrictions
Expand Down

0 comments on commit 23e04d6

Please sign in to comment.