Renamed Storelocation entity to StorageLocation

This commit is contained in:
Jan Böhmer 2023-09-04 22:57:40 +02:00
parent 09acca950d
commit 0af5a58dbe
59 changed files with 218 additions and 176 deletions

View file

@ -30,7 +30,7 @@ use App\Entity\Parts\Category;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
@ -85,7 +85,7 @@ class ConvertBBCodeCommand extends Command
return [
Part::class => ['description', 'comment'],
AttachmentType::class => ['comment'],
Storelocation::class => ['comment'],
StorageLocation::class => ['comment'],
Project::class => ['comment'],
Category::class => ['comment'],
Manufacturer::class => ['comment'],

View file

@ -22,9 +22,9 @@ declare(strict_types=1);
namespace App\Controller\AdminPages;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Parameters\StorelocationParameter;
use App\Entity\Parts\Storelocation;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Parameters\StorageLocationParameter;
use App\Entity\Parts\StorageLocation;
use App\Form\AdminPages\StorelocationAdminForm;
use App\Services\ImportExportSystem\EntityExporter;
use App\Services\ImportExportSystem\EntityImporter;
@ -39,24 +39,24 @@ use Symfony\Component\Routing\Annotation\Route;
* @see \App\Tests\Controller\AdminPages\StorelocationControllerTest
*/
#[Route(path: '/store_location')]
class StorelocationController extends BaseAdminController
class StorageLocationController extends BaseAdminController
{
protected string $entity_class = Storelocation::class;
protected string $entity_class = StorageLocation::class;
protected string $twig_template = 'admin/storelocation_admin.html.twig';
protected string $form_class = StorelocationAdminForm::class;
protected string $route_base = 'store_location';
protected string $attachment_class = StorelocationAttachment::class;
protected ?string $parameter_class = StorelocationParameter::class;
protected string $attachment_class = StorageLocationAttachment::class;
protected ?string $parameter_class = StorageLocationParameter::class;
#[Route(path: '/{id}', name: 'store_location_delete', methods: ['DELETE'])]
public function delete(Request $request, Storelocation $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
public function delete(Request $request, StorageLocation $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{
return $this->_delete($request, $entity, $recursionHelper);
}
#[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'store_location_edit')]
#[Route(path: '/{id}', requirements: ['id' => '\d+'])]
public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
public function edit(StorageLocation $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{
return $this->_edit($entity, $request, $em, $timestamp);
}
@ -64,7 +64,7 @@ class StorelocationController extends BaseAdminController
#[Route(path: '/new', name: 'store_location_new')]
#[Route(path: '/{id}/clone', name: 'store_location_clone')]
#[Route(path: '/')]
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Storelocation $entity = null): Response
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?StorageLocation $entity = null): Response
{
return $this->_new($request, $em, $importer, $entity);
}
@ -76,7 +76,7 @@ class StorelocationController extends BaseAdminController
}
#[Route(path: '/{id}/export', name: 'store_location_export')]
public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request): Response
public function exportEntity(StorageLocation $entity, EntityExporter $exporter, Request $request): Response
{
return $this->_exportEntity($entity, $exporter, $request);
}

View file

@ -28,7 +28,7 @@ use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Orderdetail;
use App\Entity\ProjectSystem\Project;
@ -201,8 +201,8 @@ class PartController extends AbstractController
}
$store_id = $request->get('storelocation', null);
$storelocation = $store_id ? $em->find(Storelocation::class, $store_id) : null;
if ($storelocation instanceof Storelocation && $new_part->getPartLots()->isEmpty()) {
$storelocation = $store_id ? $em->find(StorageLocation::class, $store_id) : null;
if ($storelocation instanceof StorageLocation && $new_part->getPartLots()->isEmpty()) {
$partLot = new PartLot();
$partLot->setStorageLocation($storelocation);
$partLot->setInstockUnknown(true);

View file

@ -29,7 +29,7 @@ use App\DataTables\PartsDataTable;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Exceptions\InvalidRegexException;
use App\Form\Filters\PartFilterType;
@ -214,7 +214,7 @@ class PartListsController extends AbstractController
}
#[Route(path: '/store_location/{id}/parts', name: 'part_list_store_location')]
public function showStorelocation(Storelocation $storelocation, Request $request): Response
public function showStorelocation(StorageLocation $storelocation, Request $request): Response
{
$this->denyAccessUnlessGranted('@storelocations.read');
@ -226,7 +226,7 @@ class PartListsController extends AbstractController
$this->disableFormFieldAfterCreation($filterForm->get('storelocation')->get('value'));
}, [
'entity' => $storelocation,
'repo' => $this->entityManager->getRepository(Storelocation::class),
'repo' => $this->entityManager->getRepository(StorageLocation::class),
]
);
}

View file

@ -27,7 +27,7 @@ use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Services\Trees\ToolsTreeBuilder;
use App\Services\Trees\TreeViewGenerator;
@ -80,10 +80,10 @@ class TreeController extends AbstractController
#[Route(path: '/location/{id}', name: 'tree_location')]
#[Route(path: '/locations', name: 'tree_location_root')]
public function locationTree(?Storelocation $location = null): JsonResponse
public function locationTree(?StorageLocation $location = null): JsonResponse
{
if ($this->isGranted('@parts.read') && $this->isGranted('@storelocations.read')) {
$tree = $this->treeGenerator->getTreeView(Storelocation::class, $location, 'list_parts_root');
$tree = $this->treeGenerator->getTreeView(StorageLocation::class, $location, 'list_parts_root');
} else {
return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN);
}

View file

@ -34,7 +34,7 @@ use App\Entity\Parameters\GroupParameter;
use App\Entity\Parameters\ManufacturerParameter;
use App\Entity\Parameters\MeasurementUnitParameter;
use App\Entity\Parameters\PartParameter;
use App\Entity\Parameters\StorelocationParameter;
use App\Entity\Parameters\StorageLocationParameter;
use App\Entity\Parameters\SupplierParameter;
use App\Entity\Parts\Part;
use App\Entity\PriceInformations\Currency;
@ -102,7 +102,7 @@ class TypeaheadController extends AbstractController
'device' => ProjectParameter::class,
'footprint' => FootprintParameter::class,
'manufacturer' => ManufacturerParameter::class,
'storelocation' => StorelocationParameter::class,
'storelocation' => StorageLocationParameter::class,
'supplier' => SupplierParameter::class,
'attachment_type' => AttachmentTypeParameter::class,
'group' => GroupParameter::class,

View file

@ -29,7 +29,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\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\UserSystem\User;
use Doctrine\Bundle\FixturesBundle\Fixture;
@ -51,7 +51,7 @@ class DataStructureFixtures extends Fixture implements DependentFixtureInterface
{
//Reset autoincrement
$types = [AttachmentType::class, Project::class, Category::class, Footprint::class, Manufacturer::class,
MeasurementUnit::class, Storelocation::class, Supplier::class,];
MeasurementUnit::class, StorageLocation::class, Supplier::class,];
foreach ($types as $type) {
$this->createNodesForClass($type, $manager);

View file

@ -49,7 +49,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\ManufacturingStatus;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Orderdetail;
use App\Entity\PriceInformations\Pricedetail;
@ -94,14 +94,14 @@ class PartFixtures extends Fixture implements DependentFixtureInterface
$part->setCategory($manager->find(Category::class, 1));
$partLot1 = new PartLot();
$partLot1->setAmount(1.0);
$partLot1->setStorageLocation($manager->find(Storelocation::class, 1));
$partLot1->setStorageLocation($manager->find(StorageLocation::class, 1));
$part->addPartLot($partLot1);
$partLot2 = new PartLot();
$partLot2->setExpirationDate(new DateTime());
$partLot2->setComment('Test');
$partLot2->setNeedsRefill(true);
$partLot2->setStorageLocation($manager->find(Storelocation::class, 3));
$partLot2->setStorageLocation($manager->find(StorageLocation::class, 3));
$part->addPartLot($partLot2);
$orderdetail = new Orderdetail();

View file

@ -37,7 +37,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\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\UserSystem\User;
use App\Services\Trees\NodesListBuilder;
@ -118,7 +118,7 @@ class PartFilter implements FilterInterface
$this->lotCount = new IntConstraint('COUNT(partLots)');
$this->lessThanDesired = new LessThanDesiredConstraint();
$this->storelocation = new EntityConstraint($nodesListBuilder, Storelocation::class, 'partLots.storage_location');
$this->storelocation = new EntityConstraint($nodesListBuilder, StorageLocation::class, 'partLots.storage_location');
$this->lotNeedsRefill = new BooleanConstraint('partLots.needs_refill');
$this->lotUnknownAmount = new BooleanConstraint('partLots.instock_unknown');
$this->lotExpirationDate = new DateTimeConstraint('partLots.expiration_date');

View file

@ -34,7 +34,7 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
use Omines\DataTablesBundle\Adapter\Doctrine\Event\ORMAdapterQueryEvent;
use Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapterEvents;
use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\DataTables\Column\EntityColumn;
use App\DataTables\Column\IconLinkColumn;
use App\DataTables\Column\LocaleDateTimeColumn;
@ -147,7 +147,7 @@ final class PartsDataTable implements DataTableTypeInterface
$tmp = [];
foreach ($context->getPartLots() as $lot) {
//Ignore lots without storelocation
if (!$lot->getStorageLocation() instanceof Storelocation) {
if (!$lot->getStorageLocation() instanceof StorageLocation) {
continue;
}
$tmp[] = sprintf(

View file

@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Attachments;
use App\Entity\Parts\PartTraits\ProjectTrait;
use App\Repository\AttachmentRepository;
use App\EntityListeners\AttachmentDeleteListener;
use Doctrine\DBAL\Types\Types;
@ -42,7 +43,12 @@ use LogicException;
#[ORM\Entity(repositoryClass: AttachmentRepository::class)]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'class_name', type: 'string')]
#[ORM\DiscriminatorMap(['PartDB\Part' => 'PartAttachment', 'Part' => 'PartAttachment', 'PartDB\Device' => 'ProjectAttachment', 'Device' => 'ProjectAttachment', 'AttachmentType' => 'AttachmentTypeAttachment', 'Category' => 'CategoryAttachment', 'Footprint' => 'FootprintAttachment', 'Manufacturer' => 'ManufacturerAttachment', 'Currency' => 'CurrencyAttachment', 'Group' => 'GroupAttachment', 'MeasurementUnit' => 'MeasurementUnitAttachment', 'Storelocation' => 'StorelocationAttachment', 'Supplier' => 'SupplierAttachment', 'User' => 'UserAttachment', 'LabelProfile' => 'LabelAttachment'])]
#[ORM\DiscriminatorMap(['PartDB\Part' => PartAttachment::class, 'Part' => PartAttachment::class,
'PartDB\Device' => ProjectAttachment::class, 'Device' => ProjectAttachment::class, 'AttachmentType' => AttachmentTypeAttachment::class,
'Category' => CategoryAttachment::class, 'Footprint' => FootprintAttachment::class, 'Manufacturer' => ManufacturerAttachment::class,
'Currency' => CurrencyAttachment::class, 'Group' => GroupAttachment::class, 'MeasurementUnit' => MeasurementUnitAttachment::class,
'Storelocation' => StorageLocationAttachment::class, 'Supplier' => SupplierAttachment::class,
'User' => UserAttachment::class, 'LabelProfile' => LabelAttachment::class])]
#[ORM\EntityListeners([AttachmentDeleteListener::class])]
#[ORM\Table(name: '`attachments`')]
#[ORM\Index(name: 'attachments_idx_id_element_id_class_name', columns: ['id', 'element_id', 'class_name'])]

View file

@ -22,24 +22,24 @@ declare(strict_types=1);
namespace App\Entity\Attachments;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a measurement unit element.
* @extends Attachment<Storelocation>
* @extends Attachment<StorageLocation>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]
class StorelocationAttachment extends Attachment
class StorageLocationAttachment extends Attachment
{
final public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
final public const ALLOWED_ELEMENT_CLASS = StorageLocation::class;
/**
* @var Storelocation|null the element this attachment is associated with
* @var StorageLocation|null the element this attachment is associated with
*/
#[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'attachments')]
#[ORM\ManyToOne(targetEntity: StorageLocation::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -34,7 +34,7 @@ use App\Entity\Attachments\ManufacturerAttachment;
use App\Entity\Attachments\MeasurementUnitAttachment;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Attachments\UserAttachment;
use App\Entity\Parameters\AbstractParameter;
@ -46,7 +46,7 @@ use App\Entity\UserSystem\Group;
use App\Entity\Parts\Manufacturer;
use App\Entity\PriceInformations\Orderdetail;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\PartLot;
use App\Entity\PriceInformations\Currency;
use App\Entity\Parts\MeasurementUnit;
@ -67,7 +67,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
* Every database table which are managed with this class (or a subclass of it)
* must have the table row "id"!! The ID is the unique key to identify the elements.
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => AttachmentType::class, 'attachment' => Attachment::class, 'attachment_type_attachment' => AttachmentTypeAttachment::class, 'category_attachment' => CategoryAttachment::class, 'currency_attachment' => CurrencyAttachment::class, 'footprint_attachment' => FootprintAttachment::class, 'group_attachment' => GroupAttachment::class, 'label_attachment' => LabelAttachment::class, 'manufacturer_attachment' => ManufacturerAttachment::class, 'measurement_unit_attachment' => MeasurementUnitAttachment::class, 'part_attachment' => PartAttachment::class, 'project_attachment' => ProjectAttachment::class, 'storelocation_attachment' => StorelocationAttachment::class, 'supplier_attachment' => SupplierAttachment::class, 'user_attachment' => UserAttachment::class, 'category' => Category::class, 'project' => Project::class, 'project_bom_entry' => ProjectBOMEntry::class, 'footprint' => Footprint::class, 'group' => Group::class, 'manufacturer' => Manufacturer::class, 'orderdetail' => Orderdetail::class, 'part' => Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => Storelocation::class, 'part_lot' => PartLot::class, 'currency' => Currency::class, 'measurement_unit' => MeasurementUnit::class, 'parameter' => AbstractParameter::class, 'supplier' => Supplier::class, 'user' => User::class])]
#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => AttachmentType::class, 'attachment' => Attachment::class, 'attachment_type_attachment' => AttachmentTypeAttachment::class, 'category_attachment' => CategoryAttachment::class, 'currency_attachment' => CurrencyAttachment::class, 'footprint_attachment' => FootprintAttachment::class, 'group_attachment' => GroupAttachment::class, 'label_attachment' => LabelAttachment::class, 'manufacturer_attachment' => ManufacturerAttachment::class, 'measurement_unit_attachment' => MeasurementUnitAttachment::class, 'part_attachment' => PartAttachment::class, 'project_attachment' => ProjectAttachment::class, 'storelocation_attachment' => StorageLocationAttachment::class, 'supplier_attachment' => SupplierAttachment::class, 'user_attachment' => UserAttachment::class, 'category' => Category::class, 'project' => Project::class, 'project_bom_entry' => ProjectBOMEntry::class, 'footprint' => Footprint::class, 'group' => Group::class, 'manufacturer' => Manufacturer::class, 'orderdetail' => Orderdetail::class, 'part' => Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => StorageLocation::class, 'part_lot' => PartLot::class, 'currency' => Currency::class, 'measurement_unit' => MeasurementUnit::class, 'parameter' => AbstractParameter::class, 'supplier' => Supplier::class, 'user' => User::class])]
#[ORM\MappedSuperclass(repositoryClass: DBElementRepository::class)]
abstract class AbstractDBElement implements JsonSerializable
{

View file

@ -22,7 +22,7 @@ namespace App\Entity\LabelSystem;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
enum LabelSupportedElement: string
{
@ -39,7 +39,7 @@ enum LabelSupportedElement: string
return match ($this) {
self::PART => Part::class,
self::PART_LOT => PartLot::class,
self::STORELOCATION => Storelocation::class,
self::STORELOCATION => StorageLocation::class,
};
}
}

View file

@ -36,7 +36,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\PriceInformations\Orderdetail;

View file

@ -52,7 +52,7 @@ use App\Entity\Attachments\GroupAttachment;
use App\Entity\Attachments\ManufacturerAttachment;
use App\Entity\Attachments\MeasurementUnitAttachment;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Attachments\UserAttachment;
use App\Entity\Base\AbstractDBElement;
@ -69,14 +69,14 @@ use App\Entity\Parameters\GroupParameter;
use App\Entity\Parameters\ManufacturerParameter;
use App\Entity\Parameters\MeasurementUnitParameter;
use App\Entity\Parameters\PartParameter;
use App\Entity\Parameters\StorelocationParameter;
use App\Entity\Parameters\StorageLocationParameter;
use App\Entity\Parameters\SupplierParameter;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
@ -166,8 +166,8 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
return MeasurementUnitParameter::class;
case Part::class:
return PartParameter::class;
case Storelocation::class:
return StorelocationParameter::class;
case StorageLocation::class:
return StorageLocationParameter::class;
case Supplier::class:
return SupplierParameter::class;
@ -196,8 +196,8 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
return MeasurementUnitAttachment::class;
case Part::class:
return PartAttachment::class;
case Storelocation::class:
return StorelocationAttachment::class;
case StorageLocation::class:
return StorageLocationAttachment::class;
case Supplier::class:
return SupplierAttachment::class;
case User::class:

View file

@ -30,7 +30,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\PriceInformations\Orderdetail;
@ -81,7 +81,7 @@ enum LogTargetType: int
self::GROUP => Group::class,
self::MANUFACTURER => Manufacturer::class,
self::PART => Part::class,
self::STORELOCATION => Storelocation::class,
self::STORELOCATION => StorageLocation::class,
self::SUPPLIER => Supplier::class,
self::PART_LOT => PartLot::class,
self::CURRENCY => Currency::class,

View file

@ -41,6 +41,7 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
use App\Entity\Attachments\AttachmentTypeAttachment;
use App\Repository\ParameterRepository;
use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractDBElement;
@ -56,7 +57,10 @@ use function sprintf;
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'type', type: 'smallint')]
#[ORM\DiscriminatorMap([0 => 'CategoryParameter', 1 => 'CurrencyParameter', 2 => 'ProjectParameter', 3 => 'FootprintParameter', 4 => 'GroupParameter', 5 => 'ManufacturerParameter', 6 => 'MeasurementUnitParameter', 7 => 'PartParameter', 8 => 'StorelocationParameter', 9 => 'SupplierParameter', 10 => 'AttachmentTypeParameter'])]
#[ORM\DiscriminatorMap([0 => CategoryParameter::class, 1 => CurrencyParameter::class, 2 => ProjectParameter::class,
3 => FootprintParameter::class, 4 => GroupParameter::class, 5 => ManufacturerParameter::class,
6 => MeasurementUnitParameter::class, 7 => PartParameter::class, 8 => StorageLocationParameter::class,
9 => SupplierParameter::class, 10 => AttachmentTypeAttachment::class])]
#[ORM\Table('parameters')]
#[ORM\Index(name: 'parameter_name_idx', columns: ['name'])]
#[ORM\Index(name: 'parameter_group_idx', columns: ['param_group'])]

View file

@ -43,20 +43,20 @@ namespace App\Entity\Parameters;
use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class StorelocationParameter extends AbstractParameter
class StorageLocationParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
final public const ALLOWED_ELEMENT_CLASS = StorageLocation::class;
/**
* @var Storelocation the element this para is associated with
* @var StorageLocation the element this para is associated with
*/
#[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'parameters')]
#[ORM\ManyToOne(targetEntity: StorageLocation::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -97,13 +97,13 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
protected ?\DateTimeInterface $expiration_date = null;
/**
* @var Storelocation|null The storelocation of this lot
* @var StorageLocation|null The storelocation of this lot
*/
#[Groups(['simple', 'extended', 'full', 'import', 'part_lot:read', 'part_lot:write'])]
#[ORM\ManyToOne(targetEntity: Storelocation::class, fetch: 'EAGER')]
#[ORM\ManyToOne(targetEntity: StorageLocation::class, fetch: 'EAGER')]
#[ORM\JoinColumn(name: 'id_store_location')]
#[Selectable()]
protected ?Storelocation $storage_location = null;
protected ?StorageLocation $storage_location = null;
/**
* @var bool If this is set to true, the instock amount is marked as not known
@ -229,9 +229,9 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* Gets the storage location, where this part lot is stored.
*
* @return Storelocation|null The store location where this part is stored
* @return StorageLocation|null The store location where this part is stored
*/
public function getStorageLocation(): ?Storelocation
public function getStorageLocation(): ?StorageLocation
{
return $this->storage_location;
}
@ -239,7 +239,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* Sets the storage location, where this part lot is stored.
*/
public function setStorageLocation(?Storelocation $storage_location): self
public function setStorageLocation(?StorageLocation $storage_location): self
{
$this->storage_location = $storage_location;

View file

@ -22,14 +22,23 @@ declare(strict_types=1);
namespace App\Entity\Parts;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Link;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Serializer\Filter\PropertyFilter;
use App\Entity\Attachments\Attachment;
use App\Repository\Parts\StorelocationRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\StorelocationParameter;
use App\Entity\Parameters\StorageLocationParameter;
use App\Entity\UserSystem\User;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@ -38,13 +47,36 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* This entity represents a storage location, where parts can be stored.
* @extends AbstractPartsContainingDBElement<StorelocationAttachment, StorelocationParameter>
* @extends AbstractPartsContainingDBElement<StorageLocationAttachment, StorageLocationParameter>
*/
#[ORM\Entity(repositoryClass: StorelocationRepository::class)]
#[ORM\Table('`storelocations`')]
#[ORM\Index(name: 'location_idx_name', columns: ['name'])]
#[ORM\Index(name: 'location_idx_parent_name', columns: ['parent_id', 'name'])]
class Storelocation extends AbstractPartsContainingDBElement
#[ApiResource(
operations: [
new Get(security: 'is_granted("read", object)'),
new GetCollection(security: 'is_granted("@storelocations.read")'),
new Post(securityPostDenormalize: 'is_granted("create", object)'),
new Patch(security: 'is_granted("edit", object)'),
new Delete(security: 'is_granted("delete", object)'),
],
normalizationContext: ['groups' => ['location:read', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
denormalizationContext: ['groups' => ['location:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
)]
#[ApiResource(
uriTemplate: '/storage_locations/{id}/children.{_format}',
operations: [
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a storage location.'],
security: 'is_granted("@storelocations.read")')
],
uriVariables: [
'id' => new Link(fromProperty: 'children', fromClass: Manufacturer::class)
],
normalizationContext: ['groups' => ['location:read', 'api:basic:read'], 'openapi_definition_name' => 'Read']
)]
#[ApiFilter(PropertyFilter::class)]
class StorageLocation extends AbstractPartsContainingDBElement
{
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
#[ORM\OrderBy(['name' => 'ASC'])]
@ -61,10 +93,10 @@ class Storelocation extends AbstractPartsContainingDBElement
#[ORM\JoinColumn(name: 'storage_type_id')]
protected ?MeasurementUnit $storage_type = null;
/** @var Collection<int, StorelocationParameter>
/** @var Collection<int, StorageLocationParameter>
*/
#[Assert\Valid]
#[ORM\OneToMany(targetEntity: StorelocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(targetEntity: StorageLocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
@ -104,13 +136,13 @@ class Storelocation extends AbstractPartsContainingDBElement
protected bool $part_owner_must_match = false;
/**
* @var Collection<int, StorelocationAttachment>
* @var Collection<int, StorageLocationAttachment>
*/
#[Assert\Valid]
#[ORM\OneToMany(targetEntity: StorelocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(targetEntity: StorageLocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
protected Collection $attachments;
#[ORM\ManyToOne(targetEntity: StorelocationAttachment::class)]
#[ORM\ManyToOne(targetEntity: StorageLocationAttachment::class)]
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
protected ?Attachment $master_picture_attachment = null;
@ -186,7 +218,7 @@ class Storelocation extends AbstractPartsContainingDBElement
/**
* Sets the owner of this storage location
*/
public function setOwner(?User $owner): Storelocation
public function setOwner(?User $owner): StorageLocation
{
$this->owner = $owner;
return $this;
@ -203,7 +235,7 @@ class Storelocation extends AbstractPartsContainingDBElement
/**
* If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here.
*/
public function setPartOwnerMustMatch(bool $part_owner_must_match): Storelocation
public function setPartOwnerMustMatch(bool $part_owner_must_match): StorageLocation
{
$this->part_owner_must_match = $part_owner_must_match;
return $this;

View file

@ -32,7 +32,7 @@ use App\Entity\Attachments\FootprintAttachment;
use App\Entity\Attachments\GroupAttachment;
use App\Entity\Attachments\LabelAttachment;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Attachments\UserAttachment;
use App\Entity\Parts\Manufacturer;
@ -85,7 +85,7 @@ class AttachmentFilterType extends AbstractType
'label_profile.label' => LabelAttachment::class,
'manufacturer.label' => Manufacturer::class,
'measurement_unit.label' => MeasurementUnit::class,
'storelocation.label' => StorelocationAttachment::class,
'storelocation.label' => StorageLocationAttachment::class,
'supplier.label' => SupplierAttachment::class,
'user.label' => UserAttachment::class,
]

View file

@ -49,7 +49,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\PriceInformations\Orderdetail;

View file

@ -29,7 +29,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\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Form\Filters\Constraints\BooleanConstraintType;
use App\Form\Filters\Constraints\ChoiceConstraintType;
@ -191,7 +191,7 @@ class PartFilterType extends AbstractType
*/
$builder->add('storelocation', StructuralEntityConstraintType::class, [
'label' => 'storelocation.label',
'entity_class' => Storelocation::class
'entity_class' => StorageLocation::class
]);
$builder->add('minAmount', NumberConstraintType::class, [

View file

@ -50,7 +50,7 @@ use App\Entity\Parameters\FootprintParameter;
use App\Entity\Parameters\GroupParameter;
use App\Entity\Parameters\ManufacturerParameter;
use App\Entity\Parameters\PartParameter;
use App\Entity\Parameters\StorelocationParameter;
use App\Entity\Parameters\StorageLocationParameter;
use App\Entity\Parameters\SupplierParameter;
use App\Entity\Parts\MeasurementUnit;
use Symfony\Component\Form\AbstractType;
@ -163,7 +163,7 @@ class ParameterType extends AbstractType
GroupParameter::class => 'group',
ManufacturerParameter::class => 'manufacturer',
MeasurementUnit::class => 'measurement_unit',
StorelocationParameter::class => 'storelocation',
StorageLocationParameter::class => 'storelocation',
SupplierParameter::class => 'supplier',
];

View file

@ -25,7 +25,7 @@ namespace App\Form\Part;
use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Form\Type\SIUnitType;
use App\Form\Type\StructuralEntityType;
use App\Form\Type\UserSelectType;
@ -54,7 +54,7 @@ class PartLotType extends AbstractType
]);
$builder->add('storage_location', StructuralEntityType::class, [
'class' => Storelocation::class,
'class' => StorageLocation::class,
'label' => 'part_lot.edit.location',
'required' => false,
'disable_not_selectable' => true,

View file

@ -22,7 +22,7 @@ declare(strict_types=1);
*/
namespace App\Form\Type;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use Doctrine\ORM\EntityRepository;
@ -46,7 +46,7 @@ class PartLotSelectType extends AbstractType
$resolver->setDefaults([
'class' => PartLot::class,
'choice_label' => ChoiceList::label($this, static fn(PartLot $part_lot): string => ($part_lot->getStorageLocation() instanceof Storelocation ? $part_lot->getStorageLocation()->getFullPath() : '')
'choice_label' => ChoiceList::label($this, static fn(PartLot $part_lot): string => ($part_lot->getStorageLocation() instanceof StorageLocation ? $part_lot->getStorageLocation()->getFullPath() : '')
. ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount()),
'query_builder' => fn(Options $options) => static fn(EntityRepository $er) => $er->createQueryBuilder('l')
->where('l.part = :part')

View file

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace App\Repository\Parts;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Repository\AbstractPartsContainingRepository;
use Doctrine\ORM\QueryBuilder;
use InvalidArgumentException;
@ -37,7 +37,7 @@ class StorelocationRepository extends AbstractPartsContainingRepository
*/
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{
if (!$element instanceof Storelocation) {
if (!$element instanceof StorageLocation) {
throw new InvalidArgumentException('$element must be an Storelocation!');
}
@ -58,7 +58,7 @@ class StorelocationRepository extends AbstractPartsContainingRepository
public function getPartsCount(object $element): int
{
if (!$element instanceof Storelocation) {
if (!$element instanceof StorageLocation) {
throw new InvalidArgumentException('$element must be an Storelocation!');
}

View file

@ -35,7 +35,7 @@ use App\Entity\Attachments\ManufacturerAttachment;
use App\Entity\Attachments\MeasurementUnitAttachment;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Attachments\UserAttachment;
use RuntimeException;
@ -94,7 +94,7 @@ final class AttachmentVoter extends Voter
$param = 'measurement_units';
} elseif (is_a($subject, PartAttachment::class, true)) {
$param = 'parts';
} elseif (is_a($subject, StorelocationAttachment::class, true)) {
} elseif (is_a($subject, StorageLocationAttachment::class, true)) {
$param = 'storelocations';
} elseif (is_a($subject, SupplierAttachment::class, true)) {
$param = 'suppliers';

View file

@ -35,7 +35,7 @@ use App\Entity\Parameters\GroupParameter;
use App\Entity\Parameters\ManufacturerParameter;
use App\Entity\Parameters\MeasurementUnitParameter;
use App\Entity\Parameters\PartParameter;
use App\Entity\Parameters\StorelocationParameter;
use App\Entity\Parameters\StorageLocationParameter;
use App\Entity\Parameters\SupplierParameter;
use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
@ -96,7 +96,7 @@ final class ParameterVoter extends Voter
$param = 'measurement_units';
} elseif (is_a($subject, PartParameter::class, true)) {
$param = 'parts';
} elseif (is_a($subject, StorelocationParameter::class, true)) {
} elseif (is_a($subject, StorageLocationParameter::class, true)) {
$param = 'storelocations';
} elseif (is_a($subject, SupplierParameter::class, true)) {
$param = 'suppliers';

View file

@ -28,7 +28,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\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\User;
@ -47,7 +47,7 @@ final class StructureVoter extends Voter
Project::class => 'projects',
Footprint::class => 'footprints',
Manufacturer::class => 'manufacturers',
Storelocation::class => 'storelocations',
StorageLocation::class => 'storelocations',
Supplier::class => 'suppliers',
Currency::class => 'currencies',
MeasurementUnit::class => 'measurement_units',

View file

@ -24,7 +24,7 @@ namespace App\Serializer;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Orderdetail;
use App\Entity\PriceInformations\Pricedetail;
@ -148,7 +148,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface
}
if (isset($data['storelocation']) && $data['storelocation'] !== "") {
$location = $this->locationDenormalizer->denormalize($data['storelocation'], Storelocation::class, $format, $context);
$location = $this->locationDenormalizer->denormalize($data['storelocation'], StorageLocation::class, $format, $context);
$partLot->setStorageLocation($location);
}

View file

@ -35,7 +35,7 @@ use App\Entity\Attachments\GroupAttachment;
use App\Entity\Attachments\ManufacturerAttachment;
use App\Entity\Attachments\MeasurementUnitAttachment;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Attachments\UserAttachment;
use App\Exceptions\AttachmentDownloadException;
@ -81,7 +81,7 @@ class AttachmentSubmitHandler
GroupAttachment::class => 'group',
ManufacturerAttachment::class => 'manufacturer',
MeasurementUnitAttachment::class => 'measurement_unit',
StorelocationAttachment::class => 'storelocation',
StorageLocationAttachment::class => 'storelocation',
SupplierAttachment::class => 'supplier',
UserAttachment::class => 'user',
LabelAttachment::class => 'label_profile',

View file

@ -25,7 +25,7 @@ namespace App\Services\Attachments;
use App\Entity\Parts\Footprint;
use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Manufacturer;
use App\Entity\Attachments\Attachment;
@ -88,7 +88,7 @@ class PartPreviewGenerator
}
foreach ($part->getPartLots() as $lot) {
if ($lot->getStorageLocation() instanceof Storelocation) {
if ($lot->getStorageLocation() instanceof StorageLocation) {
$attachment = $lot->getStorageLocation()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
$list[] = $attachment;

View file

@ -37,7 +37,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\PriceInformations\Orderdetail;
@ -71,7 +71,7 @@ class ElementTypeNameGenerator
MeasurementUnit::class => $this->translator->trans('measurement_unit.label'),
Part::class => $this->translator->trans('part.label'),
PartLot::class => $this->translator->trans('part_lot.label'),
Storelocation::class => $this->translator->trans('storelocation.label'),
StorageLocation::class => $this->translator->trans('storelocation.label'),
Supplier::class => $this->translator->trans('supplier.label'),
Currency::class => $this->translator->trans('currency.label'),
Orderdetail::class => $this->translator->trans('orderdetail.label'),

View file

@ -35,7 +35,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\PriceInformations\Orderdetail;
@ -102,7 +102,7 @@ class EntityURLGenerator
Project::class => 'project_edit',
Supplier::class => 'supplier_edit',
Manufacturer::class => 'manufacturer_edit',
Storelocation::class => 'store_location_edit',
StorageLocation::class => 'store_location_edit',
Footprint::class => 'footprint_edit',
User::class => 'user_edit',
Currency::class => 'currency_edit',
@ -199,7 +199,7 @@ class EntityURLGenerator
Project::class => 'project_info',
Supplier::class => 'supplier_edit',
Manufacturer::class => 'manufacturer_edit',
Storelocation::class => 'store_location_edit',
StorageLocation::class => 'store_location_edit',
Footprint::class => 'footprint_edit',
User::class => 'user_edit',
Currency::class => 'currency_edit',
@ -229,7 +229,7 @@ class EntityURLGenerator
Project::class => 'project_edit',
Supplier::class => 'supplier_edit',
Manufacturer::class => 'manufacturer_edit',
Storelocation::class => 'store_location_edit',
StorageLocation::class => 'store_location_edit',
Footprint::class => 'footprint_edit',
User::class => 'user_edit',
Currency::class => 'currency_edit',
@ -260,7 +260,7 @@ class EntityURLGenerator
Project::class => 'project_new',
Supplier::class => 'supplier_new',
Manufacturer::class => 'manufacturer_new',
Storelocation::class => 'store_location_new',
StorageLocation::class => 'store_location_new',
Footprint::class => 'footprint_new',
User::class => 'user_new',
Currency::class => 'currency_new',
@ -291,7 +291,7 @@ class EntityURLGenerator
Project::class => 'device_clone',
Supplier::class => 'supplier_clone',
Manufacturer::class => 'manufacturer_clone',
Storelocation::class => 'store_location_clone',
StorageLocation::class => 'store_location_clone',
Footprint::class => 'footprint_clone',
User::class => 'user_clone',
Currency::class => 'currency_clone',
@ -321,7 +321,7 @@ class EntityURLGenerator
Footprint::class => 'part_list_footprint',
Manufacturer::class => 'part_list_manufacturer',
Supplier::class => 'part_list_supplier',
Storelocation::class => 'part_list_store_location',
StorageLocation::class => 'part_list_store_location',
];
return $this->urlGenerator->generate($this->mapToController($map, $entity), ['id' => $entity->getID()]);
@ -336,7 +336,7 @@ class EntityURLGenerator
Project::class => 'project_delete',
Supplier::class => 'supplier_delete',
Manufacturer::class => 'manufacturer_delete',
Storelocation::class => 'store_location_delete',
StorageLocation::class => 'store_location_delete',
Footprint::class => 'footprint_delete',
User::class => 'user_delete',
Currency::class => 'currency_delete',

View file

@ -25,7 +25,7 @@ namespace App\Services\ImportExportSystem\PartKeeprImporter;
use App\Doctrine\Purger\ResetAutoIncrementORMPurger;
use App\Entity\Attachments\FootprintAttachment;
use App\Entity\Attachments\ManufacturerAttachment;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Contracts\TimeStampableInterface;
@ -36,7 +36,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
@ -263,9 +263,9 @@ class PKDatastructureImporter
public function importStorelocations(array $data): int
{
$count = $this->importElementsWithCategory($data, Storelocation::class, 'storagelocation');
$count = $this->importElementsWithCategory($data, StorageLocation::class, 'storagelocation');
$this->importAttachments($data, 'storagelocationimage', Storelocation::class, 'storageLocation_id', StorelocationAttachment::class);
$this->importAttachments($data, 'storagelocationimage', StorageLocation::class, 'storageLocation_id', StorageLocationAttachment::class);
return $count;
}

View file

@ -30,7 +30,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\PriceInformations\Orderdetail;
@ -93,7 +93,7 @@ class PKPartImporter
//Create a part lot to store the stock level and location
$lot = new PartLot();
$lot->setAmount((float) ($part['stockLevel'] ?? 0));
$this->setAssociationField($lot, 'storage_location', Storelocation::class, $part['storageLocation_id']);
$this->setAssociationField($lot, 'storage_location', StorageLocation::class, $part['storageLocation_id']);
$entity->addPartLot($lot);
//For partCondition, productionsRemarks and Status, create a custom parameter

View file

@ -44,7 +44,7 @@ namespace App\Services\LabelSystem\Barcodes;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use InvalidArgumentException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@ -56,13 +56,13 @@ final class BarcodeContentGenerator
public const PREFIX_MAP = [
Part::class => 'P',
PartLot::class => 'L',
Storelocation::class => 'S',
StorageLocation::class => 'S',
];
private const URL_MAP = [
Part::class => 'part',
PartLot::class => 'lot',
Storelocation::class => 'location',
StorageLocation::class => 'location',
];
public function __construct(private readonly UrlGeneratorInterface $urlGenerator)

View file

@ -49,7 +49,7 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\ManufacturingStatus;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\UserSystem\User;
use DateTime;
use InvalidArgumentException;
@ -98,23 +98,23 @@ final class LabelExampleElementsGenerator
$lot->setDescription('Example Lot');
$lot->setComment('Lot comment');
$lot->setExpirationDate(new DateTime('+1 days'));
$lot->setStorageLocation($this->getStructuralData(Storelocation::class));
$lot->setStorageLocation($this->getStructuralData(StorageLocation::class));
$lot->setAmount(123);
$lot->setOwner($this->getUser());
return $lot;
}
private function getStorelocation(): Storelocation
private function getStorelocation(): StorageLocation
{
$storelocation = new Storelocation();
$storelocation = new StorageLocation();
$storelocation->setName('Location 1');
$storelocation->setComment('Example comment');
$storelocation->updateTimestamps();
$storelocation->setOwner($this->getUser());
$parent = new Storelocation();
$parent = new StorageLocation();
$parent->setName('Parent');
$storelocation->setParent($parent);

View file

@ -44,7 +44,7 @@ namespace App\Services\LabelSystem;
use App\Entity\LabelSystem\LabelOptions;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use Dompdf\Dompdf;
use InvalidArgumentException;
use Jbtronics\DompdfFontLoaderBundle\Services\DompdfFactoryInterface;

View file

@ -41,7 +41,7 @@ declare(strict_types=1);
namespace App\Services\LabelSystem\PlaceholderProviders;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\UserSystem\User;
use App\Entity\Parts\PartLot;
use App\Services\Formatters\AmountFormatter;
@ -95,11 +95,11 @@ final class PartLotProvider implements PlaceholderProviderInterface
}
if ('[[LOCATION]]' === $placeholder) {
return $label_target->getStorageLocation() instanceof Storelocation ? $label_target->getStorageLocation()->getName() : '';
return $label_target->getStorageLocation() instanceof StorageLocation ? $label_target->getStorageLocation()->getName() : '';
}
if ('[[LOCATION_FULL]]' === $placeholder) {
return $label_target->getStorageLocation() instanceof Storelocation ? $label_target->getStorageLocation()->getFullPath() : '';
return $label_target->getStorageLocation() instanceof StorageLocation ? $label_target->getStorageLocation()->getFullPath() : '';
}
if ('[[OWNER]]' === $placeholder) {

View file

@ -23,13 +23,13 @@ declare(strict_types=1);
namespace App\Services\LabelSystem\PlaceholderProviders;
use App\Entity\UserSystem\User;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
class StorelocationProvider implements PlaceholderProviderInterface
{
public function replace(string $placeholder, object $label_target, array $options = []): ?string
{
if ($label_target instanceof Storelocation) {
if ($label_target instanceof StorageLocation) {
if ('[[OWNER]]' === $placeholder) {
return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getFullName() : '';
}

View file

@ -54,7 +54,7 @@ use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\PriceInformations\Orderdetail;
@ -101,7 +101,7 @@ final class SandboxedTwigProvider
MeasurementUnit::class => ['getUnit', 'isInteger', 'useSIPrefix'],
PartLot::class => ['isExpired', 'getDescription', 'getComment', 'getExpirationDate', 'getStorageLocation',
'getPart', 'isInstockUnknown', 'getAmount', 'getNeedsRefill', ],
Storelocation::class => ['isFull', 'isOnlySinglePart', 'isLimitToExistingParts', 'getStorageType'],
StorageLocation::class => ['isFull', 'isOnlySinglePart', 'isLimitToExistingParts', 'getStorageType'],
Supplier::class => ['getShippingCosts', 'getDefaultCurrency'],
Part::class => ['isNeedsReview', 'getTags', 'getMass', 'getDescription', 'isFavorite', 'getCategory',
'getFootprint', 'getPartLots', 'getPartUnit', 'useFloatAmount', 'getMinAmount', 'getAmountSum',

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Services\Parts;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\LogSystem\PartStockChangedLogEntry;
use App\Entity\Parts\PartLot;
use App\Services\LogSystem\EventCommentHelper;
@ -30,7 +30,7 @@ final class PartLotWithdrawAddHelper
}
//So far all other restrictions are defined at the storelocation level
if(!$partLot->getStorageLocation() instanceof Storelocation) {
if(!$partLot->getStorageLocation() instanceof StorageLocation) {
return true;
}
//We can not add parts if the storage location of the lot is marked as full

View file

@ -49,7 +49,7 @@ use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Repository\AttachmentRepository;
@ -113,7 +113,7 @@ class StatisticsHelper
'footprint' => Footprint::class,
'manufacturer' => Manufacturer::class,
'measurement_unit' => MeasurementUnit::class,
'storelocation' => Storelocation::class,
'storelocation' => StorageLocation::class,
'supplier' => Supplier::class,
'currency' => Currency::class,
];

View file

@ -31,7 +31,7 @@ use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
@ -182,7 +182,7 @@ class ToolsTreeBuilder
$this->urlGenerator->generate('manufacturer_new')
))->setIcon('fa-fw fa-treeview fa-solid fa-industry');
}
if ($this->security->isGranted('read', new Storelocation())) {
if ($this->security->isGranted('read', new StorageLocation())) {
$nodes[] = (new TreeViewNode(
$this->translator->trans('tree.tools.edit.storelocation'),
$this->urlGenerator->generate('store_location_new')

View file

@ -29,7 +29,7 @@ use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Helpers\Trees\TreeViewNode;
use App\Helpers\Trees\TreeViewNodeIterator;
@ -142,7 +142,7 @@ class TreeViewGenerator
{
return match ($class) {
Category::class => $this->translator->trans('category.labelp'),
Storelocation::class => $this->translator->trans('storelocation.labelp'),
StorageLocation::class => $this->translator->trans('storelocation.labelp'),
Footprint::class => $this->translator->trans('footprint.labelp'),
Manufacturer::class => $this->translator->trans('manufacturer.labelp'),
Supplier::class => $this->translator->trans('supplier.labelp'),
@ -156,7 +156,7 @@ class TreeViewGenerator
$icon = "fa-fw fa-treeview fa-solid ";
return match ($class) {
Category::class => $icon . 'fa-tags',
Storelocation::class => $icon . 'fa-cube',
StorageLocation::class => $icon . 'fa-cube',
Footprint::class => $icon . 'fa-microchip',
Manufacturer::class => $icon . 'fa-industry',
Supplier::class => $icon . 'fa-truck',

View file

@ -31,7 +31,7 @@ use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
@ -104,7 +104,7 @@ final class EntityExtension extends AbstractExtension
$map = [
Part::class => 'part',
Footprint::class => 'footprint',
Storelocation::class => 'storelocation',
StorageLocation::class => 'storelocation',
Manufacturer::class => 'manufacturer',
Category::class => 'category',
Project::class => 'device',

View file

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace App\Validator\Constraints;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
@ -53,8 +53,8 @@ class ValidPartLotValidator extends ConstraintValidator
}
//We can only validate the values if we know the storelocation
if ($value->getStorageLocation() instanceof Storelocation) {
$repo = $this->em->getRepository(Storelocation::class);
if ($value->getStorageLocation() instanceof StorageLocation) {
$repo = $this->em->getRepository(StorageLocation::class);
//We can only determine associated parts, if the part have an ID
//When the storage location is new (no ID), we can just assume there are no other parts
if (null !== $value->getID() && $value->getStorageLocation()->getID()) {

View file

@ -22,7 +22,7 @@ declare(strict_types=1);
namespace App\Tests\Controller\AdminPages;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
/**
* @group slow
@ -31,5 +31,5 @@ use App\Entity\Parts\Storelocation;
class StorelocationControllerTest extends AbstractAdminControllerTest
{
protected static string $base_path = '/en/store_location';
protected static string $entity_class = Storelocation::class;
protected static string $entity_class = StorageLocation::class;
}

View file

@ -33,7 +33,7 @@ use App\Entity\Attachments\GroupAttachment;
use App\Entity\Attachments\ManufacturerAttachment;
use App\Entity\Attachments\MeasurementUnitAttachment;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\StorageLocationAttachment;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Attachments\UserAttachment;
use App\Entity\ProjectSystem\Project;
@ -42,7 +42,7 @@ use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
@ -84,7 +84,7 @@ class AttachmentTest extends TestCase
[ManufacturerAttachment::class, Manufacturer::class],
[MeasurementUnitAttachment::class, MeasurementUnit::class],
[PartAttachment::class, Part::class],
[StorelocationAttachment::class, Storelocation::class],
[StorageLocationAttachment::class, StorageLocation::class],
[SupplierAttachment::class, Supplier::class],
[UserAttachment::class, User::class],
];

View file

@ -52,7 +52,7 @@ use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;

View file

@ -43,7 +43,7 @@ namespace App\Tests\Services\LabelSystem\Barcodes;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@ -62,7 +62,7 @@ class BarcodeContentGeneratorTest extends KernelTestCase
return [
['P0000', Part::class],
['L0000', PartLot::class],
['S0000', Storelocation::class],
['S0000', StorageLocation::class],
];
}
@ -71,7 +71,7 @@ class BarcodeContentGeneratorTest extends KernelTestCase
return [
['/scan/part/0', Part::class],
['/scan/lot/0', PartLot::class],
['/scan/location/0', Storelocation::class],
['/scan/location/0', StorageLocation::class],
];
}

View file

@ -46,7 +46,7 @@ use App\Entity\LabelSystem\LabelOptions;
use App\Entity\LabelSystem\LabelSupportedElement;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Services\LabelSystem\LabelGenerator;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@ -68,7 +68,7 @@ class LabelGeneratorTest extends WebTestCase
return [
[LabelSupportedElement::PART, Part::class],
[LabelSupportedElement::PART_LOT, PartLot::class],
[LabelSupportedElement::STORELOCATION, Storelocation::class],
[LabelSupportedElement::STORELOCATION, StorageLocation::class],
];
}

View file

@ -43,7 +43,7 @@ namespace App\Tests\Services\LabelSystem\PlaceholderProviders;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\UserSystem\User;
use App\Services\LabelSystem\PlaceholderProviders\PartLotProvider;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@ -68,9 +68,9 @@ class PartLotProviderTest extends WebTestCase
$this->target->setExpirationDate(new \DateTime('1999-04-13'));
$this->target->setInstockUnknown(true);
$location = new Storelocation();
$location = new StorageLocation();
$location->setName('Location');
$location->setParent((new Storelocation())->setName('Parent'));
$location->setParent((new StorageLocation())->setName('Parent'));
$this->target->setStorageLocation($location);
$part = new Part();

View file

@ -46,7 +46,7 @@ use App\Entity\LabelSystem\LabelProcessMode;
use App\Entity\LabelSystem\LabelSupportedElement;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Services\LabelSystem\SandboxedTwigProvider;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Twig\Sandbox\SecurityError;
@ -114,7 +114,7 @@ class SandboxedTwigProviderTest extends WebTestCase
$str = $twig->render('lines', [
'part' => new Part(),
'lot' => new PartLot(),
'location' => new Storelocation(),
'location' => new StorageLocation(),
]);
$this->assertIsString($str);
@ -136,7 +136,7 @@ class SandboxedTwigProviderTest extends WebTestCase
$str = $twig->render('lines', [
'part' => new Part(),
'lot' => new PartLot(),
'location' => new Storelocation(),
'location' => new StorageLocation(),
]);
$this->assertIsString($str);

View file

@ -6,7 +6,7 @@ namespace App\Tests\Services\Parts;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Services\Parts\PartLotWithdrawAddHelper;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@ -29,10 +29,10 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
/** @var Part */
private Part $part;
/** @var Storelocation */
private Storelocation $storageLocation;
/** @var Storelocation */
private Storelocation $full_storageLocation;
/** @var StorageLocation */
private StorageLocation $storageLocation;
/** @var StorageLocation */
private StorageLocation $full_storageLocation;
/** @var PartLot */
private PartLot $partLot1;
@ -59,8 +59,8 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
{
$this->part = new Part();
$this->storageLocation = new Storelocation();
$this->full_storageLocation = new Storelocation();
$this->storageLocation = new StorageLocation();
$this->full_storageLocation = new StorageLocation();
$this->full_storageLocation->setIsFull(true);
$this->partLot1 = new TestPartLot();

View file

@ -30,7 +30,7 @@ use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
@ -56,7 +56,7 @@ class EntityExtensionTest extends WebTestCase
{
$this->assertSame('part', $this->service->getEntityType(new Part()));
$this->assertSame('footprint', $this->service->getEntityType(new Footprint()));
$this->assertSame('storelocation', $this->service->getEntityType(new Storelocation()));
$this->assertSame('storelocation', $this->service->getEntityType(new StorageLocation()));
$this->assertSame('manufacturer', $this->service->getEntityType(new Manufacturer()));
$this->assertSame('category', $this->service->getEntityType(new Category()));
$this->assertSame('device', $this->service->getEntityType(new Project()));