Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)

This commit is contained in:
Kevin Papst
2022-12-31 21:19:55 +01:00
committed by GitHub
parent 95e06746bd
commit 90a0fd8a22
2164 changed files with 83700 additions and 86426 deletions

View File

@@ -14,38 +14,32 @@ use App\Export\Spreadsheet\Writer\BinaryFileResponseWriter;
use App\Export\Spreadsheet\Writer\XlsxWriter;
use App\Reporting\CustomerMonthlyProjects\CustomerMonthlyProjects;
use App\Reporting\CustomerMonthlyProjects\CustomerMonthlyProjectsForm;
use App\Reporting\CustomerMonthlyProjects\CustomerMonthlyProjectsRepository;
use App\Repository\Query\UserQuery;
use App\Repository\UserRepository;
use App\Timesheet\TimesheetStatisticService;
use PhpOffice\PhpSpreadsheet\Reader\Html;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route(path="/reporting/customer/monthly_projects")
* @Security("is_granted('view_reporting') and is_granted('view_other_reporting') and is_granted('view_other_timesheet')")
*/
#[Route(path: '/reporting/customer/monthly_projects')]
#[Security("is_granted('report:customer') and is_granted('report:other')")]
final class CustomerMonthlyProjectsController extends AbstractController
{
/**
* @Route(path="/view", name="report_customer_monthly_projects", methods={"GET","POST"})
*/
public function report(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
#[Route(path: '/view', name: 'report_customer_monthly_projects', methods: ['GET', 'POST'])]
public function report(Request $request, CustomerMonthlyProjectsRepository $repository, UserRepository $userRepository): Response
{
return $this->render(
'reporting/customer/monthly_projects.html.twig',
$this->getData($request, $statisticService, $userRepository)
$this->getData($request, $repository, $userRepository)
);
}
/**
* @Route(path="/export", name="report_customer_monthly_projects_export", methods={"GET","POST"})
*/
public function export(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
#[Route(path: '/export', name: 'report_customer_monthly_projects_export', methods: ['GET', 'POST'])]
public function export(Request $request, CustomerMonthlyProjectsRepository $repository, UserRepository $userRepository): Response
{
$data = $this->getData($request, $statisticService, $userRepository);
$data = $this->getData($request, $repository, $userRepository);
$content = $this->render('reporting/customer/monthly_projects_export.html.twig', $data)->getContent();
@@ -57,12 +51,13 @@ final class CustomerMonthlyProjectsController extends AbstractController
return $writer->getFileResponse($spreadsheet);
}
private function getData(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): array
private function getData(Request $request, CustomerMonthlyProjectsRepository $repository, UserRepository $userRepository): array
{
$currentUser = $this->getUser();
$dateTimeFactory = $this->getDateTimeFactory();
$query = new UserQuery();
$query->setSystemAccount(false);
$query->setCurrentUser($currentUser);
$allUsers = $userRepository->getUsersForQuery($query);
@@ -94,7 +89,7 @@ final class CustomerMonthlyProjectsController extends AbstractController
$next = clone $start;
$next->modify('+1 month');
$stats = $statisticService->getGroupedByCustomerProjectActivityUser($start, $end, $allUsers);
$stats = $repository->getGroupedByCustomerProjectActivityUser($start, $end, $allUsers, $values->getCustomer());
return [
'dataType' => $values->getSumType(),