Allow to set a global default if new orderdetails should contain VAT or not
Some checks are pending
Build assets artifact / Build assets artifact (push) Waiting to run
Docker Image Build / docker (push) Waiting to run
Docker Image Build (FrankenPHP) / docker (push) Waiting to run
Static analysis / Static analysis (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, sqlite) (push) Waiting to run

This commit is contained in:
Jan Böhmer 2026-02-10 17:13:54 +01:00
parent 8ac8743792
commit e5231e29f2
5 changed files with 42 additions and 3 deletions

View file

@ -43,6 +43,7 @@ use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
use App\Services\LogSystem\EventCommentNeededHelper;
use App\Services\LogSystem\EventCommentType;
use App\Settings\MiscSettings\IpnSuggestSettings;
use App\Settings\SystemSettings\LocalizationSettings;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
@ -63,6 +64,7 @@ class PartBaseType extends AbstractType
protected UrlGeneratorInterface $urlGenerator,
protected EventCommentNeededHelper $event_comment_needed_helper,
protected IpnSuggestSettings $ipnSuggestSettings,
private readonly LocalizationSettings $localizationSettings,
) {
}
@ -267,6 +269,9 @@ class PartBaseType extends AbstractType
'entity' => $part,
]);
$orderdetailPrototype = new Orderdetail();
$orderdetailPrototype->setPricesIncludesVAT($this->localizationSettings->pricesIncludeTaxByDefault);
//Orderdetails section
$builder->add('orderdetails', CollectionType::class, [
'entry_type' => OrderdetailType::class,
@ -275,7 +280,7 @@ class PartBaseType extends AbstractType
'allow_delete' => true,
'label' => false,
'by_reference' => false,
'prototype_data' => new Orderdetail(),
'prototype_data' => $orderdetailPrototype,
'entry_options' => [
'measurement_unit' => $part->getPartUnit(),
],

View file

@ -25,6 +25,7 @@ namespace App\Settings\SystemSettings;
use App\Form\Settings\LanguageMenuEntriesType;
use App\Form\Type\LocaleSelectType;
use App\Form\Type\TriStateCheckboxType;
use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\ParameterTypes\ArrayType;
@ -46,7 +47,7 @@ class LocalizationSettings
#[Assert\Locale()]
#[Assert\NotBlank()]
#[SettingsParameter(label: new TM("settings.system.localization.locale"), formType: LocaleSelectType::class,
envVar: "string:DEFAULT_LANG", envVarMode: EnvVarMode::OVERWRITE)]
envVar: "string:DEFAULT_LANG", envVarMode: EnvVarMode::OVERWRITE)]
public string $locale = 'en';
#[Assert\Timezone()]
@ -73,4 +74,14 @@ class LocalizationSettings
)]
#[Assert\All([new Assert\Locale()])]
public array $languageMenuEntries = [];
#[SettingsParameter(label: new TM("settings.system.localization.prices_include_tax_by_default"),
description: new TM("settings.system.localization.prices_include_tax_by_default.description"),
formType: TriStateCheckboxType::class
)]
/**
* Indicates whether prices should include tax by default. This is used when creating new pricedetails.
* Null means that the VAT state should be indetermine by default.
*/
public ?bool $pricesIncludeTaxByDefault = null;
}