Added some basic DB fields for the new project system

This commit is contained in:
Jan Böhmer 2022-12-18 20:34:25 +01:00
parent 8ae4e9fe05
commit 0c7ec9f0c7
36 changed files with 281 additions and 130 deletions

View file

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221218192108 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE device_parts ADD name LONGTEXT NOT NULL, ADD comment LONGTEXT NOT NULL, ADD last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, ADD datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CHANGE quantity quantity DOUBLE PRECISION NOT NULL');
$this->addSql('ALTER TABLE devices ADD description LONGTEXT NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE devices DROP description');
$this->addSql('ALTER TABLE device_parts DROP name, DROP comment, DROP last_modified, DROP datetime_added, CHANGE quantity quantity INT NOT NULL');
}
}

View file

@ -24,7 +24,7 @@ namespace App\Command\Migrations;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\MeasurementUnit;
@ -94,7 +94,7 @@ class ConvertBBCodeCommand extends Command
Part::class => ['description', 'comment'], Part::class => ['description', 'comment'],
AttachmentType::class => ['comment'], AttachmentType::class => ['comment'],
Storelocation::class => ['comment'], Storelocation::class => ['comment'],
Device::class => ['comment'], Project::class => ['comment'],
Category::class => ['comment'], Category::class => ['comment'],
Manufacturer::class => ['comment'], Manufacturer::class => ['comment'],
MeasurementUnit::class => ['comment'], MeasurementUnit::class => ['comment'],

View file

@ -22,10 +22,11 @@ declare(strict_types=1);
namespace App\Controller\AdminPages; namespace App\Controller\AdminPages;
use App\Entity\Attachments\DeviceAttachment; use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parameters\DeviceParameter; use App\Entity\Parameters\ProjectParameter;
use App\Form\AdminPages\BaseEntityAdminForm; use App\Form\AdminPages\BaseEntityAdminForm;
use App\Form\AdminPages\ProjectAdminForm;
use App\Services\ImportExportSystem\EntityExporter; use App\Services\ImportExportSystem\EntityExporter;
use App\Services\ImportExportSystem\EntityImporter; use App\Services\ImportExportSystem\EntityImporter;
use App\Services\Trees\StructuralElementRecursionHelper; use App\Services\Trees\StructuralElementRecursionHelper;
@ -38,19 +39,19 @@ use Symfony\Component\Routing\Annotation\Route;
/** /**
* @Route("/device") * @Route("/device")
*/ */
class DeviceController extends BaseAdminController class ProjectAdminController extends BaseAdminController
{ {
protected $entity_class = Device::class; protected $entity_class = Project::class;
protected $twig_template = 'AdminPages/DeviceAdmin.html.twig'; protected $twig_template = 'AdminPages/DeviceAdmin.html.twig';
protected $form_class = BaseEntityAdminForm::class; protected $form_class = ProjectAdminForm::class;
protected $route_base = 'device'; protected $route_base = 'device';
protected $attachment_class = DeviceAttachment::class; protected $attachment_class = ProjectAttachment::class;
protected $parameter_class = DeviceParameter::class; protected $parameter_class = ProjectParameter::class;
/** /**
* @Route("/{id}", name="device_delete", methods={"DELETE"}) * @Route("/{id}", name="device_delete", methods={"DELETE"})
*/ */
public function delete(Request $request, Device $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Project $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
@ -59,7 +60,7 @@ class DeviceController extends BaseAdminController
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="device_edit") * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="device_edit")
* @Route("/{id}", requirements={"id"="\d+"}) * @Route("/{id}", requirements={"id"="\d+"})
*/ */
public function edit(Device $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(Project $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
@ -69,7 +70,7 @@ class DeviceController extends BaseAdminController
* @Route("/{id}/clone", name="device_clone") * @Route("/{id}/clone", name="device_clone")
* @Route("/") * @Route("/")
*/ */
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Device $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Project $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
@ -85,7 +86,7 @@ class DeviceController extends BaseAdminController
/** /**
* @Route("/{id}/export", name="device_export") * @Route("/{id}/export", name="device_export")
*/ */
public function exportEntity(Device $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(Project $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);
} }

View file

@ -22,7 +22,7 @@ declare(strict_types=1);
namespace App\Controller; namespace App\Controller;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Manufacturer;
@ -136,10 +136,10 @@ class TreeController extends AbstractController
* @Route("/device/{id}", name="tree_device") * @Route("/device/{id}", name="tree_device")
* @Route("/devices", name="tree_device_root") * @Route("/devices", name="tree_device_root")
*/ */
public function deviceTree(?Device $device = null): JsonResponse public function deviceTree(?Project $device = null): JsonResponse
{ {
if ($this->isGranted('@devices.read')) { if ($this->isGranted('@devices.read')) {
$tree = $this->treeGenerator->getTreeView(Device::class, $device, 'devices'); $tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices');
} else { } else {
return new JsonResponse("Access denied", 403); return new JsonResponse("Access denied", 403);
} }

View file

@ -24,7 +24,7 @@ namespace App\Controller;
use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\AttachmentTypeParameter;
use App\Entity\Parameters\CategoryParameter; use App\Entity\Parameters\CategoryParameter;
use App\Entity\Parameters\DeviceParameter; use App\Entity\Parameters\ProjectParameter;
use App\Entity\Parameters\FootprintParameter; use App\Entity\Parameters\FootprintParameter;
use App\Entity\Parameters\GroupParameter; use App\Entity\Parameters\GroupParameter;
use App\Entity\Parameters\ManufacturerParameter; use App\Entity\Parameters\ManufacturerParameter;
@ -105,7 +105,7 @@ class TypeaheadController extends AbstractController
case 'part': case 'part':
return PartParameter::class; return PartParameter::class;
case 'device': case 'device':
return DeviceParameter::class; return ProjectParameter::class;
case 'footprint': case 'footprint':
return FootprintParameter::class; return FootprintParameter::class;
case 'manufacturer': case 'manufacturer':

View file

@ -24,7 +24,7 @@ namespace App\DataFixtures;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Manufacturer;
@ -51,7 +51,7 @@ class DataStructureFixtures extends Fixture
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
//Reset autoincrement //Reset autoincrement
$types = [AttachmentType::class, Device::class, Category::class, Footprint::class, Manufacturer::class, $types = [AttachmentType::class, Project::class, Category::class, Footprint::class, Manufacturer::class,
MeasurementUnit::class, Storelocation::class, Supplier::class, ]; MeasurementUnit::class, Storelocation::class, Supplier::class, ];
foreach ($types as $type) { foreach ($types as $type) {

View file

@ -44,7 +44,7 @@ use LogicException;
* @ORM\DiscriminatorColumn(name="class_name", type="string") * @ORM\DiscriminatorColumn(name="class_name", type="string")
* @ORM\DiscriminatorMap({ * @ORM\DiscriminatorMap({
* "PartDB\Part" = "PartAttachment", "Part" = "PartAttachment", * "PartDB\Part" = "PartAttachment", "Part" = "PartAttachment",
* "PartDB\Device" = "DeviceAttachment", "Device" = "DeviceAttachment", * "PartDB\Device" = "ProjectAttachment", "Device" = "ProjectAttachment",
* "AttachmentType" = "AttachmentTypeAttachment", "Category" = "CategoryAttachment", * "AttachmentType" = "AttachmentTypeAttachment", "Category" = "CategoryAttachment",
* "Footprint" = "FootprintAttachment", "Manufacturer" = "ManufacturerAttachment", * "Footprint" = "FootprintAttachment", "Manufacturer" = "ManufacturerAttachment",
* "Currency" = "CurrencyAttachment", "Group" = "GroupAttachment", * "Currency" = "CurrencyAttachment", "Group" = "GroupAttachment",

View file

@ -22,7 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Attachments; namespace App\Entity\Attachments;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@ -32,12 +32,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"}) * @UniqueEntity({"name", "attachment_type", "element"})
*/ */
class DeviceAttachment extends Attachment class ProjectAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Device::class; public const ALLOWED_ELEMENT_CLASS = Project::class;
/** /**
* @var Device the element this attachment is associated with * @var Project the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="attachments") * @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/ */
protected ?AttachmentContainingDBElement $element = null; protected ?AttachmentContainingDBElement $element = null;

View file

@ -29,6 +29,7 @@ use Doctrine\ORM\Mapping as ORM;
* *
* @ORM\MappedSuperclass(repositoryClass="App\Repository\AbstractPartsContainingRepository") * @ORM\MappedSuperclass(repositoryClass="App\Repository\AbstractPartsContainingRepository")
*/ */
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement abstract class
AbstractPartsContainingDBElement extends AbstractStructuralDBElement
{ {
} }

View file

@ -25,8 +25,8 @@ namespace App\Entity\LogSystem;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Devices\DevicePart; use App\Entity\ProjectSystem\ProjectBOMEntry;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use App\Entity\Parameters\AbstractParameter; use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
@ -124,8 +124,8 @@ abstract class AbstractLogEntry extends AbstractDBElement
self::TARGET_TYPE_ATTACHEMENT => Attachment::class, self::TARGET_TYPE_ATTACHEMENT => Attachment::class,
self::TARGET_TYPE_ATTACHEMENTTYPE => AttachmentType::class, self::TARGET_TYPE_ATTACHEMENTTYPE => AttachmentType::class,
self::TARGET_TYPE_CATEGORY => Category::class, self::TARGET_TYPE_CATEGORY => Category::class,
self::TARGET_TYPE_DEVICE => Device::class, self::TARGET_TYPE_DEVICE => Project::class,
self::TARGET_TYPE_DEVICEPART => DevicePart::class, self::TARGET_TYPE_DEVICEPART => ProjectBOMEntry::class,
self::TARGET_TYPE_FOOTPRINT => Footprint::class, self::TARGET_TYPE_FOOTPRINT => Footprint::class,
self::TARGET_TYPE_GROUP => Group::class, self::TARGET_TYPE_GROUP => Group::class,
self::TARGET_TYPE_MANUFACTURER => Manufacturer::class, self::TARGET_TYPE_MANUFACTURER => Manufacturer::class,

View file

@ -46,7 +46,7 @@ use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\AttachmentTypeAttachment;
use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CategoryAttachment;
use App\Entity\Attachments\CurrencyAttachment; use App\Entity\Attachments\CurrencyAttachment;
use App\Entity\Attachments\DeviceAttachment; use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\FootprintAttachment;
use App\Entity\Attachments\GroupAttachment; use App\Entity\Attachments\GroupAttachment;
use App\Entity\Attachments\ManufacturerAttachment; use App\Entity\Attachments\ManufacturerAttachment;
@ -58,12 +58,12 @@ use App\Entity\Attachments\UserAttachment;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
use App\Entity\Contracts\LogWithEventUndoInterface; use App\Entity\Contracts\LogWithEventUndoInterface;
use App\Entity\Contracts\NamedElementInterface; use App\Entity\Contracts\NamedElementInterface;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parameters\AbstractParameter; use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\AttachmentTypeParameter;
use App\Entity\Parameters\CategoryParameter; use App\Entity\Parameters\CategoryParameter;
use App\Entity\Parameters\CurrencyParameter; use App\Entity\Parameters\CurrencyParameter;
use App\Entity\Parameters\DeviceParameter; use App\Entity\Parameters\ProjectParameter;
use App\Entity\Parameters\FootprintParameter; use App\Entity\Parameters\FootprintParameter;
use App\Entity\Parameters\GroupParameter; use App\Entity\Parameters\GroupParameter;
use App\Entity\Parameters\ManufacturerParameter; use App\Entity\Parameters\ManufacturerParameter;
@ -159,8 +159,8 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
return CategoryParameter::class; return CategoryParameter::class;
case Currency::class: case Currency::class:
return CurrencyParameter::class; return CurrencyParameter::class;
case Device::class: case Project::class:
return DeviceParameter::class; return ProjectParameter::class;
case Footprint::class: case Footprint::class:
return FootprintParameter::class; return FootprintParameter::class;
case Group::class: case Group::class:
@ -189,8 +189,8 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
return CategoryAttachment::class; return CategoryAttachment::class;
case Currency::class: case Currency::class:
return CurrencyAttachment::class; return CurrencyAttachment::class;
case Device::class: case Project::class:
return DeviceAttachment::class; return ProjectAttachment::class;
case Footprint::class: case Footprint::class:
return FootprintAttachment::class; return FootprintAttachment::class;
case Group::class: case Group::class:

View file

@ -62,7 +62,7 @@ use function sprintf;
* @ORM\DiscriminatorMap({ * @ORM\DiscriminatorMap({
* 0 = "CategoryParameter", * 0 = "CategoryParameter",
* 1 = "CurrencyParameter", * 1 = "CurrencyParameter",
* 2 = "DeviceParameter", * 2 = "ProjectParameter",
* 3 = "FootprintParameter", * 3 = "FootprintParameter",
* 4 = "GroupParameter", * 4 = "GroupParameter",
* 5 = "ManufacturerParameter", * 5 = "ManufacturerParameter",

View file

@ -41,7 +41,7 @@ declare(strict_types=1);
namespace App\Entity\Parameters; namespace App\Entity\Parameters;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@ -49,13 +49,13 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"}) * @UniqueEntity(fields={"name", "group", "element"})
*/ */
class DeviceParameter extends AbstractParameter class ProjectParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Device::class; public const ALLOWED_ELEMENT_CLASS = Project::class;
/** /**
* @var Device the element this para is associated with * @var Project the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="parameters") * @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/ */
protected $element; protected $element;

View file

@ -25,7 +25,7 @@ namespace App\Entity\Parts;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\PartAttachment; use App\Entity\Attachments\PartAttachment;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parameters\ParametersTrait; use App\Entity\Parameters\ParametersTrait;
use App\Entity\Parameters\PartParameter; use App\Entity\Parameters\PartParameter;
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait; use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
@ -152,7 +152,7 @@ class Part extends AttachmentContainingDBElement
/** /**
* Get all devices which uses this part. * Get all devices which uses this part.
* *
* @return Device[] * all devices which uses this part as a one-dimensional array of Device objects * @return Project[] * all devices which uses this part as a one-dimensional array of Device objects
* (empty array if there are no ones) * (empty array if there are no ones)
* * the array is sorted by the devices names * * the array is sorted by the devices names
*/ */

View file

@ -20,11 +20,12 @@
declare(strict_types=1); declare(strict_types=1);
namespace App\Entity\Devices; namespace App\Entity\ProjectSystem;
use App\Entity\Attachments\DeviceAttachment; use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Base\AbstractPartsContainingDBElement; use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\DeviceParameter; use App\Entity\Parameters\ProjectParameter;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use InvalidArgumentException; use InvalidArgumentException;
@ -33,27 +34,27 @@ use InvalidArgumentException;
* Class AttachmentType. * Class AttachmentType.
* *
* @ORM\Entity(repositoryClass="App\Repository\Parts\DeviceRepository") * @ORM\Entity(repositoryClass="App\Repository\Parts\DeviceRepository")
* @ORM\Table(name="`devices`") * @ORM\Table(name="devices")
*/ */
class Device extends AbstractPartsContainingDBElement class Project extends AbstractStructuralDBElement
{ {
/** /**
* @ORM\OneToMany(targetEntity="Device", mappedBy="parent") * @ORM\OneToMany(targetEntity="Project", mappedBy="parent")
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @var Collection * @var Collection
*/ */
protected $children; protected $children;
/** /**
* @ORM\ManyToOne(targetEntity="Device", inversedBy="children") * @ORM\ManyToOne(targetEntity="Project", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/ */
protected $parent; protected $parent;
/** /**
* @ORM\OneToMany(targetEntity="DevicePart", mappedBy="device") * @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="device")
*/ */
protected $parts; protected $bom_entries;
/** /**
* @ORM\Column(type="integer") * @ORM\Column(type="integer")
@ -64,15 +65,21 @@ class Device extends AbstractPartsContainingDBElement
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
protected bool $order_only_missing_parts = false; protected bool $order_only_missing_parts = false;
/** /**
* @var Collection<int, DeviceAttachment> * @ORM\Column(type="text", nullable=false)
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) */
protected string $description = '';
/**
* @var Collection<int, ProjectAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ProjectAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
*/ */
protected $attachments; protected $attachments;
/** @var Collection<int, DeviceParameter> /** @var Collection<int, ProjectParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\DeviceParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\ProjectParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
*/ */
protected $parameters; protected $parameters;
@ -83,6 +90,12 @@ class Device extends AbstractPartsContainingDBElement
* *
*********************************************************************************/ *********************************************************************************/
public function __construct()
{
parent::__construct();
$this->bom_entries = new ArrayCollection();
}
/** /**
* Get the order quantity of this device. * Get the order quantity of this device.
* *
@ -131,7 +144,7 @@ class Device extends AbstractPartsContainingDBElement
* *
* @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute * @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute
* *
* @return Device * @return Project
*/ */
public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self
{ {
@ -139,4 +152,42 @@ class Device extends AbstractPartsContainingDBElement
return $this; return $this;
} }
/**
* @return mixed
*/
public function getBomEntries()
{
return $this->bom_entries;
}
/**
* @param mixed $bom_entries
* @return Project
*/
public function setBomEntries($bom_entries)
{
$this->bom_entries = $bom_entries;
return $this;
}
/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* @param string $description
* @return Project
*/
public function setDescription(string $description): Project
{
$this->description = $description;
return $this;
}
} }

View file

@ -20,42 +20,60 @@
declare(strict_types=1); declare(strict_types=1);
namespace App\Entity\Devices; namespace App\Entity\ProjectSystem;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\TimestampTrait;
use App\Entity\Parts\Part; use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/** /**
* Class DevicePart. * The ProjectBOMEntry class represents a entry in a project's BOM.
* *
* @ORM\Table("`device_parts`") * @ORM\Table("device_parts")
* @ORM\Entity() * @ORM\Entity()
*/ */
class DevicePart extends AbstractDBElement class ProjectBOMEntry extends AbstractDBElement
{ {
/** use TimestampTrait;
* @var int
* @ORM\Column(type="integer", name="quantity")
*/
protected int $quantity;
/** /**
* @var string * @var int
* @ORM\Column(type="float", name="quantity")
* @Assert\PositiveOrZero()
*/
protected float $quantity;
/**
* @var string A comma separated list of the names, where this parts should be placed
* @ORM\Column(type="text", name="mountnames") * @ORM\Column(type="text", name="mountnames")
*/ */
protected string $mountnames; protected string $mountnames;
/**
* @var Device
* @ORM\ManyToOne(targetEntity="Device", inversedBy="parts")
* @ORM\JoinColumn(name="id_device", referencedColumnName="id")
*/
protected ?Device $device = null;
/** /**
* @var Part * @var string An optional name describing this BOM entry (useful for non-part entries)
* @ORM\Column(type="text")
*/
protected string $name;
/**
* @var string An optional comment for this BOM entry
* @ORM\Column(type="text")
*/
protected string $comment;
/**
* @var Project
* @ORM\ManyToOne(targetEntity="Project", inversedBy="parts")
* @ORM\JoinColumn(name="id_device", referencedColumnName="id")
*/
protected ?Project $device = null;
/**
* @var Part|null The part associated with this
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part") * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part")
* @ORM\JoinColumn(name="id_part", referencedColumnName="id") * @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=true)
*/ */
protected ?Part $part = null; protected ?Part $part = null;
} }

View file

@ -0,0 +1,42 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Form\AdminPages;
use App\Entity\Base\AbstractNamedDBElement;
use App\Form\Type\RichTextEditorType;
use Symfony\Component\Form\FormBuilderInterface;
class ProjectAdminForm extends BaseEntityAdminForm
{
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$builder->add('description', RichTextEditorType::class, [
'required' => false,
'empty_data' => '',
'label' => 'part.edit.description',
'mode' => 'markdown-single_line',
'attr' => [
'placeholder' => 'part.edit.description.placeholder',
'rows' => 2,
],
]);
}
}

View file

@ -25,7 +25,7 @@ use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\AttachmentTypeAttachment;
use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CategoryAttachment;
use App\Entity\Attachments\CurrencyAttachment; use App\Entity\Attachments\CurrencyAttachment;
use App\Entity\Attachments\DeviceAttachment; use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\FootprintAttachment;
use App\Entity\Attachments\GroupAttachment; use App\Entity\Attachments\GroupAttachment;
use App\Entity\Attachments\LabelAttachment; use App\Entity\Attachments\LabelAttachment;
@ -80,7 +80,7 @@ class AttachmentFilterType extends AbstractType
'attachment_type.label' => AttachmentTypeAttachment::class, 'attachment_type.label' => AttachmentTypeAttachment::class,
'category.label' => CategoryAttachment::class, 'category.label' => CategoryAttachment::class,
'currency.label' => CurrencyAttachment::class, 'currency.label' => CurrencyAttachment::class,
'device.label' => DeviceAttachment::class, 'device.label' => ProjectAttachment::class,
'footprint.label' => FootprintAttachment::class, 'footprint.label' => FootprintAttachment::class,
'group.label' => GroupAttachment::class, 'group.label' => GroupAttachment::class,
'label_profile.label' => LabelAttachment::class, 'label_profile.label' => LabelAttachment::class,

View file

@ -23,8 +23,8 @@ namespace App\Form\Filters;
use App\DataTables\Filters\LogFilter; use App\DataTables\Filters\LogFilter;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Devices\DevicePart; use App\Entity\ProjectSystem\ProjectBOMEntry;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use App\Entity\LogSystem\AbstractLogEntry; use App\Entity\LogSystem\AbstractLogEntry;
use App\Entity\LogSystem\CollectionElementDeleted; use App\Entity\LogSystem\CollectionElementDeleted;
@ -135,8 +135,8 @@ class LogFilterType extends AbstractType
'attachment.label' => AbstractLogEntry::targetTypeClassToID(Attachment::class), 'attachment.label' => AbstractLogEntry::targetTypeClassToID(Attachment::class),
'attachment_type.label' => AbstractLogEntry::targetTypeClassToID(AttachmentType::class), 'attachment_type.label' => AbstractLogEntry::targetTypeClassToID(AttachmentType::class),
'category.label' => AbstractLogEntry::targetTypeClassToID(Category::class), 'category.label' => AbstractLogEntry::targetTypeClassToID(Category::class),
'device.label' => AbstractLogEntry::targetTypeClassToID(Device::class), 'device.label' => AbstractLogEntry::targetTypeClassToID(Project::class),
'device_part.label' => AbstractLogEntry::targetTypeClassToID(DevicePart::class), 'device_part.label' => AbstractLogEntry::targetTypeClassToID(ProjectBOMEntry::class),
'footprint.label' => AbstractLogEntry::targetTypeClassToID(Footprint::class), 'footprint.label' => AbstractLogEntry::targetTypeClassToID(Footprint::class),
'group.label' => AbstractLogEntry::targetTypeClassToID(Group::class), 'group.label' => AbstractLogEntry::targetTypeClassToID(Group::class),
'manufacturer.label' => AbstractLogEntry::targetTypeClassToID(Manufacturer::class), 'manufacturer.label' => AbstractLogEntry::targetTypeClassToID(Manufacturer::class),

View file

@ -45,7 +45,7 @@ use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\AttachmentTypeParameter;
use App\Entity\Parameters\CategoryParameter; use App\Entity\Parameters\CategoryParameter;
use App\Entity\Parameters\CurrencyParameter; use App\Entity\Parameters\CurrencyParameter;
use App\Entity\Parameters\DeviceParameter; use App\Entity\Parameters\ProjectParameter;
use App\Entity\Parameters\FootprintParameter; use App\Entity\Parameters\FootprintParameter;
use App\Entity\Parameters\GroupParameter; use App\Entity\Parameters\GroupParameter;
use App\Entity\Parameters\ManufacturerParameter; use App\Entity\Parameters\ManufacturerParameter;
@ -158,7 +158,7 @@ class ParameterType extends AbstractType
AttachmentTypeParameter::class => 'attachment_type', AttachmentTypeParameter::class => 'attachment_type',
CategoryParameter::class => 'category', CategoryParameter::class => 'category',
CurrencyParameter::class => 'currency', CurrencyParameter::class => 'currency',
DeviceParameter::class => 'device', ProjectParameter::class => 'device',
FootprintParameter::class => 'footprint', FootprintParameter::class => 'footprint',
GroupParameter::class => 'group', GroupParameter::class => 'group',
ManufacturerParameter::class => 'manufacturer', ManufacturerParameter::class => 'manufacturer',

View file

@ -22,18 +22,19 @@ namespace App\Repository\Parts;
use App\Entity\Base\AbstractPartsContainingDBElement; use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Part; use App\Entity\Parts\Part;
use App\Repository\AbstractPartsContainingRepository; use App\Repository\AbstractPartsContainingRepository;
use App\Repository\StructuralDBElementRepository;
use InvalidArgumentException; use InvalidArgumentException;
class DeviceRepository extends AbstractPartsContainingRepository class DeviceRepository extends StructuralDBElementRepository
{ {
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{ {
if (!$element instanceof Device) { if (!$element instanceof Project) {
throw new InvalidArgumentException('$element must be an Device!'); throw new InvalidArgumentException('$element must be an Device!');
} }
@ -44,7 +45,7 @@ class DeviceRepository extends AbstractPartsContainingRepository
public function getPartsCount(object $element): int public function getPartsCount(object $element): int
{ {
if (!$element instanceof Device) { if (!$element instanceof Project) {
throw new InvalidArgumentException('$element must be an Device!'); throw new InvalidArgumentException('$element must be an Device!');
} }

View file

@ -24,7 +24,7 @@ use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\AttachmentTypeParameter;
use App\Entity\Parameters\CategoryParameter; use App\Entity\Parameters\CategoryParameter;
use App\Entity\Parameters\CurrencyParameter; use App\Entity\Parameters\CurrencyParameter;
use App\Entity\Parameters\DeviceParameter; use App\Entity\Parameters\ProjectParameter;
use App\Entity\Parameters\FootprintParameter; use App\Entity\Parameters\FootprintParameter;
use App\Entity\Parameters\GroupParameter; use App\Entity\Parameters\GroupParameter;
use App\Entity\Parameters\ManufacturerParameter; use App\Entity\Parameters\ManufacturerParameter;
@ -95,7 +95,7 @@ class ParameterVoter extends ExtendedVoter
$param = 'categories'; $param = 'categories';
} elseif ($subject instanceof CurrencyParameter) { } elseif ($subject instanceof CurrencyParameter) {
$param = 'currencies'; $param = 'currencies';
} elseif ($subject instanceof DeviceParameter) { } elseif ($subject instanceof ProjectParameter) {
$param = 'devices'; $param = 'devices';
} elseif ($subject instanceof FootprintParameter) { } elseif ($subject instanceof FootprintParameter) {
$param = 'footprints'; $param = 'footprints';

View file

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace App\Security\Voter; namespace App\Security\Voter;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Manufacturer;
@ -40,7 +40,7 @@ class StructureVoter extends ExtendedVoter
protected const OBJ_PERM_MAP = [ protected const OBJ_PERM_MAP = [
AttachmentType::class => 'attachment_types', AttachmentType::class => 'attachment_types',
Category::class => 'categories', Category::class => 'categories',
Device::class => 'devices', Project::class => 'devices',
Footprint::class => 'footprints', Footprint::class => 'footprints',
Manufacturer::class => 'manufacturers', Manufacturer::class => 'manufacturers',
Storelocation::class => 'storelocations', Storelocation::class => 'storelocations',

View file

@ -28,7 +28,7 @@ use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\AttachmentTypeAttachment;
use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CategoryAttachment;
use App\Entity\Attachments\CurrencyAttachment; use App\Entity\Attachments\CurrencyAttachment;
use App\Entity\Attachments\DeviceAttachment; use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\FootprintAttachment;
use App\Entity\Attachments\GroupAttachment; use App\Entity\Attachments\GroupAttachment;
use App\Entity\Attachments\ManufacturerAttachment; use App\Entity\Attachments\ManufacturerAttachment;
@ -82,7 +82,7 @@ class AttachmentSubmitHandler
AttachmentTypeAttachment::class => 'attachment_type', AttachmentTypeAttachment::class => 'attachment_type',
CategoryAttachment::class => 'category', CategoryAttachment::class => 'category',
CurrencyAttachment::class => 'currency', CurrencyAttachment::class => 'currency',
DeviceAttachment::class => 'device', ProjectAttachment::class => 'device',
FootprintAttachment::class => 'footprint', FootprintAttachment::class => 'footprint',
GroupAttachment::class => 'group', GroupAttachment::class => 'group',
ManufacturerAttachment::class => 'manufacturer', ManufacturerAttachment::class => 'manufacturer',

View file

@ -25,7 +25,7 @@ namespace App\Services;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Contracts\NamedElementInterface; use App\Entity\Contracts\NamedElementInterface;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use App\Entity\Parameters\AbstractParameter; use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
@ -59,7 +59,7 @@ class ElementTypeNameGenerator
Attachment::class => $this->translator->trans('attachment.label'), Attachment::class => $this->translator->trans('attachment.label'),
Category::class => $this->translator->trans('category.label'), Category::class => $this->translator->trans('category.label'),
AttachmentType::class => $this->translator->trans('attachment_type.label'), AttachmentType::class => $this->translator->trans('attachment_type.label'),
Device::class => $this->translator->trans('device.label'), Project::class => $this->translator->trans('device.label'),
Footprint::class => $this->translator->trans('footprint.label'), Footprint::class => $this->translator->trans('footprint.label'),
Manufacturer::class => $this->translator->trans('manufacturer.label'), Manufacturer::class => $this->translator->trans('manufacturer.label'),
MeasurementUnit::class => $this->translator->trans('measurement_unit.label'), MeasurementUnit::class => $this->translator->trans('measurement_unit.label'),

View file

@ -26,7 +26,7 @@ use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\PartAttachment; use App\Entity\Attachments\PartAttachment;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
@ -113,7 +113,7 @@ class EntityURLGenerator
//As long we does not have own things for it use edit page //As long we does not have own things for it use edit page
AttachmentType::class => 'attachment_type_edit', AttachmentType::class => 'attachment_type_edit',
Category::class => 'category_edit', Category::class => 'category_edit',
Device::class => 'device_edit', Project::class => 'device_edit',
Supplier::class => 'supplier_edit', Supplier::class => 'supplier_edit',
Manufacturer::class => 'manufacturer_edit', Manufacturer::class => 'manufacturer_edit',
Storelocation::class => 'store_location_edit', Storelocation::class => 'store_location_edit',
@ -204,7 +204,7 @@ class EntityURLGenerator
//As long we does not have own things for it use edit page //As long we does not have own things for it use edit page
AttachmentType::class => 'attachment_type_edit', AttachmentType::class => 'attachment_type_edit',
Category::class => 'category_edit', Category::class => 'category_edit',
Device::class => 'device_edit', Project::class => 'device_edit',
Supplier::class => 'supplier_edit', Supplier::class => 'supplier_edit',
Manufacturer::class => 'manufacturer_edit', Manufacturer::class => 'manufacturer_edit',
Storelocation::class => 'store_location_edit', Storelocation::class => 'store_location_edit',
@ -234,7 +234,7 @@ class EntityURLGenerator
Part::class => 'part_edit', Part::class => 'part_edit',
AttachmentType::class => 'attachment_type_edit', AttachmentType::class => 'attachment_type_edit',
Category::class => 'category_edit', Category::class => 'category_edit',
Device::class => 'device_edit', Project::class => 'device_edit',
Supplier::class => 'supplier_edit', Supplier::class => 'supplier_edit',
Manufacturer::class => 'manufacturer_edit', Manufacturer::class => 'manufacturer_edit',
Storelocation::class => 'store_location_edit', Storelocation::class => 'store_location_edit',
@ -264,7 +264,7 @@ class EntityURLGenerator
Part::class => 'part_new', Part::class => 'part_new',
AttachmentType::class => 'attachment_type_new', AttachmentType::class => 'attachment_type_new',
Category::class => 'category_new', Category::class => 'category_new',
Device::class => 'device_new', Project::class => 'device_new',
Supplier::class => 'supplier_new', Supplier::class => 'supplier_new',
Manufacturer::class => 'manufacturer_new', Manufacturer::class => 'manufacturer_new',
Storelocation::class => 'store_location_new', Storelocation::class => 'store_location_new',
@ -295,7 +295,7 @@ class EntityURLGenerator
Part::class => 'part_clone', Part::class => 'part_clone',
AttachmentType::class => 'attachment_type_clone', AttachmentType::class => 'attachment_type_clone',
Category::class => 'category_clone', Category::class => 'category_clone',
Device::class => 'device_clone', Project::class => 'device_clone',
Supplier::class => 'supplier_clone', Supplier::class => 'supplier_clone',
Manufacturer::class => 'manufacturer_clone', Manufacturer::class => 'manufacturer_clone',
Storelocation::class => 'store_location_clone', Storelocation::class => 'store_location_clone',
@ -338,7 +338,7 @@ class EntityURLGenerator
Part::class => 'part_delete', Part::class => 'part_delete',
AttachmentType::class => 'attachment_type_delete', AttachmentType::class => 'attachment_type_delete',
Category::class => 'category_delete', Category::class => 'category_delete',
Device::class => 'device_delete', Project::class => 'device_delete',
Supplier::class => 'supplier_delete', Supplier::class => 'supplier_delete',
Manufacturer::class => 'manufacturer_delete', Manufacturer::class => 'manufacturer_delete',
Storelocation::class => 'store_location_delete', Storelocation::class => 'store_location_delete',

View file

@ -43,7 +43,7 @@ namespace App\Services\Tools;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Manufacturer;
@ -111,7 +111,7 @@ class StatisticsHelper
$arr = [ $arr = [
'attachment_type' => AttachmentType::class, 'attachment_type' => AttachmentType::class,
'category' => Category::class, 'category' => Category::class,
'device' => Device::class, 'device' => Project::class,
'footprint' => Footprint::class, 'footprint' => Footprint::class,
'manufacturer' => Manufacturer::class, 'manufacturer' => Manufacturer::class,
'measurement_unit' => MeasurementUnit::class, 'measurement_unit' => MeasurementUnit::class,

View file

@ -24,7 +24,7 @@ namespace App\Services\Trees;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\PartAttachment; use App\Entity\Attachments\PartAttachment;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
@ -156,7 +156,7 @@ class ToolsTreeBuilder
$this->urlGenerator->generate('category_new') $this->urlGenerator->generate('category_new')
))->setIcon('fa-fw fa-treeview fa-solid fa-tags'); ))->setIcon('fa-fw fa-treeview fa-solid fa-tags');
} }
if ($this->security->isGranted('read', new Device())) { if ($this->security->isGranted('read', new Project())) {
$nodes[] = (new TreeViewNode( $nodes[] = (new TreeViewNode(
$this->translator->trans('tree.tools.edit.devices'), $this->translator->trans('tree.tools.edit.devices'),
$this->urlGenerator->generate('device_new') $this->urlGenerator->generate('device_new')

View file

@ -25,7 +25,7 @@ namespace App\Services\Trees;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Manufacturer;
@ -161,7 +161,7 @@ class TreeViewGenerator
return $this->translator->trans('manufacturer.labelp'); return $this->translator->trans('manufacturer.labelp');
case Supplier::class: case Supplier::class:
return $this->translator->trans('supplier.labelp'); return $this->translator->trans('supplier.labelp');
case Device::class: case Project::class:
return $this->translator->trans('device.labelp'); return $this->translator->trans('device.labelp');
default: default:
return $this->translator->trans('tree.root_node.text'); return $this->translator->trans('tree.root_node.text');
@ -182,7 +182,7 @@ class TreeViewGenerator
return $icon . 'fa-industry'; return $icon . 'fa-industry';
case Supplier::class: case Supplier::class:
return $icon . 'fa-truck'; return $icon . 'fa-truck';
case Device::class: case Project::class:
return $icon . 'fa-archive'; return $icon . 'fa-archive';
default: default:
return null; return null;

View file

@ -22,7 +22,7 @@ namespace App\Twig;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
@ -99,7 +99,7 @@ final class EntityExtension extends AbstractExtension
Storelocation::class => 'storelocation', Storelocation::class => 'storelocation',
Manufacturer::class => 'manufacturer', Manufacturer::class => 'manufacturer',
Category::class => 'category', Category::class => 'category',
Device::class => 'device', Project::class => 'device',
Attachment::class => 'attachment', Attachment::class => 'attachment',
Supplier::class => 'supplier', Supplier::class => 'supplier',
User::class => 'user', User::class => 'user',

View file

@ -24,7 +24,7 @@ namespace App\Twig;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;

View file

@ -11,3 +11,7 @@
{% block new_title %} {% block new_title %}
{% trans %}device.new{% endtrans %} {% trans %}device.new{% endtrans %}
{% endblock %} {% endblock %}
{% block additional_controls %}
{{ form_row(form.description) }}
{% endblock %}

View file

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace App\Tests\Controller\AdminPages; namespace App\Tests\Controller\AdminPages;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
/** /**
* @group slow * @group slow
@ -32,5 +32,5 @@ use App\Entity\Devices\Device;
class DeviceControllerTest extends AbstractAdminControllerTest class DeviceControllerTest extends AbstractAdminControllerTest
{ {
protected static $base_path = '/en'.'/device'; protected static $base_path = '/en'.'/device';
protected static $entity_class = Device::class; protected static $entity_class = Project::class;
} }

View file

@ -27,7 +27,7 @@ use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\AttachmentTypeAttachment;
use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CategoryAttachment;
use App\Entity\Attachments\CurrencyAttachment; use App\Entity\Attachments\CurrencyAttachment;
use App\Entity\Attachments\DeviceAttachment; use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\FootprintAttachment;
use App\Entity\Attachments\GroupAttachment; use App\Entity\Attachments\GroupAttachment;
use App\Entity\Attachments\ManufacturerAttachment; use App\Entity\Attachments\ManufacturerAttachment;
@ -36,7 +36,7 @@ use App\Entity\Attachments\PartAttachment;
use App\Entity\Attachments\StorelocationAttachment; use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\SupplierAttachment; use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Attachments\UserAttachment; use App\Entity\Attachments\UserAttachment;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Manufacturer;
@ -78,7 +78,7 @@ class AttachmentTest extends TestCase
[AttachmentTypeAttachment::class, AttachmentType::class], [AttachmentTypeAttachment::class, AttachmentType::class],
[CategoryAttachment::class, Category::class], [CategoryAttachment::class, Category::class],
[CurrencyAttachment::class, Currency::class], [CurrencyAttachment::class, Currency::class],
[DeviceAttachment::class, Device::class], [ProjectAttachment::class, Project::class],
[FootprintAttachment::class, Footprint::class], [FootprintAttachment::class, Footprint::class],
[GroupAttachment::class, Group::class], [GroupAttachment::class, Group::class],
[ManufacturerAttachment::class, Manufacturer::class], [ManufacturerAttachment::class, Manufacturer::class],
@ -117,8 +117,8 @@ class AttachmentTest extends TestCase
/** @var Attachment $attachment */ /** @var Attachment $attachment */
$attachment = new $attachment_class(); $attachment = new $attachment_class();
if (Device::class !== $allowed_class) { if (Project::class !== $allowed_class) {
$element = new Device(); $element = new Project();
} else { } else {
$element = new Category(); $element = new Category();
} }

View file

@ -44,8 +44,8 @@ namespace App\Tests\Entity\LogSystem;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\PartAttachment; use App\Entity\Attachments\PartAttachment;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\Devices\DevicePart; use App\Entity\ProjectSystem\ProjectBOMEntry;
use App\Entity\LogSystem\AbstractLogEntry; use App\Entity\LogSystem\AbstractLogEntry;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
@ -82,8 +82,8 @@ class AbstractLogEntryTest extends TestCase
[2, Attachment::class], [2, Attachment::class],
[3, AttachmentType::class], [3, AttachmentType::class],
[4, Category::class], [4, Category::class],
[5, Device::class], [5, Project::class],
[6, DevicePart::class], [6, ProjectBOMEntry::class],
[7, Footprint::class], [7, Footprint::class],
[8, Group::class], [8, Group::class],
[9, Manufacturer::class], [9, Manufacturer::class],

View file

@ -22,7 +22,7 @@ namespace App\Tests\Twig;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\PartAttachment; use App\Entity\Attachments\PartAttachment;
use App\Entity\Devices\Device; use App\Entity\ProjectSystem\Project;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint; use App\Entity\Parts\Footprint;
@ -58,7 +58,7 @@ class EntityExtensionTest extends WebTestCase
$this->assertEquals('storelocation', $this->service->getEntityType(new Storelocation())); $this->assertEquals('storelocation', $this->service->getEntityType(new Storelocation()));
$this->assertEquals('manufacturer', $this->service->getEntityType(new Manufacturer())); $this->assertEquals('manufacturer', $this->service->getEntityType(new Manufacturer()));
$this->assertEquals('category', $this->service->getEntityType(new Category())); $this->assertEquals('category', $this->service->getEntityType(new Category()));
$this->assertEquals('device', $this->service->getEntityType(new Device())); $this->assertEquals('device', $this->service->getEntityType(new Project()));
$this->assertEquals('attachment', $this->service->getEntityType(new PartAttachment())); $this->assertEquals('attachment', $this->service->getEntityType(new PartAttachment()));
$this->assertEquals('supplier', $this->service->getEntityType(new Supplier())); $this->assertEquals('supplier', $this->service->getEntityType(new Supplier()));
$this->assertEquals('user', $this->service->getEntityType(new User())); $this->assertEquals('user', $this->service->getEntityType(new User()));