/** * starts timesheet record * * @param integer $projectID ID of project to record * @param $activityID * @param $user * @return int id of the new entry or false on failure * @author th, sl */ public function startRecorder($projectID, $activityID, $user) { $projectID = MySQL::SQLValue($projectID, MySQL::SQLVALUE_NUMBER); $activityID = MySQL::SQLValue($activityID, MySQL::SQLVALUE_NUMBER); $user = MySQL::SQLValue($user, MySQL::SQLVALUE_NUMBER); $values['projectID'] = $projectID; $values['activityID'] = $activityID; $values['start'] = time(); $values['userID'] = $user; $values['statusID'] = $this->kga->getDefaultStatus(); $rate = $this->get_best_fitting_rate($user, $projectID, $activityID); if ($rate) { $values['rate'] = $rate; } $fixedRate = $this->get_best_fitting_fixed_rate($projectID, $activityID); if ($fixedRate) { $values['fixedRate'] = $fixedRate; } if ($this->kga->getSettings()->getDefaultLocation() != '') { $values['location'] = "'" . $this->kga->getSettings()->getDefaultLocation() . "'"; } $table = $this->getTimeSheetTable(); $result = $this->conn->InsertRow($table, $values); if (!$result) { $this->logLastError('startRecorder'); return false; } return $this->conn->GetLastInsertID(); }