From 84b50f45f80c65a2dd20d08acf9a45183744667f Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Tue, 13 Nov 2012 14:44:32 +0100
Subject: [PATCH] Fix: strict mode again

---
 htdocs/comm/action/index.php | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 1de6c0678d8..bd9e94139e1 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -981,8 +981,22 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
 
                     // Define $color and $cssclass of event
                     $color=-1; $cssclass=''; $colorindex=-1;
-                    if ($event->author->id == $user->id || $event->usertodo->id == $user->id || $event->userdone->id == $user->id) { $nummytasks++; $colorindex=1; $cssclass='family_mytasks'; }
-                    else if ($event->type_code == 'ICALEVENT') { $numical++; $numicals[dol_string_nospecial($event->icalname)]++; $color=$event->icalcolor; $cssclass=($event->icalname?'family_'.dol_string_nospecial($event->icalname):'family_other'); }
+                    if ((! empty($event->author->id) && $event->author->id == $user->id)
+                    || (! empty($event->usertodo->id) && $event->usertodo->id == $user->id)
+                    || (! empty($event->userdone->id) && $event->userdone->id == $user->id)) {
+                    	$nummytasks++; $colorindex=1; $cssclass='family_mytasks';
+                    }
+                    else if ($event->type_code == 'ICALEVENT') {
+                    	$numical++;
+                    	if (! empty($event->icalname)) {
+                    		if (! isset($numicals[dol_string_nospecial($event->icalname)])) {
+                    			$numicals[dol_string_nospecial($event->icalname)] = 0;
+                    		}
+                    		$numicals[dol_string_nospecial($event->icalname)]++;
+                    	}
+                    	$color=$event->icalcolor;
+                    	$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other');
+                    }
                     else if ($event->type_code == 'BIRTHDAY')  { $numbirthday++; $colorindex=2; $cssclass='family_birthday'; }
                     else { $numother++; $colorindex=2; $cssclass='family_other'; }
                     if ($color == -1) $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
-- 
GitLab