Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -21,15 +21,8 @@ use DateTime;
|
||||
|
||||
abstract class AbstractUserReportController extends AbstractController
|
||||
{
|
||||
protected $statisticService;
|
||||
private $projectRepository;
|
||||
private $activityRepository;
|
||||
|
||||
public function __construct(TimesheetStatisticService $statisticService, ProjectRepository $projectRepository, ActivityRepository $activityRepository)
|
||||
public function __construct(protected TimesheetStatisticService $statisticService, private ProjectRepository $projectRepository, private ActivityRepository $activityRepository)
|
||||
{
|
||||
$this->statisticService = $statisticService;
|
||||
$this->projectRepository = $projectRepository;
|
||||
$this->activityRepository = $activityRepository;
|
||||
}
|
||||
|
||||
protected function canSelectUser(): bool
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -20,20 +20,18 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class ProjectDateRangeController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/reporting/project_daterange", name="report_project_daterange", methods={"GET","POST"})
|
||||
* @Security("is_granted('view_reporting') and is_granted('budget_any', 'project')")
|
||||
*/
|
||||
#[Route(path: '/reporting/project_daterange', name: 'report_project_daterange', methods: ['GET', 'POST'])]
|
||||
#[Security("is_granted('report:project') and is_granted('budget_any', 'project')")]
|
||||
public function __invoke(Request $request, ProjectStatisticService $service)
|
||||
{
|
||||
$dateFactory = $this->getDateTimeFactory();
|
||||
$user = $this->getUser();
|
||||
|
||||
$query = new ProjectDaterangeQuery($dateFactory->getStartOfMonth(), $user);
|
||||
$form = $this->createForm(ProjectDateRangeForm::class, $query, [
|
||||
$form = $this->createFormForGetRequest(ProjectDateRangeForm::class, $query, [
|
||||
'timezone' => $user->getTimezone()
|
||||
]);
|
||||
$form->handleRequest($request);
|
||||
$form->submit($request->query->all(), false);
|
||||
|
||||
$dateRange = new DateRange(true);
|
||||
$dateRange->setBegin($query->getMonth());
|
||||
@@ -52,6 +50,7 @@ final class ProjectDateRangeController extends AbstractController
|
||||
}
|
||||
|
||||
return $this->render('reporting/project_daterange.html.twig', [
|
||||
'report_title' => 'report_project_daterange',
|
||||
'entries' => $byCustomer,
|
||||
'form' => $form->createView(),
|
||||
'queryEnd' => $dateRange->getEnd(),
|
||||
|
||||
@@ -10,40 +10,50 @@
|
||||
namespace App\Controller\Reporting;
|
||||
|
||||
use App\Controller\AbstractController;
|
||||
use App\Entity\Project;
|
||||
use App\Project\ProjectStatisticService;
|
||||
use App\Reporting\ProjectDetails\ProjectDetailsForm;
|
||||
use App\Reporting\ProjectDetails\ProjectDetailsQuery;
|
||||
use App\Utils\PageSetup;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class ProjectDetailsController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/reporting/project_details", name="report_project_details", methods={"GET"})
|
||||
* @Security("is_granted('view_reporting') and is_granted('details', 'project')")
|
||||
*/
|
||||
#[Route(path: '/reporting/project_details', name: 'report_project_details', methods: ['GET'])]
|
||||
#[Security("is_granted('report:project') and is_granted('details', 'project')")]
|
||||
public function __invoke(Request $request, ProjectStatisticService $service)
|
||||
{
|
||||
$dateFactory = $this->getDateTimeFactory();
|
||||
$user = $this->getUser();
|
||||
|
||||
$query = new ProjectDetailsQuery($dateFactory->createDateTime(), $user);
|
||||
$form = $this->createForm(ProjectDetailsForm::class, $query);
|
||||
$form = $this->createFormForGetRequest(ProjectDetailsForm::class, $query);
|
||||
$form->submit($request->query->all(), false);
|
||||
|
||||
$projectView = null;
|
||||
$projectDetails = null;
|
||||
$project = $query->getProject();
|
||||
|
||||
if ($query->getProject() !== null && $this->isGranted('details', $query->getProject())) {
|
||||
$projectViews = $service->getProjectView($user, [$query->getProject()], $query->getToday());
|
||||
if ($project !== null && $this->isGranted('details', $project)) {
|
||||
$projectViews = $service->getProjectView($user, [$project], $query->getToday());
|
||||
$projectView = $projectViews[0];
|
||||
$projectDetails = $service->getProjectsDetails($query);
|
||||
}
|
||||
|
||||
$page = new PageSetup('projects');
|
||||
$page->setHelp('project.html');
|
||||
|
||||
if ($project !== null) {
|
||||
$page->setActionName('project');
|
||||
$page->setActionView('project_details_report');
|
||||
$page->setActionPayload(['project' => $project]);
|
||||
}
|
||||
|
||||
return $this->render('reporting/project_details.html.twig', [
|
||||
'project' => $query->getProject(),
|
||||
'page_setup' => $page,
|
||||
'report_title' => 'report_project_details',
|
||||
'project' => $project,
|
||||
'project_view' => $projectView,
|
||||
'project_details' => $projectDetails,
|
||||
'form' => $form->createView(),
|
||||
|
||||
@@ -19,10 +19,8 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class ProjectInactiveController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/reporting/project_inactive", name="report_project_inactive", methods={"GET","POST"})
|
||||
* @Security("is_granted('view_reporting') and is_granted('budget_any', 'project')")
|
||||
*/
|
||||
#[Route(path: '/reporting/project_inactive', name: 'report_project_inactive', methods: ['GET', 'POST'])]
|
||||
#[Security("is_granted('report:project') and is_granted('budget_any', 'project')")]
|
||||
public function __invoke(Request $request, ProjectStatisticService $service)
|
||||
{
|
||||
$dateFactory = $this->getDateTimeFactory();
|
||||
@@ -30,7 +28,7 @@ final class ProjectInactiveController extends AbstractController
|
||||
$now = $dateFactory->createDateTime();
|
||||
|
||||
$query = new ProjectInactiveQuery($dateFactory->createDateTime('-1 year'), $user);
|
||||
$form = $this->createForm(ProjectInactiveForm::class, $query, [
|
||||
$form = $this->createFormForGetRequest(ProjectInactiveForm::class, $query, [
|
||||
'timezone' => $user->getTimezone()
|
||||
]);
|
||||
$form->submit($request->query->all(), false);
|
||||
@@ -47,10 +45,10 @@ final class ProjectInactiveController extends AbstractController
|
||||
$byCustomer[$customer->getId()]['projects'][] = $entry;
|
||||
}
|
||||
|
||||
return $this->render('reporting/project_view.html.twig', [
|
||||
return $this->render('reporting/project_inactive.html.twig', [
|
||||
'entries' => $byCustomer,
|
||||
'form' => $form->createView(),
|
||||
'title' => 'report_inactive_project',
|
||||
'report_title' => 'report_inactive_project',
|
||||
'tableName' => 'inactive_project_reporting',
|
||||
'now' => $now,
|
||||
'skipColumns' => ['today', 'week', 'month', 'projectStart', 'projectEnd', 'comment'],
|
||||
|
||||
@@ -19,17 +19,15 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class ProjectViewController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/reporting/project_view", name="report_project_view", methods={"GET","POST"})
|
||||
* @Security("is_granted('view_reporting') and is_granted('budget_any', 'project')")
|
||||
*/
|
||||
#[Route(path: '/reporting/project_view', name: 'report_project_view', methods: ['GET', 'POST'])]
|
||||
#[Security("is_granted('report:project') and is_granted('budget_any', 'project')")]
|
||||
public function __invoke(Request $request, ProjectStatisticService $service)
|
||||
{
|
||||
$dateFactory = $this->getDateTimeFactory();
|
||||
$user = $this->getUser();
|
||||
|
||||
$query = new ProjectViewQuery($dateFactory->createDateTime(), $user);
|
||||
$form = $this->createForm(ProjectViewForm::class, $query);
|
||||
$form = $this->createFormForGetRequest(ProjectViewForm::class, $query);
|
||||
$form->submit($request->query->all(), false);
|
||||
|
||||
$projects = $service->findProjectsForView($query);
|
||||
@@ -47,7 +45,7 @@ final class ProjectViewController extends AbstractController
|
||||
return $this->render('reporting/project_view.html.twig', [
|
||||
'entries' => $byCustomer,
|
||||
'form' => $form->createView(),
|
||||
'title' => 'report_project_view',
|
||||
'report_title' => 'report_project_view',
|
||||
'tableName' => 'project_view_reporting',
|
||||
'now' => $dateFactory->createDateTime(),
|
||||
]);
|
||||
|
||||
@@ -13,8 +13,8 @@ use App\Controller\AbstractController;
|
||||
use App\Export\Spreadsheet\Writer\BinaryFileResponseWriter;
|
||||
use App\Export\Spreadsheet\Writer\XlsxWriter;
|
||||
use App\Model\DailyStatistic;
|
||||
use App\Reporting\MonthlyUserList;
|
||||
use App\Reporting\MonthlyUserListForm;
|
||||
use App\Reporting\MonthlyUserList\MonthlyUserList;
|
||||
use App\Reporting\MonthlyUserList\MonthlyUserListForm;
|
||||
use App\Repository\Query\UserQuery;
|
||||
use App\Repository\UserRepository;
|
||||
use App\Timesheet\TimesheetStatisticService;
|
||||
@@ -24,15 +24,11 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
/**
|
||||
* @Route(path="/reporting/users")
|
||||
* @Security("is_granted('view_reporting') and is_granted('view_other_reporting') and is_granted('view_other_timesheet')")
|
||||
*/
|
||||
#[Route(path: '/reporting/users')]
|
||||
#[Security("is_granted('report:other')")]
|
||||
final class ReportUsersMonthController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/month", name="report_monthly_users", methods={"GET","POST"})
|
||||
*/
|
||||
#[Route(path: '/month', name: 'report_monthly_users', methods: ['GET', 'POST'])]
|
||||
public function report(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
|
||||
{
|
||||
return $this->render(
|
||||
@@ -41,9 +37,7 @@ final class ReportUsersMonthController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/month_export", name="report_monthly_users_export", methods={"GET","POST"})
|
||||
*/
|
||||
#[Route(path: '/month_export', name: 'report_monthly_users_export', methods: ['GET', 'POST'])]
|
||||
public function export(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
|
||||
{
|
||||
$data = $this->getData($request, $statisticService, $userRepository);
|
||||
@@ -66,7 +60,7 @@ final class ReportUsersMonthController extends AbstractController
|
||||
$values = new MonthlyUserList();
|
||||
$values->setDate($dateTimeFactory->getStartOfMonth());
|
||||
|
||||
$form = $this->createForm(MonthlyUserListForm::class, $values, [
|
||||
$form = $this->createFormForGetRequest(MonthlyUserListForm::class, $values, [
|
||||
'timezone' => $dateTimeFactory->getTimezone()->getName(),
|
||||
'start_date' => $values->getDate(),
|
||||
]);
|
||||
@@ -74,6 +68,7 @@ final class ReportUsersMonthController extends AbstractController
|
||||
$form->submit($request->query->all(), false);
|
||||
|
||||
$query = new UserQuery();
|
||||
$query->setSystemAccount(false);
|
||||
$query->setCurrentUser($currentUser);
|
||||
|
||||
if ($form->isSubmitted()) {
|
||||
|
||||
@@ -13,8 +13,8 @@ use App\Controller\AbstractController;
|
||||
use App\Export\Spreadsheet\Writer\BinaryFileResponseWriter;
|
||||
use App\Export\Spreadsheet\Writer\XlsxWriter;
|
||||
use App\Model\DailyStatistic;
|
||||
use App\Reporting\WeeklyUserList;
|
||||
use App\Reporting\WeeklyUserListForm;
|
||||
use App\Reporting\WeeklyUserList\WeeklyUserList;
|
||||
use App\Reporting\WeeklyUserList\WeeklyUserListForm;
|
||||
use App\Repository\Query\UserQuery;
|
||||
use App\Repository\UserRepository;
|
||||
use App\Timesheet\TimesheetStatisticService;
|
||||
@@ -24,15 +24,11 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
/**
|
||||
* @Route(path="/reporting/users")
|
||||
* @Security("is_granted('view_reporting') and is_granted('view_other_reporting') and is_granted('view_other_timesheet')")
|
||||
*/
|
||||
#[Route(path: '/reporting/users')]
|
||||
#[Security("is_granted('report:other')")]
|
||||
final class ReportUsersWeekController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/week", name="report_weekly_users", methods={"GET","POST"})
|
||||
*/
|
||||
#[Route(path: '/week', name: 'report_weekly_users', methods: ['GET', 'POST'])]
|
||||
public function report(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
|
||||
{
|
||||
return $this->render(
|
||||
@@ -41,9 +37,7 @@ final class ReportUsersWeekController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/week_export", name="report_weekly_users_export", methods={"GET","POST"})
|
||||
*/
|
||||
#[Route(path: '/week_export', name: 'report_weekly_users_export', methods: ['GET', 'POST'])]
|
||||
public function export(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
|
||||
{
|
||||
$data = $this->getData($request, $statisticService, $userRepository);
|
||||
@@ -66,7 +60,7 @@ final class ReportUsersWeekController extends AbstractController
|
||||
$values = new WeeklyUserList();
|
||||
$values->setDate($dateTimeFactory->getStartOfWeek());
|
||||
|
||||
$form = $this->createForm(WeeklyUserListForm::class, $values, [
|
||||
$form = $this->createFormForGetRequest(WeeklyUserListForm::class, $values, [
|
||||
'timezone' => $dateTimeFactory->getTimezone()->getName(),
|
||||
'start_date' => $values->getDate(),
|
||||
]);
|
||||
@@ -74,6 +68,7 @@ final class ReportUsersWeekController extends AbstractController
|
||||
$form->submit($request->query->all(), false);
|
||||
|
||||
$query = new UserQuery();
|
||||
$query->setSystemAccount(false);
|
||||
$query->setCurrentUser($currentUser);
|
||||
|
||||
if ($form->isSubmitted()) {
|
||||
|
||||
@@ -14,8 +14,8 @@ use App\Controller\AbstractController;
|
||||
use App\Export\Spreadsheet\Writer\BinaryFileResponseWriter;
|
||||
use App\Export\Spreadsheet\Writer\XlsxWriter;
|
||||
use App\Model\MonthlyStatistic;
|
||||
use App\Reporting\YearlyUserList;
|
||||
use App\Reporting\YearlyUserListForm;
|
||||
use App\Reporting\YearlyUserList\YearlyUserList;
|
||||
use App\Reporting\YearlyUserList\YearlyUserListForm;
|
||||
use App\Repository\Query\UserQuery;
|
||||
use App\Repository\UserRepository;
|
||||
use App\Timesheet\TimesheetStatisticService;
|
||||
@@ -26,19 +26,16 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
/**
|
||||
* @Route(path="/reporting/users")
|
||||
* @Security("is_granted('view_reporting') and is_granted('view_other_reporting') and is_granted('view_other_timesheet')")
|
||||
*/
|
||||
#[Route(path: '/reporting/users')]
|
||||
#[Security("is_granted('report:other')")]
|
||||
final class ReportUsersYearController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/year", name="report_yearly_users", methods={"GET","POST"})
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Route(path: '/year', name: 'report_yearly_users', methods: ['GET', 'POST'])]
|
||||
public function report(Request $request, SystemConfiguration $systemConfiguration, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
|
||||
{
|
||||
return $this->render(
|
||||
@@ -48,12 +45,11 @@ final class ReportUsersYearController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/year_export", name="report_yearly_users_export", methods={"GET","POST"})
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Route(path: '/year_export', name: 'report_yearly_users_export', methods: ['GET', 'POST'])]
|
||||
public function export(Request $request, SystemConfiguration $systemConfiguration, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
|
||||
{
|
||||
$data = $this->getData($request, $systemConfiguration, $statisticService, $userRepository);
|
||||
@@ -82,7 +78,7 @@ final class ReportUsersYearController extends AbstractController
|
||||
$values = new YearlyUserList();
|
||||
$values->setDate(clone $defaultDate);
|
||||
|
||||
$form = $this->createForm(YearlyUserListForm::class, $values, [
|
||||
$form = $this->createFormForGetRequest(YearlyUserListForm::class, $values, [
|
||||
'timezone' => $dateTimeFactory->getTimezone()->getName(),
|
||||
'start_date' => $values->getDate(),
|
||||
]);
|
||||
@@ -90,6 +86,7 @@ final class ReportUsersYearController extends AbstractController
|
||||
$form->submit($request->query->all(), false);
|
||||
|
||||
$query = new UserQuery();
|
||||
$query->setSystemAccount(false);
|
||||
$query->setCurrentUser($currentUser);
|
||||
|
||||
if ($form->isSubmitted()) {
|
||||
@@ -126,7 +123,7 @@ final class ReportUsersYearController extends AbstractController
|
||||
}
|
||||
|
||||
return [
|
||||
'query' => $values,
|
||||
'subReportDate' => $values->getDate(),
|
||||
'period_attribute' => 'months',
|
||||
'dataType' => $values->getSumType(),
|
||||
'report_title' => 'report_yearly_users',
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
|
||||
namespace App\Controller\Reporting;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Model\DailyStatistic;
|
||||
use App\Reporting\MonthByUser;
|
||||
use App\Reporting\MonthByUserForm;
|
||||
use App\Reporting\MonthByUser\MonthByUser;
|
||||
use App\Reporting\MonthByUser\MonthByUserForm;
|
||||
use Exception;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -20,19 +19,16 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
|
||||
/**
|
||||
* @Route(path="/reporting/user")
|
||||
* @Security("is_granted('view_reporting')")
|
||||
*/
|
||||
#[Route(path: '/reporting/user')]
|
||||
#[Security("is_granted('report:user')")]
|
||||
final class UserMonthController extends AbstractUserReportController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/month", name="report_user_month", methods={"GET","POST"})
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Route(path: '/month', name: 'report_user_month', methods: ['GET', 'POST'])]
|
||||
public function monthByUser(Request $request): Response
|
||||
{
|
||||
return $this->render('reporting/report_by_user.html.twig', $this->getData($request));
|
||||
@@ -48,7 +44,7 @@ final class UserMonthController extends AbstractUserReportController
|
||||
$values->setUser($currentUser);
|
||||
$values->setDate($dateTimeFactory->getStartOfMonth());
|
||||
|
||||
$form = $this->createForm(MonthByUserForm::class, $values, [
|
||||
$form = $this->createFormForGetRequest(MonthByUserForm::class, $values, [
|
||||
'include_user' => $canChangeUser,
|
||||
'timezone' => $dateTimeFactory->getTimezone()->getName(),
|
||||
'start_date' => $values->getDate(),
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
|
||||
namespace App\Controller\Reporting;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Model\DailyStatistic;
|
||||
use App\Reporting\WeekByUser;
|
||||
use App\Reporting\WeekByUserForm;
|
||||
use App\Reporting\WeekByUser\WeekByUser;
|
||||
use App\Reporting\WeekByUser\WeekByUserForm;
|
||||
use Exception;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -20,19 +19,16 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
|
||||
/**
|
||||
* @Route(path="/reporting/user")
|
||||
* @Security("is_granted('view_reporting')")
|
||||
*/
|
||||
#[Route(path: '/reporting/user')]
|
||||
#[Security("is_granted('report:user')")]
|
||||
final class UserWeekController extends AbstractUserReportController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/week", name="report_user_week", methods={"GET","POST"})
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Route(path: '/week', name: 'report_user_week', methods: ['GET', 'POST'])]
|
||||
public function weekByUser(Request $request): Response
|
||||
{
|
||||
return $this->render('reporting/report_by_user.html.twig', $this->getData($request));
|
||||
@@ -48,7 +44,7 @@ final class UserWeekController extends AbstractUserReportController
|
||||
$values->setUser($currentUser);
|
||||
$values->setDate($dateTimeFactory->getStartOfWeek());
|
||||
|
||||
$form = $this->createForm(WeekByUserForm::class, $values, [
|
||||
$form = $this->createFormForGetRequest(WeekByUserForm::class, $values, [
|
||||
'include_user' => $canChangeUser,
|
||||
'timezone' => $dateTimeFactory->getTimezone()->getName(),
|
||||
'start_date' => $values->getDate(),
|
||||
|
||||
@@ -13,8 +13,8 @@ use App\Configuration\SystemConfiguration;
|
||||
use App\Entity\User;
|
||||
use App\Model\DateStatisticInterface;
|
||||
use App\Model\MonthlyStatistic;
|
||||
use App\Reporting\YearByUser;
|
||||
use App\Reporting\YearByUserForm;
|
||||
use App\Reporting\YearByUser\YearByUser;
|
||||
use App\Reporting\YearByUser\YearByUserForm;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
@@ -23,19 +23,16 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
|
||||
/**
|
||||
* @Route(path="/reporting/user")
|
||||
* @Security("is_granted('view_reporting')")
|
||||
*/
|
||||
#[Route(path: '/reporting/user')]
|
||||
#[Security("is_granted('report:user')")]
|
||||
final class UserYearController extends AbstractUserReportController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/year", name="report_user_year", methods={"GET","POST"})
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Route(path: '/year', name: 'report_user_year', methods: ['GET', 'POST'])]
|
||||
public function yearByUser(Request $request, SystemConfiguration $systemConfiguration): Response
|
||||
{
|
||||
return $this->render('reporting/report_by_user_year.html.twig', $this->getData($request, $systemConfiguration));
|
||||
@@ -58,7 +55,7 @@ final class UserYearController extends AbstractUserReportController
|
||||
|
||||
$values->setDate(clone $defaultDate);
|
||||
|
||||
$form = $this->createForm(YearByUserForm::class, $values, [
|
||||
$form = $this->createFormForGetRequest(YearByUserForm::class, $values, [
|
||||
'include_user' => $canChangeUser,
|
||||
'timezone' => $dateTimeFactory->getTimezone()->getName(),
|
||||
'start_date' => $values->getDate(),
|
||||
|
||||
Reference in New Issue
Block a user