Skip to content

Commit

Permalink
Issue #4: Wrong sum when adding up time at the same article
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui Alves committed Jul 8, 2024
1 parent fb72244 commit 7ddffbf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions Kernel/System/Ticket/Event/TimeAccountingTicketTimeUnitsSync.pm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ sub Run {
return;
}
}

if ( $Param{Event} eq 'TicketAccountTime' ) {

# get ticket object
Expand All @@ -104,9 +104,7 @@ sub Run {
);

# Add TimeUnits to the Article hash
$Article{TimeUnits} = $ArticleObject->ArticleAccountedTimeGet(
ArticleID => $Param{Data}->{ArticleID},
);
$Article{TimeUnits} = $Param{Data}{TimeUnits};

# I write the Artice TimeUnit to a dynamic field for later viewing
my $Success = $BackendObject->ValueSet(
Expand Down Expand Up @@ -198,11 +196,13 @@ sub Run {
);

my $CurrentTimeObject = $Kernel::OM->Create('Kernel::System::DateTime');

# the working unit may concern to some article edition later to the article creation
# therefore it must be assigned the current date instead of the article creation date
my $CurrentTimeValue = $CurrentTimeObject->Get();
my $Insert = $TimeAccountingObject->WorkingUnitsInsert(
Year => $Year,
Month => $Month,
Day => $Day,
Year => $CurrentTimeValue->{Year},
Month => $CurrentTimeValue->{Month},
Day => $CurrentTimeValue->{Day},
LeaveDay => 0,
Sick => 0,
Overtime => 0,
Expand Down
2 changes: 1 addition & 1 deletion Kernel/System/TimeAccounting.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ sub WorkingUnitsDelete {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "WorkingUnitsInsert: Need $Needed!"
Message => "WorkingUnitsDelete: Need $Needed!"
);

return;
Expand Down

0 comments on commit 7ddffbf

Please sign in to comment.