mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-13 13:49:33 +00:00
Assembly Konfiguration in BOM ausblenden, wenn bisher keine Zuordnung zu mindestens einem Eintrag stattgefunden hat (Berücksichtigung Rechtekonfiguration)
This commit is contained in:
parent
290a9b309f
commit
1cf396fbd9
2 changed files with 38 additions and 3 deletions
26
src/Twig/AssemblyTwigExtension.php
Normal file
26
src/Twig/AssemblyTwigExtension.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Twig;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class AssemblyTwigExtension extends AbstractExtension
|
||||
{
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new TwigFunction('has_assembly', [$this, 'hasAssembly']),
|
||||
];
|
||||
}
|
||||
|
||||
public function hasAssembly(array $bomEntries): bool
|
||||
{
|
||||
foreach ($bomEntries as $entry) {
|
||||
if ($entry->getAssembly() !== null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue