Release 2.0.28 (#4172)

See https://github.com/kimai/kimai/pull/4172
This commit is contained in:
Kevin Papst
2023-07-09 15:27:27 +02:00
committed by GitHub
parent 651f812da8
commit 385753fbc3
27 changed files with 182 additions and 53 deletions

View File

@@ -33,6 +33,7 @@ final class ContractController extends AbstractController
$dateTimeFactory = $this->getDateTimeFactory($currentUser);
$canChangeUser = $this->isGranted('contract_other_profile');
$defaultDate = $dateTimeFactory->createStartOfYear();
$now = $dateTimeFactory->createDateTime();
$values = new YearByUser();
$values->setUser($currentUser);
@@ -62,7 +63,7 @@ final class ContractController extends AbstractController
/** @var \DateTime $yearDate */
$yearDate = $values->getDate();
$year = $workingTimeService->getYear($profile, $yearDate);
$year = $workingTimeService->getYear($profile, $yearDate, $now);
$page = new PageSetup('work_times');
$page->setHelp('contract.html');
@@ -73,7 +74,6 @@ final class ContractController extends AbstractController
$controllerEvent = new WorkContractDetailControllerEvent($year);
$eventDispatcher->dispatch($controllerEvent);
$now = $dateTimeFactory->createDateTime();
$summary = $workingTimeService->getYearSummary($year, $now);
$boxConfiguration = new BoxConfiguration();

View File

@@ -12,6 +12,7 @@ namespace App\Controller;
use App\Configuration\LocaleService;
use App\Entity\User;
use App\Event\ConfigureMainMenuEvent;
use App\Repository\UserRepository;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -28,7 +29,7 @@ final class HomepageController extends AbstractController
public const DEFAULT_ROUTE = 'timesheet';
#[Route(path: '', defaults: [], name: 'homepage', methods: ['GET'])]
public function indexAction(Request $request, LocaleService $service, EventDispatcherInterface $eventDispatcher): Response
public function homepage(Request $request, LocaleService $service, EventDispatcherInterface $eventDispatcher, UserRepository $userRepository): Response
{
$user = $this->getUser();
$userLanguage = $user->getLanguage();
@@ -72,8 +73,13 @@ final class HomepageController extends AbstractController
try {
return $this->redirectToRoute($route, ['_locale' => $language]);
} catch (\Exception $ex) {
$this->logException($ex);
// something is wrong with the url parameters ...
if ($route === $userRoute) {
// fix invalid routes from old plugins / versions
$user->setPreferenceValue('login_initial_view', 'dashboard');
$userRepository->saveUser($user);
} else {
$this->logException($ex);
}
}
}

View File

@@ -60,9 +60,12 @@ final class ProfileController extends AbstractController
{
$dateFactory = $this->getDateTimeFactory();
$userStats = $repository->getUserStatistics($profile);
$firstEntry = $statisticService->findFirstRecordDate($profile);
$workStartingDay = $profile->getWorkStartingDay();
if ($workStartingDay === null) {
$workStartingDay = $statisticService->findFirstRecordDate($profile);
}
$begin = $firstEntry ?? $dateFactory->getStartOfMonth();
$begin = $workStartingDay ?? $dateFactory->getStartOfMonth();
$end = $dateFactory->getEndOfMonth();
// statistic service does not fill up the complete year by default!
@@ -73,7 +76,7 @@ final class ProfileController extends AbstractController
'tab' => 'charts',
'user' => $profile,
'stats' => $userStats,
'firstTimesheet' => $firstEntry,
'workingSince' => $workStartingDay,
'workMonths' => $statisticService->getMonthlyStats($begin, $end, [$profile])[0]
];