Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #3545: AccountedTime improvements #3547

Open
wants to merge 4 commits into
base: rel-11_1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Kernel/Config/Files/XML/Ticket.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2408,6 +2408,13 @@
<Item ValueType="Checkbox">1</Item>
</Value>
</Setting>
<Setting Name="AccountedTime::UsedUnits" Required="1" Valid="1">
<Description Translatable="1">Which units are used and shown in the overview for timeunits?</Description>
<Navigation>Frontend::Agent::Ticket::AccountedTime</Navigation>
<Value>
<Item ValueType="String" ValueRegex="">Minutes</Item>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::AgentTicketStatusView###SortBy::Default" UserPreferencesGroup="Advanced" UserModificationActive="1" UserModificationPossible="1" Required="1" Valid="1">
<Description Translatable="1">Defines the default ticket attribute for ticket sorting in the status view of the agent interface.</Description>
<Navigation>Frontend::Agent::View::TicketStatus</Navigation>
Expand Down Expand Up @@ -13094,6 +13101,13 @@ Thanks for your help!
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::AgentTicketZoom###ArticleListShowTimeUnits" Required="0" Valid="1">
<Description Translatable="1">If the accounted time units for articles are shown in the article list. Only showing if at least one article has any accounted time.</Description>
<Navigation>Frontend::Agent::View::TicketZoom</Navigation>
<Value>
<Item ValueType="Checkbox">1</Item>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::AgentTicketZoom###Widgets###0100-TicketInformation" Required="0" Valid="1">
<Description Translatable="1">AgentTicketZoom widget that displays ticket data in the side bar.</Description>
<Navigation>Frontend::Agent::View::TicketZoom</Navigation>
Expand Down Expand Up @@ -13779,6 +13793,7 @@ Thanks for your help!
<Item ValueType="Option" Value="1" Translatable="1">1 - Available</Item>
<Item ValueType="Option" Value="2" Translatable="1">2 - Enabled by default</Item>
</DefaultItem>
<Item Key="AccountedTime" SelectedID="1"></Item>
<Item Key="Age" SelectedID="2"></Item>
<Item Key="Changed" SelectedID="1"></Item>
<Item Key="Created" SelectedID="1"></Item>
Expand Down Expand Up @@ -13817,6 +13832,7 @@ Thanks for your help!
<Item ValueType="Option" Value="1" Translatable="1">1 - Available</Item>
<Item ValueType="Option" Value="2" Translatable="1">2 - Enabled by default</Item>
</DefaultItem>
<Item Key="AccountedTime" SelectedID="1"></Item>
<Item Key="Age" SelectedID="2"></Item>
<Item Key="Changed" SelectedID="1"></Item>
<Item Key="Created" SelectedID="1"></Item>
Expand Down Expand Up @@ -13855,6 +13871,7 @@ Thanks for your help!
<Item ValueType="Option" Value="1" Translatable="1">1 - Available</Item>
<Item ValueType="Option" Value="2" Translatable="1">2 - Enabled by default</Item>
</DefaultItem>
<Item Key="AccountedTime" SelectedID="1"></Item>
<Item Key="Age" SelectedID="2"></Item>
<Item Key="Changed" SelectedID="1"></Item>
<Item Key="Created" SelectedID="1"></Item>
Expand Down Expand Up @@ -13893,6 +13910,7 @@ Thanks for your help!
<Item ValueType="Option" Value="1" Translatable="1">1 - Available</Item>
<Item ValueType="Option" Value="2" Translatable="1">2 - Enabled by default</Item>
</DefaultItem>
<Item Key="AccountedTime" SelectedID="1"></Item>
<Item Key="Age" SelectedID="2"></Item>
<Item Key="Changed" SelectedID="1"></Item>
<Item Key="Created" SelectedID="1"></Item>
Expand Down Expand Up @@ -13931,6 +13949,7 @@ Thanks for your help!
<Item ValueType="Option" Value="1" Translatable="1">1 - Available</Item>
<Item ValueType="Option" Value="2" Translatable="1">2 - Enabled by default</Item>
</DefaultItem>
<Item Key="AccountedTime" SelectedID="1"></Item>
<Item Key="Age" SelectedID="2"></Item>
<Item Key="Changed" SelectedID="1"></Item>
<Item Key="Created" SelectedID="1"></Item>
Expand Down Expand Up @@ -13969,6 +13988,7 @@ Thanks for your help!
<Item ValueType="Option" Value="1" Translatable="1">1 - Available</Item>
<Item ValueType="Option" Value="2" Translatable="1">2 - Enabled by default</Item>
</DefaultItem>
<Item Key="AccountedTime" SelectedID="1"></Item>
<Item Key="Age" SelectedID="2"></Item>
<Item Key="Changed" SelectedID="1"></Item>
<Item Key="Created" SelectedID="1"></Item>
Expand Down Expand Up @@ -14007,6 +14027,7 @@ Thanks for your help!
<Item ValueType="Option" Value="1" Translatable="1">1 - Available</Item>
<Item ValueType="Option" Value="2" Translatable="1">2 - Enabled by default</Item>
</DefaultItem>
<Item Key="AccountedTime" SelectedID="1"></Item>
<Item Key="Age" SelectedID="2"></Item>
<Item Key="Changed" SelectedID="1"></Item>
<Item Key="Created" SelectedID="1"></Item>
Expand Down Expand Up @@ -14045,6 +14066,7 @@ Thanks for your help!
<Item ValueType="Option" Value="1" Translatable="1">1 - Available</Item>
<Item ValueType="Option" Value="2" Translatable="1">2 - Enabled by default</Item>
</DefaultItem>
<Item Key="AccountedTime" SelectedID="1"></Item>
<Item Key="Age" SelectedID="2"></Item>
<Item Key="Changed" SelectedID="1"></Item>
<Item Key="Created" SelectedID="1"></Item>
Expand Down
31 changes: 31 additions & 0 deletions Kernel/Modules/AgentTicketZoom.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2389,6 +2389,25 @@ sub _ArticleTree {
},
);

# fetching accounted times of all articles to check if we display the column
my %ArticleAccountedTimes;
my $ShowTimeUnits = 0;
if ( $Self->{Config}{ArticleListShowTimeUnits} ) {
for my $ArticleTmp (@ArticleBox) {

# Get accounted time for article using ArticleAccountedTimeGet
$ArticleAccountedTimes{ $ArticleTmp->{ArticleID} } = $ArticleObject->ArticleAccountedTimeGet(
ArticleID => $ArticleTmp->{ArticleID},
);
}
$ShowTimeUnits = ( any { $_ != 0 } values %ArticleAccountedTimes ) ? 1 : 0;
if ($ShowTimeUnits) {
$LayoutObject->Block(
Name => 'TimeUnitHeader',
);
}
}

ARTICLE:
for my $ArticleTmp (@ArticleBox) {
my %Article = %$ArticleTmp;
Expand Down Expand Up @@ -2473,6 +2492,17 @@ sub _ArticleTree {
ShowDeletedArticles => $Self->{ShowDeletedArticles}
);

if ($ShowTimeUnits) {

my %TimeUnitField = (
Value => $ArticleAccountedTimes{ $ArticleTmp->{ArticleID} },
Label => 'Time Unit'
);
$Article{TimeUnit} = $ArticleAccountedTimes{ $ArticleTmp->{ArticleID} };

$ArticleFields{TimeUnit} = \%TimeUnitField;
}

# Get transmission status information for email articles.
my $TransmissionStatus;
if ( $Article{ChannelName} && $Article{ChannelName} eq 'Email' ) {
Expand All @@ -2494,6 +2524,7 @@ sub _ArticleTree {
TransmissionStatus => $TransmissionStatus,
ZoomExpand => $Self->{ZoomExpand},
ZoomExpandSort => $Self->{ZoomExpandSort},
ShowTimeUnits => $ShowTimeUnits,
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@
<div title="[% Translate("Service Time") | html %]: [% Data.SolutionTimeWorkingTime | html %]" class="[% Data.SolutionTimeClass | html %]">[% Data.SolutionTimeHuman | html %] / [% Data.SolutionTimeDestinationDate | Localize("TimeShort") %]</div>
[% RenderBlockEnd("SolutionTime") %]
</td>
<td>
<label>[% Translate("Accounted Time") | html %]</label>
[% RenderBlockStart("AccountedTime") %]
<div title="[% Translate("Accounted Time") | html %]: [% Data.AccountedTime | html %]" class="[% Data.SolutionTimeClass | html %]">[% Data.AccountedTime | html %]</div>
[% RenderBlockEnd("AccountedTime") %]
</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
<label>[% Translate("Type") | html %]</label><div title="[% Data.Type | html %]">[% Data.Type | html %]</div>
[% RenderBlockEnd("Type") %]
</td>
<td>
[% RenderBlockStart("AccountedTime") %]
<label>[% Translate("Accounted Time") | html %]</label><div title="[% Translate("Accounted Time") | html %]: [% Data.AccountedTime | html %]">[% Data.AccountedTime | html %]</div>
[% RenderBlockEnd("AccountedTime") %]
</td>
<td>
[% RenderBlockStart("UpdateTime") %]
<label>[% Translate("Update Time") | html %]</label>
Expand Down
8 changes: 8 additions & 0 deletions Kernel/Output/HTML/Templates/Standard/AgentTicketZoom.tt
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@
<i class="fa fa-paperclip"></i>
</a>
</th>
[% RenderBlockStart("TimeUnitHeader") %]
<th class="TimeUnit"><a href="#">[% Translate("Time Units") | html %]</a></th>
[% RenderBlockEnd("TimeUnitHeader") %]
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -518,6 +521,11 @@
<span class="NoContent"></span>
[% RenderBlockEnd("TreeItemNoAttachment") %]
</td>
[% IF Data.ShowTimeUnits %]
<td class="No">
[% Data.TimeUnit | html %]
</td>
[% END %]
</tr>
[% RenderBlockEnd("TreeItem") %]
</tbody>
Expand Down
13 changes: 13 additions & 0 deletions Kernel/Output/HTML/TicketOverview/Medium.pm
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,19 @@ sub _Show {
);
}

# show accounted time if needed
# get ticket object
my $DataValue = $TicketObject->TicketAccountedTimeGet( TicketID => $Param{TicketID} );

if ( defined $DataValue ) {
$LayoutObject->Block(
Name => 'AccountedTime',
Data => {
AccountedTime => $DataValue,
},
);
}

# Dynamic fields
$Counter = 0;
my $DisplayDynamicFieldTable = 1;
Expand Down
13 changes: 13 additions & 0 deletions Kernel/Output/HTML/TicketOverview/Preview.pm
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,19 @@ sub _Show {
);
}

# show accounted time if needed
# get ticket object
my $DataValue = $TicketObject->TicketAccountedTimeGet( TicketID => $Param{TicketID} );

if ( defined $DataValue ) {
$LayoutObject->Block(
Name => 'AccountedTime',
Data => {
AccountedTime => $DataValue,
},
);
}

# Dynamic fields
$Counter = 0;
my $Class = 'Middle';
Expand Down
9 changes: 9 additions & 0 deletions Kernel/Output/HTML/TicketOverview/Small.pm
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ sub new {
'EscalationUpdateTime' => 1,
'EscalationResponseTime' => 1,
'EscalationSolutionTime' => 1,
'AccountedTime' => 1,
};

$Self->{AvailableFilterableColumns} = {
Expand Down Expand Up @@ -1632,6 +1633,13 @@ sub Run {

$DataValue = $ResponsibleInfo{'UserFullname'};
}
elsif ( $TicketColumn eq 'AccountedTime' ) {

# get ticket object
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $TimeUnits = $ConfigObject->Get("AccountedTime::UsedUnits");
$DataValue = $TicketObject->TicketAccountedTimeGet( TicketID => $Article{TicketID} ) . ' ' . $TimeUnits;
}
else {
$DataValue = $Article{$TicketColumn}
|| $UserInfo{$TicketColumn}
Expand Down Expand Up @@ -2108,6 +2116,7 @@ sub _DefaultColumnSort {
Service => 191,
SLA => 192,
Priority => 193,
AccountedTime => 194,
);

# dynamic fields can not be on the DefaultColumns sorting hash
Expand Down