User view: Fix shifts order if user has worklogs
This commit is contained in:
parent
100602437f
commit
a51bfae6e5
|
@ -471,7 +471,8 @@ function User_view_myshifts(
|
||||||
$myshifts_table = [];
|
$myshifts_table = [];
|
||||||
$timeSum = 0;
|
$timeSum = 0;
|
||||||
foreach ($shifts as $shift) {
|
foreach ($shifts as $shift) {
|
||||||
$myshifts_table[$shift['start'] . $shift['SID']] = User_view_myshift($shift, $user_source, $its_me);
|
$key = $shift['start'] . '-shift-' . $shift['SID'];
|
||||||
|
$myshifts_table[$key] = User_view_myshift($shift, $user_source, $its_me);
|
||||||
|
|
||||||
if (!$shift['freeloaded']) {
|
if (!$shift['freeloaded']) {
|
||||||
$timeSum += ($shift['end'] - $shift['start']);
|
$timeSum += ($shift['end'] - $shift['start']);
|
||||||
|
@ -479,14 +480,9 @@ function User_view_myshifts(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($its_me || $admin_user_worklog_privilege) {
|
if ($its_me || $admin_user_worklog_privilege) {
|
||||||
$day_counter = 1;
|
|
||||||
foreach ($user_worklogs as $worklog) {
|
foreach ($user_worklogs as $worklog) {
|
||||||
// Check if more than one worklog per day
|
$key = $worklog['work_timestamp'] . '-worklog-' . $worklog['id'];
|
||||||
if (isset($myshifts_table[$worklog['work_timestamp']])) {
|
$myshifts_table[$key] = User_view_worklog($worklog, $admin_user_worklog_privilege);
|
||||||
$worklog['work_timestamp'] += $day_counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$myshifts_table[$worklog['work_timestamp']] = User_view_worklog($worklog, $admin_user_worklog_privilege);
|
|
||||||
$timeSum += $worklog['work_hours'] * 3600;
|
$timeSum += $worklog['work_hours'] * 3600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue