Skip to content

Commit

Permalink
#43 [Timesheet] fix: time range for time spent processing
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-theo committed Nov 4, 2022
1 parent 0afee85 commit bfea334
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/dolisirh_function.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function loadTimeSpentWithinRangeByProject($datestart, $dateend, $project_id, $t
$sql .= " WHERE ptt.fk_task = pt.rowid";
$sql .= " AND pt.fk_projet = ".((int) $project_id);
$sql .= " AND (ptt.task_date >= '".$db->idate($datestart)."' ";
$sql .= " AND ptt.task_date < '".$db->idate(dol_time_plus_duree($dateend, 1,'d'))."')";
$sql .= " AND ptt.task_date < '".$db->idate($dateend)."')";
if ($taskid) {
$sql .= " AND ptt.fk_task=".((int) $taskid);
}
Expand Down Expand Up @@ -326,7 +326,7 @@ function loadTimeSpentWithinRange($datestart, $dateend, $taskid = 0, $userid = 0
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time AS ptt, ".MAIN_DB_PREFIX."projet_task as pt";
$sql .= " WHERE ptt.fk_task = pt.rowid";
$sql .= " AND (ptt.task_date >= '".$db->idate($datestart)."' ";
$sql .= " AND ptt.task_date < '".$db->idate(dol_time_plus_duree($dateend, 1,'d'))."')";
$sql .= " AND ptt.task_date < '".$db->idate($dateend)."')";
if ($taskid) {
$sql .= " AND ptt.fk_task=".((int) $taskid);
}
Expand Down Expand Up @@ -1506,7 +1506,6 @@ function doliSirhLinesPerMonth(&$inc, $firstdaytoshow, $lastdaytoshow, $fuser, $
$obj = &$lines[$i]; // To display extrafields
// If we want all or we have a role on task, we show it
if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);

if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) { // we have no role on task and we request to hide such cases
continue;
Expand Down Expand Up @@ -1610,7 +1609,6 @@ function doliSirhLinesPerMonth(&$inc, $firstdaytoshow, $lastdaytoshow, $fuser, $
print "</td>\n";
}

$disabledproject = 1;
$disabledtask = 1;

if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
Expand Down
2 changes: 1 addition & 1 deletion view/timesheet/timesheet_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@
$start_date = dol_print_date($firstdaytoshow, "dayreduceformat");
$end_date = dol_print_date($lastdaytoshow, "dayreduceformat");

$timeSpendingInfos = loadTimeSpendingInfosWithinRange($firstdaytoshow, $lastdaytoshow, 0, $object->fk_user_assign);
$timeSpendingInfos = loadTimeSpendingInfosWithinRange($firstdaytoshow, dol_time_plus_duree($lastdaytoshow, 1, 'd'), 0, $object->fk_user_assign);

// Planned working time
$planned_working_time = $timeSpendingInfos['planned'];
Expand Down

0 comments on commit bfea334

Please sign in to comment.