allow to configure default values for users (#919)

This commit is contained in:
Kevin Papst
2019-07-05 02:42:50 +02:00
committed by GitHub
parent 3457f93ed0
commit 19843760e5
12 changed files with 142 additions and 29 deletions

View File

@@ -15,6 +15,8 @@ use App\Form\Model\Configuration;
use App\Form\Model\SystemConfiguration as SystemConfigurationModel;
use App\Form\SystemConfigurationForm;
use App\Form\Type\EnhancedSelectboxType;
use App\Form\Type\LanguageType;
use App\Form\Type\SkinType;
use App\Form\Type\TrackingModeType;
use App\Repository\ConfigurationRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
@@ -171,7 +173,10 @@ class SystemConfigurationController extends AbstractController
foreach ($event->getConfigurations() as $configs) {
foreach ($configs->getConfiguration() as $config) {
$config->setValue($this->configurations->find($config->getName()));
$configValue = $this->configurations->find($config->getName());
if (null !== $configValue) {
$config->setValue($configValue);
}
}
}
@@ -216,7 +221,8 @@ class SystemConfigurationController extends AbstractController
(new Configuration())
->setName('defaults.customer.timezone')
->setLabel('timezone')
->setType(TimezoneType::class),
->setType(TimezoneType::class)
->setValue(date_default_timezone_get()),
(new Configuration())
->setName('defaults.customer.country')
->setLabel('country')
@@ -226,6 +232,23 @@ class SystemConfigurationController extends AbstractController
->setLabel('currency')
->setType(CurrencyType::class),
]),
(new SystemConfigurationModel())
->setSection(SystemConfigurationModel::SECTION_FORM_USER)
->setConfiguration([
(new Configuration())
->setName('defaults.user.timezone')
->setLabel('timezone')
->setType(TimezoneType::class)
->setValue(date_default_timezone_get()),
(new Configuration())
->setName('defaults.user.language')
->setLabel('language')
->setType(LanguageType::class),
(new Configuration())
->setName('defaults.user.theme')
->setLabel('skin')
->setType(SkinType::class),
]),
(new SystemConfigurationModel())
->setSection(SystemConfigurationModel::SECTION_THEME)
->setConfiguration([