Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -31,18 +31,19 @@ use App\Form\Type\TrackingModeType;
|
||||
use App\Form\Type\WeekDaysType;
|
||||
use App\Form\Type\YesNoType;
|
||||
use App\Repository\ConfigurationRepository;
|
||||
use App\Validator\Constraints\AllowedHtmlTags;
|
||||
use App\Timesheet\LockdownService;
|
||||
use App\Utils\PageSetup;
|
||||
use App\Validator\Constraints\ColorChoices;
|
||||
use App\Validator\Constraints\DateTimeFormat;
|
||||
use App\Validator\Constraints\TimeFormat;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CountryType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
@@ -54,35 +55,16 @@ use Symfony\Component\Validator\Constraints\Regex;
|
||||
|
||||
/**
|
||||
* Controller used for executing system relevant tasks.
|
||||
*
|
||||
* @Route(path="/admin/system-config")
|
||||
* @Security("is_granted('system_configuration')")
|
||||
*/
|
||||
#[Route(path: '/admin/system-config')]
|
||||
#[Security("is_granted('IS_AUTHENTICATED_FULLY') and is_granted('system_configuration')")]
|
||||
final class SystemConfigurationController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
private $eventDispatcher;
|
||||
/**
|
||||
* @var SystemConfiguration
|
||||
*/
|
||||
private $configurations;
|
||||
/**
|
||||
* @var ConfigurationRepository
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ConfigurationRepository $repository, SystemConfiguration $config)
|
||||
public function __construct(private EventDispatcherInterface $eventDispatcher, private ConfigurationRepository $repository, private SystemConfiguration $systemConfiguration, private LockdownService $lockdownService)
|
||||
{
|
||||
$this->eventDispatcher = $dispatcher;
|
||||
$this->repository = $repository;
|
||||
$this->configurations = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/", name="system_configuration", methods={"GET"})
|
||||
*/
|
||||
#[Route(path: '/', name: 'system_configuration', methods: ['GET'])]
|
||||
public function indexAction(): Response
|
||||
{
|
||||
$configSettings = $this->getInitializedConfigurations();
|
||||
@@ -95,14 +77,16 @@ final class SystemConfigurationController extends AbstractController
|
||||
];
|
||||
}
|
||||
|
||||
$page = new PageSetup('menu.system_configuration');
|
||||
$page->setHelp('configurations.html');
|
||||
|
||||
return $this->render('system-configuration/index.html.twig', [
|
||||
'page_setup' => $page,
|
||||
'sections' => $configurations,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/edit/{section}", name="system_configuration_section", methods={"GET"})
|
||||
*/
|
||||
#[Route(path: '/edit/{section}', name: 'system_configuration_section', methods: ['GET'])]
|
||||
public function sectionAction(string $section): Response
|
||||
{
|
||||
$configSettings = $this->getInitializedConfigurations();
|
||||
@@ -119,27 +103,31 @@ final class SystemConfigurationController extends AbstractController
|
||||
];
|
||||
}
|
||||
|
||||
return $this->render('system-configuration/index.html.twig', [
|
||||
$page = new PageSetup('menu.system_configuration');
|
||||
$page->setHelp('configurations.html');
|
||||
|
||||
return $this->render('system-configuration/section.html.twig', [
|
||||
'page_setup' => $page,
|
||||
'sections' => $configurations,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/update/{section}/{single}", defaults={"single": "0"}, name="system_configuration_update", methods={"POST"})
|
||||
*
|
||||
* @internal do not link directly to this route
|
||||
* @param Request $request
|
||||
* @param string $section
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
* @return RedirectResponse|Response
|
||||
*/
|
||||
public function configUpdate(Request $request, string $section, string $single)
|
||||
#[Route(path: '/update/{section}/{single}', defaults: ['single' => 0], name: 'system_configuration_update', methods: ['POST'])]
|
||||
public function configUpdate(Request $request, string $section, string $single): Response
|
||||
{
|
||||
$single = (bool) $single;
|
||||
$configModel = null;
|
||||
$configSettings = $this->getInitializedConfigurations();
|
||||
|
||||
foreach ($configSettings as $configModel) {
|
||||
if ($configModel->getSection() === $section) {
|
||||
foreach ($configSettings as $model) {
|
||||
if ($model->getSection() === $section) {
|
||||
$configModel = $model;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -151,40 +139,36 @@ final class SystemConfigurationController extends AbstractController
|
||||
$form = $this->createConfigurationsForm($configModel, $single);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted()) {
|
||||
if ($form->isValid()) {
|
||||
try {
|
||||
$this->repository->saveSystemConfiguration($form->getData());
|
||||
$this->flashSuccess('action.update.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
if ($single) {
|
||||
return $this->redirectToRoute('system_configuration_section', ['section' => $section]);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('system_configuration');
|
||||
} else {
|
||||
$this->flashError('action.update.error', ['%reason%' => 'Validation problem']);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
try {
|
||||
$this->repository->saveSystemConfiguration($form->getData());
|
||||
$this->flashSuccess('action.update.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->handleFormUpdateException($ex, $form);
|
||||
}
|
||||
|
||||
if ($single) {
|
||||
return $this->redirectToRoute('system_configuration_section', ['section' => $section]);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('system_configuration');
|
||||
}
|
||||
|
||||
$configSettings = $this->getInitializedConfigurations();
|
||||
|
||||
$configurations = [];
|
||||
foreach ($configSettings as $configModel) {
|
||||
if ($single && $section !== $configModel->getSection()) {
|
||||
foreach ($configSettings as $model) {
|
||||
if ($single && $section !== $model->getSection()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($section !== $configModel->getSection()) {
|
||||
$form2 = $this->createConfigurationsForm($configModel, $single);
|
||||
if ($section !== $model->getSection()) {
|
||||
$form2 = $this->createConfigurationsForm($model, $single);
|
||||
} else {
|
||||
$form2 = $form;
|
||||
}
|
||||
$configurations[] = [
|
||||
'model' => $configModel,
|
||||
'model' => $model,
|
||||
'form' => $form2->createView(),
|
||||
];
|
||||
}
|
||||
@@ -210,7 +194,7 @@ final class SystemConfigurationController extends AbstractController
|
||||
/**
|
||||
* @return SystemConfigurationModel[]
|
||||
*/
|
||||
protected function getInitializedConfigurations()
|
||||
private function getInitializedConfigurations(): array
|
||||
{
|
||||
$types = $this->getConfigurationTypes();
|
||||
|
||||
@@ -219,11 +203,11 @@ final class SystemConfigurationController extends AbstractController
|
||||
|
||||
foreach ($event->getConfigurations() as $configs) {
|
||||
foreach ($configs->getConfiguration() as $config) {
|
||||
if (!$this->configurations->has($config->getName())) {
|
||||
if (!$this->systemConfiguration->has($config->getName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$configValue = $this->configurations->find($config->getName());
|
||||
$configValue = $this->systemConfiguration->find($config->getName());
|
||||
if (null !== $configValue) {
|
||||
$config->setValue($configValue);
|
||||
}
|
||||
@@ -236,41 +220,29 @@ final class SystemConfigurationController extends AbstractController
|
||||
/**
|
||||
* @return SystemConfigurationModel[]
|
||||
*/
|
||||
protected function getConfigurationTypes()
|
||||
private function getConfigurationTypes(): array
|
||||
{
|
||||
$user = $this->getUser();
|
||||
$lockdownStartHelp = null;
|
||||
$lockdownEndHelp = null;
|
||||
$lockdownGraceHelp = null;
|
||||
$dateFormat = 'D, d M Y H:i:s';
|
||||
|
||||
if ($this->configurations->isTimesheetLockdownActive()) {
|
||||
$userTimezone = $this->getDateTimeFactory()->getTimezone();
|
||||
$timezone = $this->configurations->getTimesheetLockdownTimeZone();
|
||||
|
||||
if ($timezone !== null) {
|
||||
$timezone = new \DateTimeZone($timezone);
|
||||
}
|
||||
|
||||
if ($timezone === null) {
|
||||
$timezone = $userTimezone;
|
||||
}
|
||||
|
||||
if ($this->lockdownService->isLockdownActive()) {
|
||||
try {
|
||||
if (!empty($this->configurations->getTimesheetLockdownPeriodStart())) {
|
||||
$lockdownStartHelp = new \DateTime($this->configurations->getTimesheetLockdownPeriodStart(), $timezone);
|
||||
$lockdownStartHelp->setTimezone($userTimezone);
|
||||
$lockdownStartHelp = $lockdownStartHelp->format($dateFormat);
|
||||
$start = $this->lockdownService->getLockdownStart($user);
|
||||
if ($start !== null) {
|
||||
$lockdownStartHelp = $start->format($dateFormat);
|
||||
}
|
||||
if (!empty($this->configurations->getTimesheetLockdownPeriodEnd())) {
|
||||
$lockdownEndHelp = new \DateTime($this->configurations->getTimesheetLockdownPeriodEnd(), $timezone);
|
||||
if (!empty($this->configurations->getTimesheetLockdownGracePeriod())) {
|
||||
$lockdownGraceHelp = clone $lockdownEndHelp;
|
||||
$lockdownGraceHelp->modify($this->configurations->getTimesheetLockdownGracePeriod());
|
||||
$lockdownGraceHelp->setTimezone($userTimezone);
|
||||
$lockdownGraceHelp = $lockdownGraceHelp->format($dateFormat);
|
||||
}
|
||||
$lockdownEndHelp->setTimezone($userTimezone);
|
||||
$lockdownEndHelp = $lockdownEndHelp->format($dateFormat);
|
||||
|
||||
$end = $this->lockdownService->getLockdownEnd($user);
|
||||
if ($end !== null) {
|
||||
$lockdownEndHelp = $end->format($dateFormat);
|
||||
}
|
||||
|
||||
$grace = $this->lockdownService->getLockdownGrace($user);
|
||||
if ($grace !== null) {
|
||||
$lockdownGraceHelp = $grace->format($dateFormat);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$lockdownStartHelp = 'invalid';
|
||||
@@ -279,52 +251,35 @@ final class SystemConfigurationController extends AbstractController
|
||||
|
||||
$authentication = (new SystemConfigurationModel('authentication'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('user.login')
|
||||
(new Configuration('user.login'))
|
||||
->setLabel('user_auth_login')
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(YesNoType::class),
|
||||
(new Configuration())
|
||||
->setName('user.registration')
|
||||
(new Configuration('user.registration'))
|
||||
->setLabel('user_auth_registration')
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(YesNoType::class),
|
||||
(new Configuration())
|
||||
->setName('user.password_reset')
|
||||
(new Configuration('user.password_reset'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setLabel('user_auth_password_reset')
|
||||
->setType(YesNoType::class),
|
||||
(new Configuration())
|
||||
->setName('user.password_reset_retry_ttl')
|
||||
(new Configuration('user.password_reset_retry_ttl'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setLabel('user_auth_password_reset_retry_ttl')
|
||||
->setConstraints([new NotNull(), new GreaterThanOrEqual(['value' => 60])])
|
||||
->setType(IntegerType::class),
|
||||
(new Configuration())
|
||||
->setName('user.password_reset_token_ttl')
|
||||
(new Configuration('user.password_reset_token_ttl'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setLabel('user_auth_password_reset_token_ttl')
|
||||
->setConstraints([new NotNull(), new GreaterThanOrEqual(['value' => 60])])
|
||||
->setType(IntegerType::class),
|
||||
/*
|
||||
(new Configuration())
|
||||
->setName('ldap.activate')
|
||||
->setLabel('ldap_activate')
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(YesNoType::class),
|
||||
(new Configuration())
|
||||
->setName('saml.activate')
|
||||
->setLabel('saml_activate')
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(YesNoType::class),
|
||||
*/
|
||||
]);
|
||||
|
||||
if (!$this->configurations->isSamlActive()) {
|
||||
if (!$this->systemConfiguration->isSamlActive()) {
|
||||
$authentication->getConfigurationByName('user.login')->setEnabled(false);
|
||||
}
|
||||
|
||||
if (!$this->configurations->isPasswordResetActive()) {
|
||||
if (!$this->systemConfiguration->isPasswordResetActive()) {
|
||||
$authentication->getConfigurationByName('user.password_reset_retry_ttl')->setEnabled(false);
|
||||
$authentication->getConfigurationByName('user.password_reset_token_ttl')->setEnabled(false);
|
||||
}
|
||||
@@ -332,64 +287,52 @@ final class SystemConfigurationController extends AbstractController
|
||||
return [
|
||||
(new SystemConfigurationModel('timesheet'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('timesheet.mode')
|
||||
(new Configuration('timesheet.mode'))
|
||||
->setType(TrackingModeType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.default_begin')
|
||||
(new Configuration('timesheet.default_begin'))
|
||||
->setType(DateTimeTextType::class)
|
||||
->setConstraints([new DateTimeFormat(), new NotNull()])
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.allow_future_times')
|
||||
->setType(CheckboxType::class)
|
||||
(new Configuration('timesheet.rules.allow_future_times'))
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.allow_zero_duration')
|
||||
->setType(CheckboxType::class)
|
||||
(new Configuration('timesheet.rules.allow_zero_duration'))
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.allow_overlapping_records')
|
||||
->setType(CheckboxType::class)
|
||||
(new Configuration('timesheet.rules.allow_overlapping_records'))
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.allow_overbooking_budget')
|
||||
->setType(CheckboxType::class)
|
||||
(new Configuration('timesheet.rules.allow_overbooking_budget'))
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.active_entries.hard_limit')
|
||||
(new Configuration('timesheet.active_entries.hard_limit'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
new GreaterThanOrEqual(['value' => 1])
|
||||
]),
|
||||
(new Configuration())
|
||||
->setName('timesheet.time_increment')
|
||||
(new Configuration('timesheet.time_increment'))
|
||||
->setType(MinuteIncrementType::class)
|
||||
->setOptions(['deactivate' => false, 'max_one_hour' => true])
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
new Range(['min' => 1, 'max' => 60])
|
||||
new Range(['min' => 0, 'max' => 60])
|
||||
]),
|
||||
(new Configuration())
|
||||
->setName('timesheet.duration_increment')
|
||||
(new Configuration('timesheet.duration_increment'))
|
||||
->setType(MinuteIncrementType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
new GreaterThanOrEqual(['value' => 0])
|
||||
]),
|
||||
/*
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.break_warning_duration')
|
||||
(new Configuration('timesheet.rules.break_warning_duration'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
new GreaterThanOrEqual(['value' => 0])
|
||||
]),
|
||||
*/
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.long_running_duration')
|
||||
(new Configuration('timesheet.rules.long_running_duration'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
@@ -400,24 +343,21 @@ final class SystemConfigurationController extends AbstractController
|
||||
->setTranslation('quick_entry.title')
|
||||
->setTranslationDomain('messages')
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('quick_entry.recent_activities')
|
||||
(new Configuration('quick_entry.recent_activities'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
->setConstraints([
|
||||
new Range(['min' => 0, 'max' => 20]),
|
||||
]),
|
||||
(new Configuration())
|
||||
->setName('quick_entry.recent_activity_weeks')
|
||||
(new Configuration('quick_entry.recent_activity_weeks'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
->setConstraints([
|
||||
new Range(['min' => 0, 'max' => 20]),
|
||||
]),
|
||||
(new Configuration())
|
||||
->setName('quick_entry.minimum_rows')
|
||||
(new Configuration('quick_entry.minimum_rows'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
@@ -426,27 +366,23 @@ final class SystemConfigurationController extends AbstractController
|
||||
]),
|
||||
(new SystemConfigurationModel('lockdown_period'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.lockdown_period_start')
|
||||
(new Configuration('timesheet.rules.lockdown_period_start'))
|
||||
->setOptions(['help' => $lockdownStartHelp])
|
||||
->setType(TextType::class)
|
||||
->setRequired(false)
|
||||
->setConstraints([new DateTimeFormat()])
|
||||
->setConstraints([new DateTimeFormat(['separator' => ','])])
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.lockdown_period_end')
|
||||
(new Configuration('timesheet.rules.lockdown_period_end'))
|
||||
->setOptions(['help' => $lockdownEndHelp])
|
||||
->setType(TextType::class)
|
||||
->setRequired(false)
|
||||
->setConstraints([new DateTimeFormat()])
|
||||
->setConstraints([new DateTimeFormat(['separator' => ','])])
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.lockdown_period_timezone')
|
||||
(new Configuration('timesheet.rules.lockdown_period_timezone'))
|
||||
->setType(TimezoneType::class)
|
||||
->setRequired(false)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rules.lockdown_grace_period')
|
||||
(new Configuration('timesheet.rules.lockdown_grace_period'))
|
||||
->setOptions(['help' => $lockdownGraceHelp])
|
||||
->setType(TextType::class)
|
||||
->setRequired(false)
|
||||
@@ -455,33 +391,28 @@ final class SystemConfigurationController extends AbstractController
|
||||
]),
|
||||
(new SystemConfigurationModel('rounding'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('timesheet.rounding.default.mode')
|
||||
(new Configuration('timesheet.rounding.default.mode'))
|
||||
->setType(RoundingModeType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rounding.default.begin')
|
||||
(new Configuration('timesheet.rounding.default.begin'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
new GreaterThanOrEqual(['value' => 0])
|
||||
]),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rounding.default.end')
|
||||
(new Configuration('timesheet.rounding.default.end'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
new GreaterThanOrEqual(['value' => 0])
|
||||
]),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rounding.default.duration')
|
||||
(new Configuration('timesheet.rounding.default.duration'))
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setConstraints([
|
||||
new GreaterThanOrEqual(['value' => 0])
|
||||
]),
|
||||
(new Configuration())
|
||||
->setName('timesheet.rounding.default.days')
|
||||
(new Configuration('timesheet.rounding.default.days'))
|
||||
->setType(WeekDaysType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
]),
|
||||
@@ -490,210 +421,160 @@ final class SystemConfigurationController extends AbstractController
|
||||
->setTranslationDomain('messages')
|
||||
->setConfiguration([
|
||||
// TODO that should be a custom type with validation
|
||||
(new Configuration())
|
||||
->setName('invoice.number_format')
|
||||
(new Configuration('invoice.number_format'))
|
||||
->setLabel('invoice.number_format')
|
||||
->setOptions([
|
||||
'help' => 'allowed_replacer',
|
||||
'help_translation_parameters' => [
|
||||
'%replacer%' => '{Y}, {y}, {M}, {m}, {D}, {d}, {date}, {cc}, {ccy}, {ccm}, {ccd}, {cu}, {cuy}, {cum}, {cud}, {ustaff}, {uid}, {c}, {cy}, {cm}, {cd}, {cname}, {cnumber}'
|
||||
]
|
||||
])
|
||||
->setRequired(true)
|
||||
->setType(TextType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('invoice.simple_form')
|
||||
->setLabel('simple_form')
|
||||
->setRequired(false)
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
]),
|
||||
$authentication,
|
||||
(new SystemConfigurationModel('customer'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('defaults.customer.timezone')
|
||||
(new Configuration('defaults.customer.timezone'))
|
||||
->setLabel('timezone')
|
||||
->setType(TimezoneType::class)
|
||||
->setValue(date_default_timezone_get())
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration())
|
||||
->setName('defaults.customer.country')
|
||||
(new Configuration('defaults.customer.country'))
|
||||
->setLabel('country')
|
||||
->setType(CountryType::class)
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration())
|
||||
->setName('defaults.customer.currency')
|
||||
(new Configuration('defaults.customer.currency'))
|
||||
->setLabel('currency')
|
||||
->setType(CurrencyType::class)
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration())
|
||||
->setName('customer.choice_pattern')
|
||||
(new Configuration('customer.choice_pattern'))
|
||||
->setLabel('choice_pattern')
|
||||
->setType(CustomerTypePatternType::class),
|
||||
(new Configuration('customer.number_format'))
|
||||
->setLabel('customer.number_format')
|
||||
->setOptions(['help' => 'allowed_replacer', 'help_translation_parameters' => ['%replacer%' => '{cc}']])
|
||||
->setRequired(true)
|
||||
->setType(TextType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
]),
|
||||
(new SystemConfigurationModel('project'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('project.choice_pattern')
|
||||
(new Configuration('project.choice_pattern'))
|
||||
->setLabel('choice_pattern')
|
||||
->setType(ProjectTypePatternType::class),
|
||||
(new Configuration())
|
||||
->setName('project.copy_teams_on_create')
|
||||
(new Configuration('project.copy_teams_on_create'))
|
||||
->setLabel('copy_teams_on_create')
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
]),
|
||||
(new SystemConfigurationModel('activity'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('activity.choice_pattern')
|
||||
(new Configuration('activity.choice_pattern'))
|
||||
->setLabel('choice_pattern')
|
||||
->setType(ActivityTypePatternType::class),
|
||||
// TODO see DependencyInjection/Configuration::getActivityNode()
|
||||
/*
|
||||
(new Configuration('activity.allow_inline_create'))
|
||||
->setLabel('activity.allow_inline_create')
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'), */
|
||||
]),
|
||||
(new SystemConfigurationModel('user'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('defaults.user.timezone')
|
||||
(new Configuration('defaults.user.timezone'))
|
||||
->setLabel('timezone')
|
||||
->setType(TimezoneType::class)
|
||||
->setValue(date_default_timezone_get())
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration())
|
||||
->setName('defaults.user.language')
|
||||
(new Configuration('defaults.user.language'))
|
||||
->setLabel('language')
|
||||
->setType(LanguageType::class)
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration())
|
||||
->setName('defaults.user.theme')
|
||||
(new Configuration('defaults.user.theme'))
|
||||
->setLabel('skin')
|
||||
->setType(SkinType::class)
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration())
|
||||
->setName('defaults.user.currency')
|
||||
(new Configuration('defaults.user.currency'))
|
||||
->setLabel('currency')
|
||||
->setType(CurrencyType::class),
|
||||
(new Configuration())
|
||||
->setName('theme.avatar_url')
|
||||
(new Configuration('theme.avatar_url'))
|
||||
->setRequired(false)
|
||||
->setLabel('theme.avatar_url')
|
||||
->setType(CheckboxType::class)
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
]),
|
||||
(new SystemConfigurationModel('theme'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('theme.autocomplete_chars')
|
||||
->setLabel('theme.autocomplete_chars')
|
||||
->setType(IntegerType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('timesheet.markdown_content')
|
||||
(new Configuration('timesheet.markdown_content'))
|
||||
->setLabel('theme.markdown_content')
|
||||
->setType(CheckboxType::class)
|
||||
->setType(YesNoType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('theme.tags_create')
|
||||
->setLabel('theme.tags_create')
|
||||
->setType(CheckboxType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('theme.colors_limited')
|
||||
->setLabel('theme.colors_limited')
|
||||
->setType(CheckboxType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
(new Configuration())
|
||||
->setName('theme.color_choices')
|
||||
(new Configuration('theme.color_choices'))
|
||||
->setRequired(false)
|
||||
->setLabel('theme.color_choices')
|
||||
->setType(ArrayToCommaStringType::class)
|
||||
->setOptions(['help' => 'help.theme.color_choices'])
|
||||
->setConstraints([new ColorChoices()])
|
||||
->setTranslationDomain('system-configuration'),
|
||||
// random colors as fallback
|
||||
(new Configuration())
|
||||
->setName('theme.random_colors')
|
||||
->setRequired(false)
|
||||
->setLabel('theme.random_colors')
|
||||
->setType(CheckboxType::class)
|
||||
->setTranslationDomain('system-configuration'),
|
||||
]),
|
||||
(new SystemConfigurationModel('calendar'))
|
||||
->setTranslation('calendar')
|
||||
->setTranslationDomain('messages')
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('calendar.week_numbers')
|
||||
(new Configuration('calendar.week_numbers'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(CheckboxType::class),
|
||||
(new Configuration())
|
||||
->setName('calendar.weekends')
|
||||
->setType(YesNoType::class),
|
||||
(new Configuration('calendar.weekends'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(CheckboxType::class),
|
||||
(new Configuration())
|
||||
->setName('calendar.businessHours.begin')
|
||||
->setType(YesNoType::class),
|
||||
(new Configuration('calendar.businessHours.begin'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(DayTimeType::class)
|
||||
->setConstraints([new NotBlank(), new TimeFormat()]),
|
||||
(new Configuration())
|
||||
->setName('calendar.businessHours.end')
|
||||
(new Configuration('calendar.businessHours.end'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(DayTimeType::class)
|
||||
->setConstraints([new NotBlank(), new TimeFormat()]),
|
||||
(new Configuration())
|
||||
->setName('calendar.visibleHours.begin')
|
||||
(new Configuration('calendar.visibleHours.begin'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(DayTimeType::class)
|
||||
->setConstraints([new NotBlank(), new TimeFormat()]),
|
||||
(new Configuration())
|
||||
->setName('calendar.visibleHours.end')
|
||||
(new Configuration('calendar.visibleHours.end'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(DayTimeType::class)
|
||||
->setConstraints([new NotBlank(), new TimeFormat()]),
|
||||
(new Configuration())
|
||||
->setName('calendar.slot_duration')
|
||||
(new Configuration('calendar.slot_duration'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(TextType::class)
|
||||
->setConstraints([new Regex(['pattern' => '/[0-2]{1}[0-9]{1}:[0-9]{2}:[0-9]{2}/']), new NotNull()]),
|
||||
(new Configuration())
|
||||
->setName('calendar.dragdrop_amount')
|
||||
(new Configuration('calendar.dragdrop_amount'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(IntegerType::class)
|
||||
->setConstraints([new Range(['min' => 0, 'max' => 20]), new NotNull()]),
|
||||
(new Configuration())
|
||||
->setName('calendar.dragdrop_data')
|
||||
(new Configuration('calendar.dragdrop_data'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(CheckboxType::class),
|
||||
(new Configuration())
|
||||
->setName('calendar.title_pattern')
|
||||
->setType(YesNoType::class),
|
||||
(new Configuration('calendar.title_pattern'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setType(CalendarTitlePatternType::class),
|
||||
]),
|
||||
(new SystemConfigurationModel('branding'))
|
||||
->setConfiguration([
|
||||
(new Configuration())
|
||||
->setName('theme.branding.logo')
|
||||
(new Configuration('theme.branding.logo'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
->setType(TextType::class),
|
||||
(new Configuration())
|
||||
->setName('theme.branding.company')
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
->setType(TextType::class)
|
||||
->setConstraints([new AllowedHtmlTags(['tags' => '<b><i><u><strong><em><img><svg>'])]),
|
||||
(new Configuration())
|
||||
->setName('theme.branding.mini')
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
->setType(TextType::class)
|
||||
->setConstraints([new AllowedHtmlTags(['tags' => '<b><i><u><strong><em><img><svg>'])]),
|
||||
(new Configuration())
|
||||
->setName('theme.branding.title')
|
||||
(new Configuration('theme.branding.company'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
->setType(TextType::class),
|
||||
(new Configuration())
|
||||
->setName('company.financial_year')
|
||||
(new Configuration('company.financial_year'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
->setType(DatePickerType::class)
|
||||
->setOptions(['input' => 'string']),
|
||||
->setOptions(['input' => 'string']),
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user