Allow to recalculate rates via bulk edit (#1768)

This commit is contained in:
Kevin Papst
2020-06-05 12:25:56 +02:00
committed by GitHub
parent da5563960b
commit ae6beff5d8
6 changed files with 45 additions and 10 deletions

View File

@@ -330,14 +330,21 @@ abstract class TimesheetAbstractController extends AbstractController
$timesheet->setExported($dto->isExported());
$execute = true;
}
// setting both values allows to erase wrong
if (null !== $dto->getHourlyRate()) {
if ($dto->isRecalculateRates()) {
$timesheet->setFixedRate(null);
$timesheet->setHourlyRate($dto->getHourlyRate());
$timesheet->setHourlyRate(null);
$timesheet->setInternalRate(null);
$execute = true;
} elseif (null !== $dto->getFixedRate()) {
$timesheet->setFixedRate($dto->getFixedRate());
$timesheet->setHourlyRate(null);
$timesheet->setInternalRate(null);
$execute = true;
} elseif (null !== $dto->getHourlyRate()) {
$timesheet->setFixedRate(null);
$timesheet->setInternalRate(null);
$timesheet->setHourlyRate($dto->getHourlyRate());
$execute = true;
}
}