Timesheet - Fix another place where Save & New then changing the project keeps the old project

This commit is contained in:
nathangray 2017-03-17 09:30:05 -06:00
parent 74f7b6a997
commit b1299f7b3b
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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