Release 2.0.30 (#4225)

This commit is contained in:
Kevin Papst
2023-08-16 18:20:14 +02:00
committed by GitHub
parent c7bc8fae73
commit adc0779912
21 changed files with 860 additions and 520 deletions

View File

@@ -34,10 +34,16 @@ use InvalidArgumentException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\Validator\ValidatorInterface;
final class TimesheetService
{
/**
* @var array<string>
*/
private array $doNotValidateCodes = [];
public function __construct(
private SystemConfiguration $configuration,
private TimesheetRepository $repository,
@@ -236,10 +242,25 @@ final class TimesheetService
$errors = $this->validator->validate($timesheet, null, $groups);
if ($errors->count() > 0) {
throw new ValidationFailedException($errors, 'Validation Failed');
/** @var ConstraintViolation $error */
foreach ($errors as $error) {
if (\in_array($error->getCode(), $this->doNotValidateCodes, true)) {
continue;
}
throw new ValidationFailedException($errors, 'Validation Failed');
}
}
}
/**
* @param array<string> $validationCodes
*/
public function setIgnoreValidationCodes(array $validationCodes): void
{
$this->doNotValidateCodes = $validationCodes;
}
/**
* Makes sure, that the timesheet record has the timezone of the user.
*

View File

@@ -254,7 +254,7 @@ final class TimesheetStatisticService
return null;
}
return new DateTime($result, new \DateTimeZone($user->getTimezone()));
return new DateTime((string) $result, new \DateTimeZone($user->getTimezone()));
}
/**