Release 2.10 (#4549)

This commit is contained in:
Kevin Papst
2024-01-19 12:05:07 +01:00
committed by GitHub
parent afd60a67f6
commit 46739795ff
52 changed files with 348 additions and 292 deletions

View File

@@ -140,13 +140,13 @@ final class TimesheetBasicValidator extends ConstraintValidator
}
if (null !== $timesheetEnd) {
if (null !== $projectEnd && $timesheetEnd->getTimestamp() > $projectEnd->getTimestamp()) {
if (null !== $projectEnd && $timesheetEnd > $projectEnd) {
$context->buildViolation(TimesheetBasic::getErrorName(TimesheetBasic::PROJECT_ALREADY_ENDED))
->atPath($pathEnd)
->setTranslationDomain('validators')
->setCode(TimesheetBasic::PROJECT_ALREADY_ENDED)
->addViolation();
} elseif (null !== $projectBegin && $timesheetEnd->getTimestamp() < $projectBegin->getTimestamp()) {
} elseif (null !== $projectBegin && $timesheetEnd < $projectBegin) {
$context->buildViolation(TimesheetBasic::getErrorName(TimesheetBasic::PROJECT_NOT_STARTED))
->atPath($pathEnd)
->setTranslationDomain('validators')

View File

@@ -206,7 +206,7 @@ final class TimesheetBudgetUsedValidator extends ConstraintValidator
private function addBudgetViolation(TimesheetBudgetUsed $constraint, Timesheet $timesheet, string $field, float $budget, float $rate): void
{
// using the locale of the assigned user is not the best solution, but allows to be independent of the request stack
$helper = new LocaleFormatter($this->localeService, $timesheet->getUser()->getLanguage());
$helper = new LocaleFormatter($this->localeService, $timesheet->getUser()?->getLocale() ?? 'en');
$currency = $timesheet->getProject()->getCustomer()->getCurrency();
$free = $budget - $rate;

View File

@@ -33,14 +33,9 @@ final class TimesheetDeactivatedValidator extends ConstraintValidator
$this->validateActivityAndProject($value, $this->context);
}
/**
* @param TimesheetEntity $timesheet
* @param ExecutionContextInterface $context
*/
protected function validateActivityAndProject(TimesheetEntity $timesheet, ExecutionContextInterface $context): void
private function validateActivityAndProject(TimesheetEntity $timesheet, ExecutionContextInterface $context): void
{
$timesheetEnd = $timesheet->getEnd();
$newOrStarted = null === $timesheetEnd || $timesheet->getId() === null;
$newOrStarted = $timesheet->isRunning() || $timesheet->getId() === null;
if (!$newOrStarted) {
return;