From 27922446d7e16173c84c84775399995768b3c106 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 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