From b1299f7b3b5efb5782cecf5fd41f13373805a73f Mon Sep 17 00:00:00 2001 From: nathangray Date: Fri, 17 Mar 2017 09:30:05 -0600 Subject: [PATCH] Timesheet - Fix another place where Save & New then changing the project keeps the old project --- timesheet/inc/class.timesheet_bo.inc.php | 10 ++++++++-- timesheet/inc/class.timesheet_ui.inc.php | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/timesheet/inc/class.timesheet_bo.inc.php b/timesheet/inc/class.timesheet_bo.inc.php index 08a8f5f3a3..8de8e11fe6 100644 --- a/timesheet/inc/class.timesheet_bo.inc.php +++ b/timesheet/inc/class.timesheet_bo.inc.php @@ -602,9 +602,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