fix restart timesheet with meta-fields (#1993)
This commit is contained in:
@@ -660,7 +660,6 @@ class TimesheetController extends BaseApiController
|
||||
->setActivity($timesheet->getActivity())
|
||||
->setProject($timesheet->getProject())
|
||||
;
|
||||
$this->service->prepareNewTimesheet($copyTimesheet);
|
||||
|
||||
if (null !== ($copy = $paramFetcher->get('copy'))) {
|
||||
if (\in_array($copy, ['rates', 'all'])) {
|
||||
@@ -686,6 +685,12 @@ class TimesheetController extends BaseApiController
|
||||
}
|
||||
}
|
||||
|
||||
// needs to be executed AFTER copying the values!
|
||||
// the event triggered in prepareNewTimesheet() will add meta fields first. Afterwards
|
||||
// setMetaField() will merge meta fields and if we merge in the existing ones from the copied record,
|
||||
// it will fail, because they do not have a type assigned
|
||||
$this->service->prepareNewTimesheet($copyTimesheet);
|
||||
|
||||
$this->service->restartTimesheet($copyTimesheet, $timesheet);
|
||||
|
||||
$view = new View($copyTimesheet, 200);
|
||||
|
||||
Reference in New Issue
Block a user