diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 03c087e1a4e..b4dda563397 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -545,8 +545,9 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
/*
* Action move update, used when user move an event in calendar by drag'n drop
+ * TODO Move this into page comm/action/index that trigger this call by the drag and drop of event.
*/
-if ($action == 'mupdate')
+if (GETPOST('actionmove','alpha') == 'mupdate')
{
$object->fetch($id);
$object->fetch_userassigned();
@@ -557,7 +558,7 @@ if ($action == 'mupdate')
$newdate=GETPOST('newdate','alpha');
if (empty($newdate) || strpos($newdate,'dayevent_') != 0 )
{
- header("Location: ".$backtopage);
+ header("Location: ".$backtopage);
exit;
}
@@ -1296,14 +1297,18 @@ if ($id > 0)
// Link to other agenda views
$out='';
- $out.='
';
//$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
- $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
+ $i=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
- $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ...
- //print $nextindextouse;
+ $colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
+ $nextindextouse=count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
+ //var_dump($colorindexused);
foreach ($eventarray as $daykey => $notused)
{
@@ -1258,25 +1263,24 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($i < $maxprint || $maxprint == 0 || ! empty($conf->global->MAIN_JS_SWITCH_AGENDA))
{
$keysofuserassigned=array_keys($event->userassigned);
-
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
// Define $color (Hex string like '0088FF') and $cssclass of event
- $color=-1; $colorindex=-1;
+ $color=-1; $cssclass=''; $colorindex=-1;
if (in_array($user->id, $keysofuserassigned))
{
- $nummytasks++; $cssclass='family_mytasks';
+ $cssclass='family_mytasks';
- if (empty($cacheusers[$event->userownerid]))
- {
- $newuser=new User($db);
- $newuser->fetch($event->userownerid);
- $cacheusers[$event->userownerid]=$newuser;
- }
- //var_dump($cacheusers[$event->userownerid]->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;
+ // 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') // Event come from external ical file
{
@@ -1287,6 +1291,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
$numicals[dol_string_nospecial($event->icalname)]++;
}
+
$color=($event->icalcolor?$event->icalcolor:-1);
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
}
@@ -1311,7 +1316,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
// 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 < 0) // Color was not set on user card. Set color according to color index.
{
// Define color index if not yet defined
$idusertouse=($event->userownerid?$event->userownerid:0);
@@ -1321,8 +1327,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
else
{
- $colorindex=$nextindextouse;
- $colorindexused[$idusertouse]=$colorindex;
+ $colorindex=$nextindextouse;
+ $colorindexused[$idusertouse]=$colorindex;
if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color
}
//print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.' ';
@@ -1358,7 +1364,6 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}else{
$cssclass.= " unmovable";
}
-
}
$h=''; $nowrapontd=1;
@@ -1376,7 +1381,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
//var_dump($event->userassigned);
//var_dump($event->transparency);
print '
'."\n";
+
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup,'',$resourceid);
dol_fiche_end();
@@ -393,7 +395,6 @@ if ($resql)
}
- print '';
+//$nav.='';
// Must be after the nav definition
$param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
@@ -294,6 +299,8 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
$head = calendars_prepare_head($paramnoaction);
+print '';
// Line header with list of days
@@ -792,7 +798,7 @@ foreach ($usernames as $username)
echo "