Anpassungen aus Analyse vornehmen

Name Validierung bei Assembly Angabe in Stücklisten anpassen. permission_layout.html hinsichtlich Synonym-Ausgabe Datenquelle anpassen. Anpassung aus Analyse.
This commit is contained in:
Marcel Diegelmann 2025-07-17 10:54:44 +02:00
parent 6976ab0cc2
commit 67480f2652
5 changed files with 22 additions and 11 deletions

View file

@ -127,6 +127,8 @@ class AssemblyBomEntriesDataTable implements DataTableTypeInterface
'render' => function ($value, AssemblyBOMEntry $context) {
if($context->getPart() instanceof Part) {
return $context->getPart()->getIpn();
} elseif($context->getReferencedAssembly() instanceof Assembly) {
return $context->getReferencedAssembly()->getIpn();
}
return '';

View file

@ -106,7 +106,7 @@ class AssemblyBOMEntry extends AbstractDBElement implements UniqueValidatableInt
/**
* @var string|null An optional name describing this BOM entry (useful for non-part entries)
*/
#[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.assembly.bom_entry.name_or_part_needed')]
#[Assert\Expression('this.getPart() !== null or this.getReferencedAssembly() !== null or this.getName() !== null', message: 'validator.assembly.bom_entry.name_or_part_needed')]
#[ORM\Column(type: Types::STRING, nullable: true)]
#[Groups(['bom_entry:read', 'bom_entry:write', 'import', 'simple', 'extended', 'full'])]
protected ?string $name = null;
@ -206,7 +206,7 @@ class AssemblyBOMEntry extends AbstractDBElement implements UniqueValidatableInt
*/
public function getName(): ?string
{
return $this->name;
return trim($this->name ?? '') === '' ? null : $this->name;
}
/**
@ -214,7 +214,7 @@ class AssemblyBOMEntry extends AbstractDBElement implements UniqueValidatableInt
*/
public function setName(?string $name): AssemblyBOMEntry
{
$this->name = $name;
$this->name = trim($name ?? '') === '' ? null : $name;
return $this;
}