merge default currency settings (#5739)
This commit is contained in:
@@ -323,11 +323,6 @@ final class SystemConfiguration
|
||||
return $this->find('defaults.customer.timezone');
|
||||
}
|
||||
|
||||
public function getCustomerDefaultCurrency(): string
|
||||
{
|
||||
return $this->find('defaults.customer.currency');
|
||||
}
|
||||
|
||||
public function getCustomerDefaultCountry(): string
|
||||
{
|
||||
return $this->find('defaults.customer.country');
|
||||
@@ -340,20 +335,35 @@ final class SystemConfiguration
|
||||
return $this->find('defaults.user.timezone');
|
||||
}
|
||||
|
||||
public function getUserDefaultTheme(): ?string
|
||||
public function getUserDefaultTheme(): string
|
||||
{
|
||||
return $this->find('defaults.user.theme');
|
||||
return $this->getString('defaults.user.theme', 'auto');
|
||||
}
|
||||
|
||||
public function getUserDefaultLanguage(): string
|
||||
{
|
||||
return $this->find('defaults.user.language');
|
||||
return $this->getString('defaults.user.language', 'en');
|
||||
}
|
||||
|
||||
// TODO this is only used to display the hourly rate in the user profile
|
||||
public function getDefaultCurrency(): string
|
||||
{
|
||||
return $this->getString('defaults.customer.currency', 'EUR');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getDefaultCurrency() instead
|
||||
*/
|
||||
public function getCustomerDefaultCurrency(): string
|
||||
{
|
||||
return $this->getDefaultCurrency();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getDefaultCurrency() instead
|
||||
*/
|
||||
public function getUserDefaultCurrency(): string
|
||||
{
|
||||
return $this->find('defaults.user.currency');
|
||||
return $this->getDefaultCurrency();
|
||||
}
|
||||
|
||||
// ========== Timesheet configurations ==========
|
||||
|
||||
@@ -111,7 +111,7 @@ final class ActivityController extends AbstractController
|
||||
'page_setup' => $page,
|
||||
'dataTable' => $table,
|
||||
'metaColumns' => $metaColumns,
|
||||
'defaultCurrency' => $configuration->getCustomerDefaultCurrency(),
|
||||
'defaultCurrency' => $configuration->getDefaultCurrency(),
|
||||
'now' => $this->getDateTimeFactory()->createDateTime(),
|
||||
]);
|
||||
}
|
||||
@@ -452,7 +452,7 @@ final class ActivityController extends AbstractController
|
||||
*/
|
||||
private function createEditForm(Activity $activity, SystemConfiguration $configuration): FormInterface
|
||||
{
|
||||
$currency = $configuration->getCustomerDefaultCurrency();
|
||||
$currency = $configuration->getDefaultCurrency();
|
||||
$url = $this->generateUrl('admin_activity_create');
|
||||
if ($activity->getProject()?->getId() !== null) {
|
||||
$url = $this->generateUrl('admin_activity_create_with_project', ['project' => $activity->getProject()->getId()]);
|
||||
|
||||
@@ -177,7 +177,7 @@ final class ProjectController extends AbstractController
|
||||
{
|
||||
$project = $projectService->createNewProject($customer);
|
||||
|
||||
$editForm = $this->createEditForm($project, $configuration->getCustomerDefaultCurrency());
|
||||
$editForm = $this->createEditForm($project, $configuration->getDefaultCurrency());
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
@@ -440,7 +440,7 @@ final class ProjectController extends AbstractController
|
||||
{
|
||||
$projectService->loadMetaFields($project);
|
||||
|
||||
$editForm = $this->createEditForm($project, $configuration->getCustomerDefaultCurrency());
|
||||
$editForm = $this->createEditForm($project, $configuration->getDefaultCurrency());
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
|
||||
@@ -467,10 +467,6 @@ final class SystemConfigurationController extends AbstractController
|
||||
->setLabel('country')
|
||||
->setType(CountryType::class)
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration('defaults.customer.currency'))
|
||||
->setLabel('currency')
|
||||
->setType(CurrencyType::class)
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration('customer.choice_pattern'))
|
||||
->setLabel('choice_pattern')
|
||||
->setType(CustomerTypePatternType::class),
|
||||
@@ -542,9 +538,6 @@ final class SystemConfigurationController extends AbstractController
|
||||
->setLabel('skin')
|
||||
->setType(SkinType::class)
|
||||
->setOptions(['help' => 'default_value_new']),
|
||||
(new Configuration('defaults.user.currency'))
|
||||
->setLabel('currency')
|
||||
->setType(CurrencyType::class),
|
||||
(new Configuration('theme.avatar_url'))
|
||||
->setRequired(false)
|
||||
->setLabel('theme.avatar_url')
|
||||
@@ -617,6 +610,10 @@ final class SystemConfigurationController extends AbstractController
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
->setType(TextType::class),
|
||||
(new Configuration('defaults.customer.currency'))
|
||||
->setLabel('currency')
|
||||
->setType(CurrencyType::class)
|
||||
->setOptions(['help' => 'Can be overwritten per customer']),
|
||||
(new Configuration('company.financial_year'))
|
||||
->setTranslationDomain('system-configuration')
|
||||
->setRequired(false)
|
||||
|
||||
@@ -55,7 +55,7 @@ final class CustomerService
|
||||
$customer = new Customer($name);
|
||||
$customer->setTimezone($this->getDefaultTimezone());
|
||||
$customer->setCountry($this->configuration->getCustomerDefaultCountry());
|
||||
$customer->setCurrency($this->configuration->getCustomerDefaultCurrency());
|
||||
$customer->setCurrency($this->configuration->getDefaultCurrency());
|
||||
$customer->setNumber($this->calculateNextCustomerNumber());
|
||||
|
||||
$this->loadMetaFields($customer);
|
||||
|
||||
@@ -625,8 +625,7 @@ final class Configuration implements ConfigurationInterface
|
||||
->children()
|
||||
->scalarNode('timezone')->defaultNull()->end()
|
||||
->scalarNode('language')->defaultValue(User::DEFAULT_LANGUAGE)->end()
|
||||
->scalarNode('theme')->defaultValue('default')->end()
|
||||
->scalarNode('currency')->defaultValue(Customer::DEFAULT_CURRENCY)->end()
|
||||
->scalarNode('theme')->defaultValue('auto')->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
|
||||
@@ -60,7 +60,7 @@ final class UserPreferenceSubscriber implements EventSubscriberInterface
|
||||
|
||||
if ($this->voter->isGranted('hourly-rate', $user)) {
|
||||
$enableHourlyRate = true;
|
||||
$hourlyRateOptions = ['currency' => $this->systemConfiguration->getUserDefaultCurrency()];
|
||||
$hourlyRateOptions = ['currency' => $this->systemConfiguration->getDefaultCurrency()];
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user