Skip to content
Permalink
Browse files

Merge branch 'hotfix/CreateTimelogIsUnassigningTaskUser'

  • Loading branch information...
taliesinmillhouse committed Sep 10, 2019
2 parents 4adb3fd + 647f272 commit ff6ba4cb36f0b9e288f056c0ac1cbf4ce5a59130
Showing with 9 additions and 8 deletions.
  1. +5 −1 system/modules/timelog/actions/edit.php
  2. +4 −7 system/modules/timelog/models/Timelog.php
@@ -108,7 +108,11 @@ function edit_POST(Web $w) {
$timelog->dt_end = $time_object->format('Y-m-d H:i:s');
}
}
if (empty($timelog->user_id)) {
$timelog->user_id = !empty($_POST['user_id']) ? intval($_POST['user_id']) : $this->w->Auth->user()->id;
}
// Timelog user_id handled in insert/update
$timelog->insertOrUpdate();
@@ -116,7 +116,6 @@ public function getLinkedObject() {
}
public function start($object, $start_time = null) {
$this->w->Log->debug("TimeLog Start");
if (empty($object->id)) {
return false;
}
@@ -132,26 +131,24 @@ public function start($object, $start_time = null) {
}
public function stop() {
$this->w->Log->debug("time " . $this->dt_end);
if (empty($this->dt_end)) {
$this->w->Log->debug("stopping time");
$this->dt_end = time();
$this->update();
}
}
public function insert($force_validation = true) {
// If user is admin try and set the user_id to the given one from the timelog form
if (empty($this->user_id)) {
$this->user_id = $this->w->Auth->user()->id;
if ($this->w->Auth->user()->is_admin) {
$this->user_id = !empty($_POST['user_id']) ? intval($_POST['user_id']) : $this->w->Auth->user()->id;
}
parent::insert($force_validation);
}
public function update($force_null_values = false, $force_validation = true) {
if (empty($this->user_id)) {
$this->user_id = $this->w->Auth->user()->id;
if ($this->w->Auth->user()->is_admin) {
$this->user_id = !empty($_POST['user_id']) ? intval($_POST['user_id']) : $this->w->Auth->user()->id;
}
parent::update($force_null_values, $force_validation);

0 comments on commit ff6ba4c

Please sign in to comment.
You can’t perform that action at this time.