allow negative duration via internal API (#3573)
This commit is contained in:
@@ -132,9 +132,6 @@ final class TimesheetBasicValidator extends ConstraintValidator
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
$pathStart = 'begin';
|
||||
$pathEnd = 'end';
|
||||
|
||||
$projectBegin = $project->getStart();
|
||||
$projectEnd = $project->getEnd();
|
||||
|
||||
@@ -142,10 +139,13 @@ final class TimesheetBasicValidator extends ConstraintValidator
|
||||
return;
|
||||
}
|
||||
|
||||
$pathStart = 'begin';
|
||||
$pathEnd = 'end';
|
||||
|
||||
$timesheetStart = $timesheet->getBegin();
|
||||
$timesheetEnd = $timesheet->getEnd();
|
||||
|
||||
if (null !== $timesheetStart && $pathStart !== null) {
|
||||
if (null !== $timesheetStart) {
|
||||
if (null !== $projectBegin && $timesheetStart->getTimestamp() < $projectBegin->getTimestamp()) {
|
||||
$context->buildViolation('The project has not started at that time.')
|
||||
->atPath($pathStart)
|
||||
@@ -161,7 +161,7 @@ final class TimesheetBasicValidator extends ConstraintValidator
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $timesheetEnd && $pathEnd !== null) {
|
||||
if (null !== $timesheetEnd) {
|
||||
if (null !== $projectEnd && $timesheetEnd->getTimestamp() > $projectEnd->getTimestamp()) {
|
||||
$context->buildViolation('The project is finished at that time.')
|
||||
->atPath($pathEnd)
|
||||
|
||||
Reference in New Issue
Block a user