Release 2.19 (#4922)
This commit is contained in:
@@ -90,7 +90,6 @@ final class ContractController extends AbstractController
|
||||
'boxes' => $controllerEvent->getController(),
|
||||
'year' => $year,
|
||||
'user' => $profile,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ namespace App\Controller;
|
||||
|
||||
use App\Configuration\SystemConfiguration;
|
||||
use App\Form\QuickEntryForm;
|
||||
use App\Form\WeekByUserForm;
|
||||
use App\Model\QuickEntryWeek;
|
||||
use App\Reporting\WeekByUser\WeekByUser;
|
||||
use App\Repository\Query\TimesheetQuery;
|
||||
use App\Repository\TimesheetRepository;
|
||||
use App\Timesheet\FavoriteRecordService;
|
||||
@@ -25,7 +27,6 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
/**
|
||||
* Controller used to enter times in weekly form.
|
||||
*/
|
||||
#[Route(path: '/quick_entry')]
|
||||
#[IsGranted('quick-entry')]
|
||||
final class QuickEntryController extends AbstractController
|
||||
{
|
||||
@@ -38,18 +39,30 @@ final class QuickEntryController extends AbstractController
|
||||
{
|
||||
}
|
||||
|
||||
#[Route(path: '/{begin}', name: 'quick_entry', methods: ['GET', 'POST'])]
|
||||
public function quickEntry(Request $request, ?string $begin = null): Response
|
||||
#[Route(path: '/quick_entry/', name: 'quick_entry', methods: ['GET', 'POST'])]
|
||||
public function quickEntry(Request $request): Response
|
||||
{
|
||||
$factory = $this->getDateTimeFactory();
|
||||
$user = $this->getUser();
|
||||
$factory = $this->getDateTimeFactory($user);
|
||||
$defaultDate = $factory->createDateTime();
|
||||
|
||||
if ($begin !== null) {
|
||||
try {
|
||||
$begin = $factory->createDateTime($begin);
|
||||
} catch (\Exception $ex) {
|
||||
$begin = null;
|
||||
}
|
||||
}
|
||||
$values = new WeekByUser();
|
||||
$values->setUser($user);
|
||||
$values->setDate($defaultDate);
|
||||
|
||||
$weeklyForm = $this->createFormForGetRequest(WeekByUserForm::class, $values, [
|
||||
'include_user' => $this->isGranted('view_other_timesheet'),
|
||||
'timezone' => $factory->getTimezone()->getName(),
|
||||
'start_date' => $values->getDate(),
|
||||
'attr' => ['name' => 'quick_entry_weekrange_form']
|
||||
]);
|
||||
|
||||
$weeklyForm->submit($request->query->all(), false);
|
||||
|
||||
$user = $values->getUser() ?? $user;
|
||||
$factory = $this->getDateTimeFactory($user);
|
||||
|
||||
$begin = $values->getDate();
|
||||
|
||||
if ($begin === null) {
|
||||
$begin = $factory->createDateTime();
|
||||
@@ -57,7 +70,6 @@ final class QuickEntryController extends AbstractController
|
||||
|
||||
$startWeek = $factory->getStartOfWeek($begin);
|
||||
$endWeek = $factory->getEndOfWeek($begin);
|
||||
$user = $this->getUser();
|
||||
|
||||
$tmpDay = clone $startWeek;
|
||||
$week = [];
|
||||
@@ -235,7 +247,7 @@ final class QuickEntryController extends AbstractController
|
||||
if ($saved) {
|
||||
$this->flashSuccess('action.update.success');
|
||||
|
||||
return $this->redirectToRoute('quick_entry', ['begin' => $begin->format('Y-m-d')]);
|
||||
return $this->redirectToRoute('quick_entry', ['date' => $begin->format('Y-m-d'), 'user' => $user->getId()]);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashUpdateException($ex);
|
||||
@@ -244,6 +256,8 @@ final class QuickEntryController extends AbstractController
|
||||
|
||||
$page = new PageSetup('quick_entry.title');
|
||||
$page->setHelp('weekly-times.html');
|
||||
$page->setPaginationForm($weeklyForm);
|
||||
$page->setActionName('weekly-times');
|
||||
|
||||
return $this->render('quick-entry/index.html.twig', [
|
||||
'page_setup' => $page,
|
||||
|
||||
@@ -61,9 +61,11 @@ final class ReportUsersYearController extends AbstractController
|
||||
$dateTimeFactory = $this->getDateTimeFactory();
|
||||
|
||||
$defaultDate = $dateTimeFactory->createStartOfYear();
|
||||
$isFinancialYear = false;
|
||||
|
||||
if (null !== ($financialYear = $systemConfiguration->getFinancialYearStart())) {
|
||||
$defaultDate = $this->getDateTimeFactory()->createStartOfFinancialYear($financialYear);
|
||||
$isFinancialYear = true;
|
||||
}
|
||||
|
||||
$values = new YearlyUserList();
|
||||
@@ -72,6 +74,7 @@ final class ReportUsersYearController extends AbstractController
|
||||
$form = $this->createFormForGetRequest(YearlyUserListForm::class, $values, [
|
||||
'timezone' => $dateTimeFactory->getTimezone()->getName(),
|
||||
'start_date' => $values->getDate(),
|
||||
'show_range' => $isFinancialYear,
|
||||
]);
|
||||
|
||||
$form->submit($request->query->all(), false);
|
||||
|
||||
Reference in New Issue
Block a user