diff --git a/class/timesheet.class.php b/class/timesheet.class.php index 57d401f..821146b 100644 --- a/class/timesheet.class.php +++ b/class/timesheet.class.php @@ -126,8 +126,8 @@ class TimeSheet extends SaturneObject 'fk_user_creat' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => 1, 'position' => 160, 'notnull' => 1, 'visible' => 0, 'foreignkey' => 'user.rowid'], 'fk_user_modif' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => 1, 'position' => 170, 'notnull' => 0, 'visible' => 0, 'foreignkey' => 'user.rowid'], 'fk_user_assign' => ['type' => 'integer:User:user/class/user.class.php:1:(t.employee:=:1:AND:t.fk_soc:IS:NULL:AND:t.statut:=:1)', 'label' => 'UserAssign', 'picto' => 'user', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'validate' => 1, 'foreignkey' => 'user.rowid'], - 'fk_project' => ['type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'picto' => 'company', 'enabled' => '$conf->project->enabled', 'position' => 80, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'validate' => 1, 'foreignkey' => 'projet.rowid'], - 'fk_soc' => ['type' => 'integer:Societe:societe/class/societe.class.php:1', 'label' => 'ThirdParty', 'picto' => 'project', 'enabled' => '$conf->societe->enabled', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'validate' => 1, 'foreignkey' => 'societe.rowid'], + 'fk_project' => ['type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'picto' => 'project', 'enabled' => '$conf->project->enabled', 'position' => 80, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'validate' => 1, 'foreignkey' => 'projet.rowid'], + 'fk_soc' => ['type' => 'integer:Societe:societe/class/societe.class.php:1', 'label' => 'ThirdParty', 'picto' => 'company', 'enabled' => '$conf->societe->enabled', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'validate' => 1, 'foreignkey' => 'societe.rowid'], ]; /** diff --git a/langs/fr_FR/dolisirh.lang b/langs/fr_FR/dolisirh.lang index ad04591..1c2a501 100644 --- a/langs/fr_FR/dolisirh.lang +++ b/langs/fr_FR/dolisirh.lang @@ -103,7 +103,7 @@ ErrorServiceTime = Le temps du(des) service(s) est nul SetupDefaultDataNotCreated = Vous n'avez pas créé les données par défaut de DOLISIRH HowToSetupDefaultData = Pour configurer les données par défaut de DOLISIRH, veuillez cliquer sur ce lien : ConfigDefaultData = Configuration des données par défaut de DOLISIRH -EnableDoliSIRH = Veuillez activer le module DoliSIRH pour accéder à cette page +EnableDolisirh = Veuillez activer le module DoliSIRH pour accéder à cette page diff --git a/lib/dolisirh_timespent.lib.php b/lib/dolisirh_timespent.lib.php index edf597d..c6f1f5f 100644 --- a/lib/dolisirh_timespent.lib.php +++ b/lib/dolisirh_timespent.lib.php @@ -104,6 +104,7 @@ function load_time_spent_on_tasks_within_range(int $timestampStart, int $timesta $timeSpentOnTasks = ['days' => 0, 'hours' => 0, 'minutes' => 0, 'total' => 0]; $timeSpentList = $task->fetchAllTimeSpent($userTmp, 'AND (ptt.task_date >= "' . $db->idate($timestampStart) . '" AND ptt.task_date < "' . $db->idate($timestampEnd) . '")'); if (is_array($timeSpentList) && !empty($timeSpentList)) { + $workingDays = []; foreach ($timeSpentList as $timeSpent) { $hours = floor($timeSpent->timespent_duration / 3600); $minutes = floor($timeSpent->timespent_duration / 60); @@ -120,9 +121,10 @@ function load_time_spent_on_tasks_within_range(int $timestampStart, int $timesta $timeSpentOnTasks[$timeSpent->fk_task]['task_label'] = $timeSpent->task_label; $timeSpentOnTasks[$timeSpent->fk_task][dol_print_date($timeSpent->timespent_date, 'day')] += $timeSpent->timespent_duration; + $workingDays[$timeSpent->timespent_date] = 1; } } - $timeSpentOnTasks['days'] = count($daysAvailable); + $timeSpentOnTasks['days'] = is_array($workingDays) && !empty($workingDays) ? count($workingDays) : 0; } return $timeSpentOnTasks; diff --git a/view/timesheet/timesheet_card.php b/view/timesheet/timesheet_card.php index 06b929a..9f6b59f 100644 --- a/view/timesheet/timesheet_card.php +++ b/view/timesheet/timesheet_card.php @@ -559,7 +559,7 @@ // Due to Dolibarr issue in common field add we do substract 12 hours in timestamp. $firstDayToShow = $object->date_start - 12 * 3600; - $lastDayToShow = $object->date_end - 12 * 3600; + $lastDayToShow = $object->date_end - 12 * 3600; $startDate = dol_print_date($firstDayToShow, 'dayreduceformat'); $endDate = dol_print_date($lastDayToShow, 'dayreduceformat'); @@ -628,7 +628,6 @@ // Working hours. $workingTime = $timeSpendingInfos['spent']; - if ($plannedWorkingTime['days'] > $workingTime['days']) { $morecssDays = colorStringToArray($conf->global->DOLISIRH_EXCEEDED_TIME_SPENT_COLOR); } elseif ($plannedWorkingTime['days'] < $workingTime['days']){ @@ -639,9 +638,9 @@ print ''; print $langs->trans('Total'); - print ' - '; + print ' - '; print $langs->trans('ConsumedWorkingHoursMonth', $startDate, $endDate); - print ' : '.convertSecondToTime($workingTime['total'], 'allhourmin') . ''; + print ' : ' . convertSecondToTime($workingTime['total'], 'allhourmin') . ''; print '' . ' - ' . $langs->trans('ConsumedWorkingDayMonth') . ' '; print $workingTime['days'] . ''; print '';