mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-14 20:35:08 +02:00
Changed logic of invisible to a (forced) visibility field
This commit is contained in:
parent
bc37d11f13
commit
7d69d6ba30
9 changed files with 37 additions and 29 deletions
|
@ -38,10 +38,10 @@ class EDACategoryInfo
|
|||
#[Groups(['full', 'category:read', 'category:write'])]
|
||||
private ?string $reference_prefix = null;
|
||||
|
||||
/** @var bool|null If this is true, then this part is invisible for the EDA software */
|
||||
#[Column(type: Types::BOOLEAN, nullable: true)]
|
||||
/** @var bool|null Visibility of this part to EDA software in trinary logic. True=Visible, False=Invisible, Null=Auto */
|
||||
#[Column(name: 'invisible', type: Types::BOOLEAN, nullable: true)] //TODO: Rename column to visibility
|
||||
#[Groups(['full', 'category:read', 'category:write'])]
|
||||
private ?bool $invisible = null;
|
||||
private ?bool $visibility = null;
|
||||
|
||||
/** @var bool|null If this is set to true, then this part will be excluded from the BOM */
|
||||
#[Column(type: Types::BOOLEAN, nullable: true)]
|
||||
|
@ -74,14 +74,14 @@ class EDACategoryInfo
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getInvisible(): ?bool
|
||||
public function getVisibility(): ?bool
|
||||
{
|
||||
return $this->invisible;
|
||||
return $this->visibility;
|
||||
}
|
||||
|
||||
public function setInvisible(?bool $invisible): EDACategoryInfo
|
||||
public function setVisibility(?bool $visibility): EDACategoryInfo
|
||||
{
|
||||
$this->invisible = $invisible;
|
||||
$this->visibility = $visibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ class EDAPartInfo
|
|||
#[Groups(['full', 'eda_info:read', 'eda_info:write'])]
|
||||
private ?string $value = null;
|
||||
|
||||
/** @var bool|null If this is true, then this part is invisible for the EDA software */
|
||||
#[Column(type: Types::BOOLEAN, nullable: true)]
|
||||
/** @var bool|null Visibility of this part to EDA software in trinary logic. True=Visible, False=Invisible, Null=Auto */
|
||||
#[Column(name: 'invisible', type: Types::BOOLEAN, nullable: true)] //TODO: Rename column to visibility
|
||||
#[Groups(['full', 'eda_info:read', 'eda_info:write'])]
|
||||
private ?bool $invisible = null;
|
||||
private ?bool $visibility = null;
|
||||
|
||||
/** @var bool|null If this is set to true, then this part will be excluded from the BOM */
|
||||
#[Column(type: Types::BOOLEAN, nullable: true)]
|
||||
|
@ -100,14 +100,14 @@ class EDAPartInfo
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getInvisible(): ?bool
|
||||
public function getVisibility(): ?bool
|
||||
{
|
||||
return $this->invisible;
|
||||
return $this->visibility;
|
||||
}
|
||||
|
||||
public function setInvisible(?bool $invisible): EDAPartInfo
|
||||
public function setVisibility(?bool $visibility): EDAPartInfo
|
||||
{
|
||||
$this->invisible = $invisible;
|
||||
$this->visibility = $visibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,9 @@ class EDACategoryInfoType extends AbstractType
|
|||
]
|
||||
]
|
||||
)
|
||||
->add('invisible', TriStateCheckboxType::class, [
|
||||
'label' => 'eda_info.invisible',
|
||||
->add('visibility', TriStateCheckboxType::class, [
|
||||
'help' => 'eda_info.visibility.help',
|
||||
'label' => 'eda_info.visibility',
|
||||
])
|
||||
->add('exclude_from_bom', TriStateCheckboxType::class, [
|
||||
'label' => 'eda_info.exclude_from_bom',
|
||||
|
|
|
@ -50,8 +50,9 @@ class EDAPartInfoType extends AbstractType
|
|||
'placeholder' => t('eda_info.value.placeholder'),
|
||||
]
|
||||
])
|
||||
->add('invisible', TriStateCheckboxType::class, [
|
||||
'label' => 'eda_info.invisible',
|
||||
->add('visibility', TriStateCheckboxType::class, [
|
||||
'help' => 'eda_info.visibility.help',
|
||||
'label' => 'eda_info.visibility',
|
||||
])
|
||||
->add('exclude_from_bom', TriStateCheckboxType::class, [
|
||||
'label' => 'eda_info.exclude_from_bom',
|
||||
|
|
|
@ -80,7 +80,7 @@ class KiCadHelper
|
|||
$result = [];
|
||||
foreach ($categories as $category) {
|
||||
//Skip invisible categories
|
||||
if ($category->getEdaInfo()->getInvisible() ?? false) {
|
||||
if ($category->getEdaInfo()->getVisibility() === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ class KiCadHelper
|
|||
$result = [];
|
||||
foreach ($parts as $part) {
|
||||
//If the part is invisible, then skip it
|
||||
if ($part->getEdaInfo()->getInvisible() ?? $part->getCategory()?->getEdaInfo()->getInvisible() ?? false) {
|
||||
if ($part->getEdaInfo()->getVisibility() === false || $part->getCategory()?->getEdaInfo()->getVisibility() === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue