Fix: Selection of users color was not user owner of event.

This commit is contained in:
Laurent Destailleur 2014-10-18 15:35:32 +02:00
parent 6a9d825a65
commit 6bbeaee8fe
5 changed files with 40 additions and 20 deletions

View File

@ -5,6 +5,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* ***** ***** ChangeLog for 3.7 compared to 3.6.* *****
For users: 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: 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: Add number of active notification into tab title (like we do for notes and documents)
- New: Can add product into category from category card. - New: Can add product into category from category card.

View File

@ -66,7 +66,7 @@ class ActionComm extends CommonObject
var $note; // Description var $note; // Description
var $userassigned = array(); // Array of user ids 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 $userdoneid; // Id of user done
var $usertodo; // Object user of owner // deprecated var $usertodo; // Object user of owner // deprecated
var $userdone; // Object user that did action // deprecated var $userdone; // Object user that did action // deprecated

View File

@ -876,6 +876,7 @@ if (count($listofextcals))
$maxnbofchar=18; $maxnbofchar=18;
$cachethirdparties=array(); $cachethirdparties=array();
$cachecontacts=array(); $cachecontacts=array();
$cacheusers=array();
// Define theme_datacolor array // Define theme_datacolor array
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; $color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
@ -1074,7 +1075,7 @@ $db->close();
* @param int $year Year * @param int $year Year
* @param int $monthshown Current month shown in calendar view * @param int $monthshown Current month shown in calendar view
* @param string $style Style to use for this day * @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 $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 int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL * @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 $user, $conf, $langs;
global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
global $theme_datacolor; global $theme_datacolor;
global $cachethirdparties, $cachecontacts, $colorindexused; global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n"; print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
@ -1146,11 +1147,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if (in_array($user->id, $keysofuserassigned)) if (in_array($user->id, $keysofuserassigned))
{ {
$nummytasks++; $cssclass='family_mytasks'; $nummytasks++; $cssclass='family_mytasks';
// Must defined rule to choose color of who to use. if (empty($cacheusers[$event->userownerid]))
// event->ownerid will still contains user id of owner {
// event->userassigned will be an array in future. $newuser=new User($db);
$color=$user->color; $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') else if ($event->type_code == 'ICALEVENT')
{ {
@ -1171,6 +1178,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
else else
{ {
$numother++; $cssclass='family_other'; $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. if ($color == -1) // Color was not forced. Set color according to color index.
{ {

View File

@ -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("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("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("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("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("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); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
@ -275,7 +275,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; //print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
//print '&nbsp; '; //print '&nbsp; ';
@ -348,6 +348,7 @@ if ($resql)
print '</td>'; print '</td>';
// User author // User author
/*
print '<td align="left">'; print '<td align="left">';
if ($obj->useridauthor) if ($obj->useridauthor)
{ {
@ -358,6 +359,7 @@ if ($resql)
} }
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
*/
// User to do // User to do
print '<td align="left">'; print '<td align="left">';

View File

@ -206,7 +206,7 @@ if ($action == 'add' && $canadduser)
$object->salary = GETPOST("salary")!=''?GETPOST("salary"):''; $object->salary = GETPOST("salary")!=''?GETPOST("salary"):'';
$object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):''; $object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):'';
$object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):''; $object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):'';
$object->color = GETPOST("color")!=''?GETPOST("color"):''; $object->color = GETPOST("color")!=''?GETPOST("color"):'';
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
@ -353,7 +353,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$object->salary = GETPOST("salary")!=''?GETPOST("salary"):''; $object->salary = GETPOST("salary")!=''?GETPOST("salary"):'';
$object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):''; $object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):'';
$object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):''; $object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):'';
$object->color = GETPOST("color")!=''?GETPOST("color"):''; $object->color = GETPOST("color")!=''?GETPOST("color"):'';
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
@ -980,7 +980,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
print '<input size="8" type="text" name="weeklyhours" value="'.GETPOST('weeklyhours').'">'; print '<input size="8" type="text" name="weeklyhours" value="'.GETPOST('weeklyhours').'">';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
// User color // User color
if (! empty($conf->agenda->enabled)) if (! empty($conf->agenda->enabled))
{ {
@ -1124,7 +1124,7 @@ else
if ($action != 'edit') if ($action != 'edit')
{ {
$rowspan=17; $rowspan=17;
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
@ -1325,15 +1325,14 @@ else
print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>'; print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="2">'.$object->accountancy_code.'</td>'; print '<td colspan="2">'.$object->accountancy_code.'</td>';
} }
// Color user // Color user
if (! empty($conf->agenda->enabled)) if (! empty($conf->agenda->enabled))
{ {
print '<tr><td valign="top">'.$langs->trans("ColorUser").'</td>'; print '<tr><td valign="top">'.$langs->trans("ColorUser").'</td>';
print '<td width="50px" bgcolor="'.$object->color.'">'; print '<td colspan="2">';
print $object->color; if ($object->color) print '<input type="text" disabled="disabled" style="padding: 0; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$object->color.'" value="'.$object->color.'">';
print '</td>'; print '</td>';
print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }
@ -1662,7 +1661,7 @@ else
if (! empty($conf->skype->enabled)) $rowspan++; if (! empty($conf->skype->enabled)) $rowspan++;
if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3;
if (! empty($conf->agenda->enabled)) $rowspan++; if (! empty($conf->agenda->enabled)) $rowspan++;
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="updateuser" enctype="multipart/form-data">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="updateuser" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@ -2039,7 +2038,7 @@ else
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
} }
// User color // User color
if (! empty($conf->agenda->enabled)) if (! empty($conf->agenda->enabled))
{ {