X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=week.php;h=fb2dcaa6af1ca72b1d7b6fa9cfc2d4e03ee29bab;hb=e7ecc20f1789ce0adda175aa0f70177b0f7fdb22;hp=7afcb4016e90af84b81edb8416698103c40667db;hpb=0cc1dc50345b052d65274c4e686bf3b4cd621c4d;p=timetracker.git diff --git a/week.php b/week.php index 7afcb401..fb2dcaa6 100644 --- a/week.php +++ b/week.php @@ -113,8 +113,10 @@ $cl_note = trim($request->getParameter('note')); // Get column headers, which are day numbers in month. $dayHeaders = ttWeekViewHelper::getDayHeadersForWeek($startDate->toString(DB_DATEFORMAT)); $lockedDays = ttWeekViewHelper::getLockedDaysForWeek($startDate->toString(DB_DATEFORMAT)); -// Build data array for the table. Format is described in the function.. -$dataArray = ttWeekViewHelper::getDataForWeekView($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT), $dayHeaders); +// Get already existing records. +$records = ttWeekViewHelper::getRecordsForInterval($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT)); +// Build data array for the table. Format is described in the function. +$dataArray = ttWeekViewHelper::getDataForWeekView($records, $dayHeaders); // Build day totals (total durations for each day in week). $dayTotals = ttWeekViewHelper::getDayTotals($dataArray, $dayHeaders); @@ -353,8 +355,10 @@ if ($request->isPost()) { $record['project_id'] = $cl_project; $record['task_id'] = $cl_task; $record['cf_1_value'] = $cl_cf_1; - $fields['row_id'] = ttWeekViewHelper::makeRowIdentifier($record).'_0'; // TODO: Handle a possible conflict with already existing row... - // We may have to increment the suffix here. + $fields['row_id'] = ttWeekViewHelper::makeRowIdentifier($record).'_0'; + // Note: no need to check for a possible conflict with an already existing row + // because we are doing an insert that does not affect already existing data. + $fields['note'] = $cl_note; } $fields['day_header'] = $dayHeader; @@ -408,6 +412,7 @@ $smarty->assign('task_list', $task_list); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="fillDropdowns()"'); $smarty->assign('timestring', $startDate->toString($user->date_format).' - '.$endDate->toString($user->date_format)); +$smarty->assign('time_records', $records); $smarty->assign('title', $i18n->getKey('title.time')); $smarty->assign('content_page_name', 'week.tpl');