Version 2.0.1 (#3853)
* configure email validation mode to fix deprecation message * allow to use non brand icon in saml provider * new method getCalculatedDuration() * getRawData() by id * only stop entries if new one is running * fix validator tampering with timesheet duration * fix allow setting null as customer * bump packages
This commit is contained in:
@@ -28,7 +28,7 @@ final class DurationCalculator implements CalculatorInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$duration = $record->getEnd()->getTimestamp() - $record->getBegin()->getTimestamp();
|
||||
$duration = $record->getCalculatedDuration();
|
||||
$record->setDuration($duration);
|
||||
|
||||
$this->roundings->applyRoundings($record);
|
||||
|
||||
@@ -116,7 +116,7 @@ final class RoundingService
|
||||
$rounder->roundEnd($record, $rounding['end']);
|
||||
|
||||
if ($record->getBegin() !== null) {
|
||||
$duration = $record->getEnd()->getTimestamp() - $record->getBegin()->getTimestamp();
|
||||
$duration = $record->getCalculatedDuration();
|
||||
$record->setDuration($duration);
|
||||
|
||||
$rounder->roundDuration($record, $rounding['duration']);
|
||||
|
||||
@@ -127,14 +127,16 @@ final class TimesheetService
|
||||
$this->repository->save($timesheet);
|
||||
$this->dispatcher->dispatch(new TimesheetCreatePostEvent($timesheet));
|
||||
|
||||
// TODO really stop always or only if $timesheet->getEnd() === null
|
||||
try {
|
||||
$this->stopActiveEntries($timesheet);
|
||||
} catch (ValidationFailedException $vex) {
|
||||
// could happen for timesheets that were started in the future (end before begin)
|
||||
// or if you try to create a new timesheet while an old one is running for too long
|
||||
throw new ValidationFailedException($vex->getViolations(), 'Cannot stop running timesheet');
|
||||
if ($timesheet->isRunning()) {
|
||||
try {
|
||||
$this->stopActiveEntries($timesheet);
|
||||
} catch (ValidationFailedException $vex) {
|
||||
// could happen for timesheets that were started in the future (end before begin)
|
||||
// or if you try to create a new timesheet while an old one is running for too long
|
||||
throw new ValidationFailedException($vex->getViolations(), 'Cannot stop running timesheet');
|
||||
}
|
||||
}
|
||||
|
||||
$this->repository->commit();
|
||||
} catch (\Exception $ex) {
|
||||
$this->repository->rollback();
|
||||
|
||||
Reference in New Issue
Block a user