X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/7df94ddee8feb9bc19b681f2b58fc547df622c9b..0e6a98c88343858e870765390e9d802eda764604:/WEB-INF/lib/ttTimeHelper.class.php diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index ff3399ca..da768827 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -852,28 +852,23 @@ class ttTimeHelper { // Note that billable property is not part of the label. Instead, we intend to // identify such records with a different color in week view. static function makeRecordLabel($record) { - // TODO: debug this function. global $user; // Start with client. if ($user->isPluginEnabled('cl')) $label = $record['client']; // Add project. - $project = $record['project'] ? $record['project'] : ''; - if (!empty($label)) $label .= ' - '; - $label .= $project; + if (!empty($label) && !empty($record['project'])) $label .= ' - '; + $label .= $record['project']; // Add task. - $task = $record['task'] ? $record['task'] : ''; - if (!empty($label)) $label .= ' - '; - $label .= $task; + if (!empty($label) && !empty($record['task'])) $label .= ' - '; + $label .= $record['task']; // Add custom field 1. if ($user->isPluginEnabled('cf')) { - if ($record['cf_1_value']) { - if (!empty($label)) $label .= ' - '; - $label .= $record['cf_1_value']; - } + if (!empty($label) && !empty($record['cf_1_value'])) $label .= ' - '; + $label .= $record['cf_1_value']; } return $label; @@ -902,9 +897,11 @@ class ttTimeHelper { static function getDayHeadersForWeek($start_date) { $dayHeaders = array(); $objDate = new DateAndTime(DB_DATEFORMAT, $start_date); - $dayHeaders['day_header_0'] = (string)$objDate->getDate(); // It returns an int on first call. Why? + $dayHeaders['day_header_0'] = (string) $objDate->getDate(); // It returns an int on first call. + if (strlen($dayHeaders['day_header_0']) == 1) // Which is an implementation detail of DateAndTime class. + $dayHeaders['day_header_0'] = '0'.$dayHeaders['day_header_0']; // Add a 0 for single digit day. $objDate->incDay(); - $dayHeaders['day_header_1'] = $objDate->getDate(); + $dayHeaders['day_header_1'] = $objDate->getDate(); // After incDay it returns a string with leading 0, when necessary. $objDate->incDay(); $dayHeaders['day_header_2'] = $objDate->getDate(); $objDate->incDay();