diff --git a/timesheet/inc/class.timesheet_bo.inc.php b/timesheet/inc/class.timesheet_bo.inc.php index 06953bf252..84f724e806 100644 --- a/timesheet/inc/class.timesheet_bo.inc.php +++ b/timesheet/inc/class.timesheet_bo.inc.php @@ -606,9 +606,15 @@ class timesheet_bo extends Api\Storage return false; } // Update ts_project to match project - if ($this->pm_integration == 'full' && $old && $old['pm_id'] != $new['pm_id']) + if ($this->pm_integration == 'full' && ( + !$old && $this->data['pm_id'] != $this->data['old_pm_id'] || $old && $old['pm_id'] != $new['pm_id'] + )) { - $new['ts_title'] = $new['pm_id'] ? Link::title('projectmanager', $new['pm_id']) : ''; + $this->data['ts_project'] = $this->data['pm_id'] ? Link::title('projectmanager', $this->data['pm_id']) : ''; + if($this->data['ts_title'] == Link::title('projectmanager', $old['pm_id'])) + { + $this->data['ts_title'] = $this->data['ts_project']; + } } // Check for restore of deleted contact, restore held links diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index 5e877b9768..240938f2d2 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -291,6 +291,10 @@ class timesheet_ui extends timesheet_bo } // save the selected project, to delete the project-link, if the user changes the project $this->data['old_pm_id'] = $this->data['pm_id']; + if($this->pm_integration == 'none') + { + unset($this->data['pm_id']); + } break; } // fall-through for save