Improve create and start permission handling (#613)

This commit is contained in:
Kevin Papst
2019-03-06 10:24:27 +01:00
committed by GitHub
parent bce85b04d6
commit e260dd84ad
31 changed files with 258 additions and 86 deletions

View File

@@ -97,18 +97,6 @@ trait TimesheetControllerTrait
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
if ($editForm->has('duration')) {
/** @var Timesheet $record */
$record = $editForm->getData();
$duration = $editForm->get('duration')->getData();
$end = null;
if ($duration > 0) {
$end = clone $record->getBegin();
$end->modify('+ ' . $duration . 'seconds');
}
$record->setEnd($end);
}
$entityManager = $this->getDoctrine()->getManager();
$entityManager->persist($entry);
$entityManager->flush();
@@ -174,17 +162,6 @@ trait TimesheetControllerTrait
$createForm->handleRequest($request);
if ($createForm->isSubmitted() && $createForm->isValid()) {
if ($createForm->has('duration')) {
$duration = $createForm->get('duration')->getData();
if ($duration > 0) {
/** @var Timesheet $record */
$record = $createForm->getData();
$end = clone $record->getBegin();
$end->modify('+ ' . $duration . 'seconds');
$record->setEnd($end);
}
}
$entityManager = $this->getDoctrine()->getManager();
try {