diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index 61fdff8e9f..f32d0deff6 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -112,11 +112,19 @@ class timesheet_ui extends timesheet_bo { if (!empty($event['tse_app']) && $event['tse_app'] !== TIMESHEET_APP && !empty($event['tse_app_id'])) { - if (!isset($this->data['link_to']['to_id'])) + if (!isset($_REQUEST['link_app'])) { - $this->data['link_to']['to_id'] = $this->data['ts_id'] ?? []; + $_REQUEST['link_app'] = $event['tse_app']; + $_REQUEST['link_id'] = $event['tse_app_id']; + } + else + { + if (!isset($this->data['link_to']['to_id'])) + { + $this->data['link_to']['to_id'] = $this->data['ts_id'] ?? []; + } + Api\Link::link(TIMESHEET_APP, $this->data['link_to']['to_id'], $event['tse_app'], $event['tse_app_id']); } - Api\Link::link(TIMESHEET_APP, $this->data['link_to']['to_id'], $event['tse_app'], $event['tse_app_id']); } } }