diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index ec42c0257af..096771c9ea7 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -890,6 +890,7 @@ $i = 0; //$totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); $today_start_date_time = dol_now(); +$cache_user_list = array(); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { @@ -924,36 +925,54 @@ while ($i < $imaxinloop) { $actionstatic->fetchResources(); } - // get event color - $event_color = ''; + // cache of user list (owners) + if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) { + $res = $userstatic->fetch($obj->fk_user_action); + if ($res > 0) { + $cache_user_list[$obj->fk_user_action] = $userstatic; + } + } + + // get event style for user owner + $event_owner_style = ''; + // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) + if ($cache_user_list[$obj->fk_user_action]->color != '') { + $event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;'; + } + + // get event style for start date $event_more_class = ''; + $event_start_date_style = ''; $event_start_date_time = $actionstatic->datep; if ($obj->fulldayevent) { $today_start_date_time = dol_mktime(0, 0, 0, date('m', $today_start_date_time), date('d', $today_start_date_time), date('Y', $today_start_date_time)); } if ($event_start_date_time > $today_start_date_time) { // future event - $event_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR; $event_more_class = 'event-future'; + $event_start_date_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR; } else { // check event end date $event_end_date_time = $db->jdate($obj->dp2); if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) { // past event - $event_color = $conf->global->AGENDA_EVENT_PAST_COLOR; $event_more_class = 'event-past'; + $event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR; } elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) { // past event - $event_color = $conf->global->AGENDA_EVENT_PAST_COLOR; $event_more_class = 'event-past'; + $event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR; } else { // current event - $event_color = $conf->global->AGENDA_EVENT_CURRENT_COLOR; $event_more_class = 'event-current'; + $event_start_date_color = $conf->global->AGENDA_EVENT_CURRENT_COLOR; } } + if ($event_start_date_color != '') { + $event_start_date_style .= 'background: #' . $event_start_date_color . ';'; + } - print '