X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/532ab62cfa2895753eb599ab3b35c104ca344602..88134e6891875e698d71e06806e9c0ddde5c03bd:/week.php diff --git a/week.php b/week.php index a015e85d..34efd56e 100644 --- a/week.php +++ b/week.php @@ -146,6 +146,12 @@ class TimeCellRenderer extends DefaultCellRenderer { $field->setFormName($table->getFormName()); $field->setSize(2); $field->setValue($table->getValueAt($row,$column)['duration']); + // Disable control when time entry mode is TYPE_START_FINISH and there is no value in control + // because we can't supply start and finish times in week view - there are no fields for them. + global $user; + if (!$field->getValue() && TYPE_START_FINISH == $user->record_type) { + $field->setEnabled(false); + } $this->setValue($field->getHtml()); return $this->toString(); } @@ -266,7 +272,7 @@ $form->addInput(array('type'=>'textarea','name'=>'note','style'=>'width: 600px; $form->addInput(array('type'=>'calendar','name'=>'date','value'=>$cl_date)); // calendar if ($user->isPluginEnabled('iv')) $form->addInput(array('type'=>'checkbox','name'=>'billable','value'=>$cl_billable)); -$form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_submit click. +$form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'get_date()')); // User current date, which gets filled in on btn_submit click. $form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.submit'))); // If we have custom fields - add controls for them. @@ -383,11 +389,12 @@ if ($request->isPost()) { if ($existingDuration == null) { // Insert a new record here. $fields = array(); + $fields['row_id'] = $dataArray[$rowNumber]['row_id']; + $fields['day_header'] = $dayHeader; + $fields['start_date'] = $startDate->toString(DB_DATEFORMAT); // To be able to determine date for the entry using $dayHeader. + $fields['duration'] = $postedDuration; + $fields['browser_today'] = $request->getParameter('browser_today', null); $result = ttTimeHelper::insertDurationFromWeekView($fields, $err); - //$dataArray[$rowNumber]['row_id'], - //$dayHeader, - //$postedDuration, - //$startDate->toString(DB_DATEFORMAT)); } elseif ($postedDuration == null || 0 == ttTimeHelper::toMinutes($postedDuration)) { // Delete an already existing record here. $result = ttTimeHelper::delete($dataArray[$rowNumber][$dayHeader]['tt_log_id'], $user->getActiveUser());