Release 2.9.0 (#4526)
* added fix to work around bc break in new phpword version * fix phpoffice deprecations * mark unused option as deprecated * support for DateTimeInterface and DateTimeImmutable where possible * use TRUSTED_PROXIES setting - fixes #4533 * re-enable Kimai test in docker test build script (#4541) * bump dependencies
This commit is contained in:
@@ -34,7 +34,8 @@ use App\Repository\ProjectRepository;
|
||||
use App\Repository\TimesheetRepository;
|
||||
use App\Repository\UserRepository;
|
||||
use App\Timesheet\DateTimeFactory;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
@@ -54,14 +55,9 @@ class ProjectStatisticService
|
||||
}
|
||||
|
||||
/**
|
||||
* WARNING: this method does not respect the budget type. Your results will always be wither the "full lifetime data" or the "selected date-range".
|
||||
*
|
||||
* @param Project $project
|
||||
* @param DateTime|null $begin
|
||||
* @param DateTime|null $end
|
||||
* @return ProjectStatistic
|
||||
* WARNING: this method does not respect the budget type. Your results will always be with the "full lifetime data" or the "selected date-range".
|
||||
*/
|
||||
public function getProjectStatistics(Project $project, ?DateTime $begin = null, ?DateTime $end = null): ProjectStatistic
|
||||
public function getProjectStatistics(Project $project, ?DateTimeInterface $begin = null, ?DateTimeInterface $end = null): ProjectStatistic
|
||||
{
|
||||
$statistics = $this->getBudgetStatistic([$project], $begin, $end);
|
||||
$event = new ProjectStatisticEvent($project, array_pop($statistics), $begin, $end);
|
||||
@@ -71,14 +67,13 @@ class ProjectStatisticService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProjectInactiveQuery $query
|
||||
* @return Project[]
|
||||
*/
|
||||
public function findInactiveProjects(ProjectInactiveQuery $query): array
|
||||
{
|
||||
$user = $query->getUser();
|
||||
$lastChange = clone $query->getLastChange();
|
||||
$now = new DateTime('now', $lastChange->getTimezone());
|
||||
$lastChange = DateTimeImmutable::createFromInterface($query->getLastChange());
|
||||
$now = new DateTimeImmutable('now', $lastChange->getTimezone());
|
||||
|
||||
$qb2 = $this->projectRepository->createQueryBuilder('t1');
|
||||
$qb2
|
||||
@@ -101,15 +96,15 @@ class ProjectStatisticService
|
||||
$qb->expr()->lte('p.start', ':project_start')
|
||||
)
|
||||
)
|
||||
->setParameter('project_start', $now, Types::DATETIME_MUTABLE)
|
||||
->setParameter('project_start', $now, Types::DATETIME_IMMUTABLE)
|
||||
->andWhere(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull('p.end'),
|
||||
$qb->expr()->gte('p.end', ':project_end')
|
||||
)
|
||||
)
|
||||
->setParameter('project_end', $now, Types::DATETIME_MUTABLE)
|
||||
->setParameter('begin', $lastChange, Types::DATETIME_MUTABLE)
|
||||
->setParameter('project_end', $now, Types::DATETIME_IMMUTABLE)
|
||||
->setParameter('begin', $lastChange, Types::DATETIME_IMMUTABLE)
|
||||
;
|
||||
|
||||
$this->projectRepository->addPermissionCriteria($qb, $user);
|
||||
@@ -125,7 +120,6 @@ class ProjectStatisticService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProjectDateRangeQuery $query
|
||||
* @return Project[]
|
||||
*/
|
||||
public function findProjectsForDateRange(ProjectDateRangeQuery $query, DateRange $dateRange): array
|
||||
@@ -208,7 +202,7 @@ class ProjectStatisticService
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public function getBudgetStatisticModel(Project $project, DateTime $today): ProjectBudgetStatisticModel
|
||||
public function getBudgetStatisticModel(Project $project, DateTimeInterface $today): ProjectBudgetStatisticModel
|
||||
{
|
||||
$stats = new ProjectBudgetStatisticModel($project);
|
||||
$stats->setStatisticTotal($this->getProjectStatistics($project));
|
||||
@@ -229,10 +223,9 @@ class ProjectStatisticService
|
||||
|
||||
/**
|
||||
* @param Project[] $projects
|
||||
* @param DateTime $today
|
||||
* @return ProjectBudgetStatisticModel[]
|
||||
*/
|
||||
public function getBudgetStatisticModelForProjects(array $projects, DateTime $today): array
|
||||
public function getBudgetStatisticModelForProjects(array $projects, DateTimeInterface $today): array
|
||||
{
|
||||
$models = [];
|
||||
$monthly = [];
|
||||
@@ -282,12 +275,9 @@ class ProjectStatisticService
|
||||
|
||||
/**
|
||||
* @param Project[] $projects
|
||||
* @param DateTime $begin
|
||||
* @param DateTime $end
|
||||
* @param DateTime|null $totalsEnd
|
||||
* @return ProjectBudgetStatisticModel[]
|
||||
*/
|
||||
public function getBudgetStatisticModelForProjectsByDateRange(array $projects, DateTime $begin, DateTime $end, ?DateTime $totalsEnd = null): array
|
||||
public function getBudgetStatisticModelForProjectsByDateRange(array $projects, DateTimeInterface $begin, DateTimeInterface $end, ?DateTimeInterface $totalsEnd = null): array
|
||||
{
|
||||
$models = [];
|
||||
|
||||
@@ -313,11 +303,9 @@ class ProjectStatisticService
|
||||
|
||||
/**
|
||||
* @param Project[] $projects
|
||||
* @param DateTime|null $begin
|
||||
* @param DateTime|null $end
|
||||
* @return array<int, ProjectStatistic>
|
||||
*/
|
||||
public function getBudgetStatistic(array $projects, ?DateTime $begin = null, ?DateTime $end = null): array
|
||||
public function getBudgetStatistic(array $projects, ?DateTimeInterface $begin = null, ?DateTimeInterface $end = null): array
|
||||
{
|
||||
$statistics = [];
|
||||
foreach ($projects as $project) {
|
||||
@@ -711,15 +699,13 @@ class ProjectStatisticService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param Project[] $projects
|
||||
* @param DateTime $today
|
||||
* @return ProjectViewModel[]
|
||||
*/
|
||||
public function getProjectView(User $user, array $projects, DateTime $today): array
|
||||
public function getProjectView(User $user, array $projects, DateTimeInterface $today): array
|
||||
{
|
||||
$factory = DateTimeFactory::createByUser($user);
|
||||
$today = clone $today;
|
||||
$today = DateTimeImmutable::createFromInterface($today);
|
||||
|
||||
$startOfWeek = $factory->getStartOfWeek($today);
|
||||
$endOfWeek = $factory->getEndOfWeek($today);
|
||||
|
||||
Reference in New Issue
Block a user