Skip to content

Commit

Permalink
#140 [TimeSpent] fix: error user conf favorite task
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Feb 1, 2023
1 parent 5a77351 commit bb67148
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion core/modules/modDoliSIRH.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public function __construct($db)
$i++ => array('DOLISIRH_HR_PROJECT_SET', 'integer', 0, '', 0, 'current'),

// CONST TIME SPENT
$i++ => array('DOLISIRH_SHOW_ONLY_FAVORITE_TASKS', 'integer', 0, '', 0, 'current'),
$i++ => array('DOLISIRH_SHOW_ONLY_TASKS_WITH_TIMESPENT_ON_TIMESHEET', 'integer', 0, '', 0, 'current'),

// CONST TIME SHEET
Expand Down
8 changes: 4 additions & 4 deletions lib/dolisirh_function.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,21 +593,21 @@ function doliSirhGetTasksArray($usert = null, $userp = null, $projectid = 0, $so
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec2";
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2";
}
if ($conf->global->DOLISIRH_SHOW_ONLY_FAVORITE_TASKS) {
if ($user->conf->DOLISIRH_SHOW_ONLY_FAVORITE_TASKS > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as elel ON (t.rowid = elel.fk_target AND elel.targettype='project_task')";
}
if ($conf->global->DOLISIRH_SHOW_ONLY_TASKS_WITH_TIMESPENT) {
if ($user->conf->DOLISIRH_SHOW_ONLY_TASKS_WITH_TIMESPENT > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as ptt ON (t.rowid = ptt.fk_task)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)";
$sql .= " WHERE p.entity IN (".getEntity('project').")";
$sql .= " AND t.fk_projet = p.rowid";
if ($conf->global->DOLISIRH_SHOW_ONLY_FAVORITE_TASKS) {
if ($user->conf->DOLISIRH_SHOW_ONLY_FAVORITE_TASKS > 0) {
$sql .= " AND elel.fk_target = t.rowid";
$sql .= " AND elel.fk_source = " . $filteronprojuser;
}

if ($conf->global->DOLISIRH_SHOW_ONLY_TASKS_WITH_TIMESPENT) {
if ($user->conf->DOLISIRH_SHOW_ONLY_TASKS_WITH_TIMESPENT > 0) {
$sql .= " AND ptt.fk_task = t.rowid AND ptt.fk_user = " . $filteronprojuser;
if ($timeMode == 'month') {
$sql .= " AND MONTH(ptt.task_date) = " . $timeArray['month'];
Expand Down

0 comments on commit bb67148

Please sign in to comment.