diff --git a/ChangeLog b/ChangeLog
index 8e48a5fc67d..eb781d4ee4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
+- New: Can set a color on user card (visible into agenda view).
- New: extrafields for projects and tasks are exported to ODT documents.
- New: Add number of active notification into tab title (like we do for notes and documents)
- New: Can add product into category from category card.
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index df0a359dd56..b631160afde 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -66,7 +66,7 @@ class ActionComm extends CommonObject
var $note; // Description
var $userassigned = array(); // Array of user ids
- var $userownerid; // Id of user owner
+ var $userownerid; // Id of user owner
var $userdoneid; // Id of user done
var $usertodo; // Object user of owner // deprecated
var $userdone; // Object user that did action // deprecated
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 48387245c8a..2098a07d20b 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -876,6 +876,7 @@ if (count($listofextcals))
$maxnbofchar=18;
$cachethirdparties=array();
$cachecontacts=array();
+$cacheusers=array();
// Define theme_datacolor array
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
@@ -1074,7 +1075,7 @@ $db->close();
* @param int $year Year
* @param int $monthshown Current month shown in calendar view
* @param string $style Style to use for this day
- * @param array $eventarray Array of events
+ * @param array $eventarray Array of events
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
* @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL
@@ -1087,7 +1088,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
global $user, $conf, $langs;
global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
global $theme_datacolor;
- global $cachethirdparties, $cachecontacts, $colorindexused;
+ global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
print '
'."\n";
@@ -1146,11 +1147,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if (in_array($user->id, $keysofuserassigned))
{
$nummytasks++; $cssclass='family_mytasks';
-
- // Must defined rule to choose color of who to use.
- // event->ownerid will still contains user id of owner
- // event->userassigned will be an array in future.
- $color=$user->color;
+
+ if (empty($cacheusers[$event->userownerid]))
+ {
+ $newuser=new User($db);
+ $newuser->fetch($event->userownerid);
+ $cacheusers[$event->userownerid]=$newuser;
+ }
+ //var_dump($cacheusers[$event->userownerid]->color);
+
+ // 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 (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
}
else if ($event->type_code == 'ICALEVENT')
{
@@ -1171,6 +1178,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
else
{
$numother++; $cssclass='family_other';
+
+ if (empty($cacheusers[$event->userownerid]))
+ {
+ $newuser=new User($db);
+ $newuser->fetch($event->userownerid);
+ $cacheusers[$event->userownerid]=$newuser;
+ }
+ //var_dump($cacheusers[$event->userownerid]->color);
+
+ // 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 (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
}
if ($color == -1) // Color was not forced. Set color according to color index.
{
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index 046ec450c26..4fc7386157b 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -259,7 +259,7 @@ if ($resql)
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
+ //print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
@@ -275,7 +275,7 @@ if ($resql)
print '';
print '