mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-13 13:49:33 +00:00
Benutzerdefinierten Bauteilstatus einführen
This commit is contained in:
parent
0dc7dbdb03
commit
ee54687f9d
56 changed files with 1312 additions and 31 deletions
|
|
@ -41,6 +41,7 @@ use App\Entity\Parts\Category;
|
|||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\Parts\StorageLocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
|
|
@ -86,6 +87,7 @@ class PartFilter implements FilterInterface
|
|||
public readonly EntityConstraint $lotOwner;
|
||||
|
||||
public readonly EntityConstraint $measurementUnit;
|
||||
public readonly EntityConstraint $partCustomState;
|
||||
public readonly TextConstraint $manufacturer_product_url;
|
||||
public readonly TextConstraint $manufacturer_product_number;
|
||||
public readonly IntConstraint $attachmentsCount;
|
||||
|
|
@ -128,6 +130,7 @@ class PartFilter implements FilterInterface
|
|||
$this->favorite = new BooleanConstraint('part.favorite');
|
||||
$this->needsReview = new BooleanConstraint('part.needs_review');
|
||||
$this->measurementUnit = new EntityConstraint($nodesListBuilder, MeasurementUnit::class, 'part.partUnit');
|
||||
$this->partCustomState = new EntityConstraint($nodesListBuilder, PartCustomState::class, 'part.partCustomState');
|
||||
$this->mass = new NumberConstraint('part.mass');
|
||||
$this->dbId = new IntConstraint('part.id');
|
||||
$this->ipn = new TextConstraint('part.ipn');
|
||||
|
|
|
|||
|
|
@ -175,6 +175,19 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
return $tmp;
|
||||
}
|
||||
])
|
||||
->add('partCustomState', TextColumn::class, [
|
||||
'label' => $this->translator->trans('part.table.partCustomState'),
|
||||
'orderField' => 'NATSORT(_partCustomState.name)',
|
||||
'render' => function($value, Part $context): string {
|
||||
$partCustomState = $context->getPartCustomState();
|
||||
|
||||
if ($partCustomState === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return htmlspecialchars($partCustomState->getName());
|
||||
}
|
||||
])
|
||||
->add('addedDate', LocaleDateTimeColumn::class, [
|
||||
'label' => $this->translator->trans('part.table.addedDate'),
|
||||
])
|
||||
|
|
@ -338,6 +351,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
->addSelect('footprint')
|
||||
->addSelect('manufacturer')
|
||||
->addSelect('partUnit')
|
||||
->addSelect('partCustomState')
|
||||
->addSelect('master_picture_attachment')
|
||||
->addSelect('footprint_attachment')
|
||||
->addSelect('partLots')
|
||||
|
|
@ -356,6 +370,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
->leftJoin('orderdetails.supplier', 'suppliers')
|
||||
->leftJoin('part.attachments', 'attachments')
|
||||
->leftJoin('part.partUnit', 'partUnit')
|
||||
->leftJoin('part.partCustomState', 'partCustomState')
|
||||
->leftJoin('part.parameters', 'parameters')
|
||||
->where('part.id IN (:ids)')
|
||||
->setParameter('ids', $ids)
|
||||
|
|
@ -373,6 +388,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
->addGroupBy('suppliers')
|
||||
->addGroupBy('attachments')
|
||||
->addGroupBy('partUnit')
|
||||
->addGroupBy('partCustomState')
|
||||
->addGroupBy('parameters');
|
||||
|
||||
//Get the results in the same order as the IDs were passed
|
||||
|
|
@ -444,6 +460,10 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
$builder->leftJoin('part.partUnit', '_partUnit');
|
||||
$builder->addGroupBy('_partUnit');
|
||||
}
|
||||
if (str_contains($dql, '_partCustomState')) {
|
||||
$builder->leftJoin('part.partCustomState', '_partCustomState');
|
||||
$builder->addGroupBy('_partCustomState');
|
||||
}
|
||||
if (str_contains($dql, '_parameters')) {
|
||||
$builder->leftJoin('part.parameters', '_parameters');
|
||||
//Do not group by many-to-* relations, as it would restrict the COUNT having clauses to be maximum 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue