mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Added some basic DB fields for the new project system
This commit is contained in:
parent
8ae4e9fe05
commit
0c7ec9f0c7
36 changed files with 281 additions and 130 deletions
33
migrations/Version20221218192108.php
Normal file
33
migrations/Version20221218192108.php
Normal 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');
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ namespace App\Command\Migrations;
|
|||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
|
@ -94,7 +94,7 @@ class ConvertBBCodeCommand extends Command
|
|||
Part::class => ['description', 'comment'],
|
||||
AttachmentType::class => ['comment'],
|
||||
Storelocation::class => ['comment'],
|
||||
Device::class => ['comment'],
|
||||
Project::class => ['comment'],
|
||||
Category::class => ['comment'],
|
||||
Manufacturer::class => ['comment'],
|
||||
MeasurementUnit::class => ['comment'],
|
||||
|
|
|
@ -22,10 +22,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\AdminPages;
|
||||
|
||||
use App\Entity\Attachments\DeviceAttachment;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parameters\ProjectParameter;
|
||||
use App\Form\AdminPages\BaseEntityAdminForm;
|
||||
use App\Form\AdminPages\ProjectAdminForm;
|
||||
use App\Services\ImportExportSystem\EntityExporter;
|
||||
use App\Services\ImportExportSystem\EntityImporter;
|
||||
use App\Services\Trees\StructuralElementRecursionHelper;
|
||||
|
@ -38,19 +39,19 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||
/**
|
||||
* @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 $form_class = BaseEntityAdminForm::class;
|
||||
protected $form_class = ProjectAdminForm::class;
|
||||
protected $route_base = 'device';
|
||||
protected $attachment_class = DeviceAttachment::class;
|
||||
protected $parameter_class = DeviceParameter::class;
|
||||
protected $attachment_class = ProjectAttachment::class;
|
||||
protected $parameter_class = ProjectParameter::class;
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -59,7 +60,7 @@ class DeviceController extends BaseAdminController
|
|||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="device_edit")
|
||||
* @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);
|
||||
}
|
||||
|
@ -69,7 +70,7 @@ class DeviceController extends BaseAdminController
|
|||
* @Route("/{id}/clone", name="device_clone")
|
||||
* @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);
|
||||
}
|
||||
|
@ -85,7 +86,7 @@ class DeviceController extends BaseAdminController
|
|||
/**
|
||||
* @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);
|
||||
}
|
|
@ -22,7 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
|
@ -136,10 +136,10 @@ class TreeController extends AbstractController
|
|||
* @Route("/device/{id}", name="tree_device")
|
||||
* @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')) {
|
||||
$tree = $this->treeGenerator->getTreeView(Device::class, $device, 'devices');
|
||||
$tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices');
|
||||
} else {
|
||||
return new JsonResponse("Access denied", 403);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace App\Controller;
|
|||
|
||||
use App\Entity\Parameters\AttachmentTypeParameter;
|
||||
use App\Entity\Parameters\CategoryParameter;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\ProjectParameter;
|
||||
use App\Entity\Parameters\FootprintParameter;
|
||||
use App\Entity\Parameters\GroupParameter;
|
||||
use App\Entity\Parameters\ManufacturerParameter;
|
||||
|
@ -105,7 +105,7 @@ class TypeaheadController extends AbstractController
|
|||
case 'part':
|
||||
return PartParameter::class;
|
||||
case 'device':
|
||||
return DeviceParameter::class;
|
||||
return ProjectParameter::class;
|
||||
case 'footprint':
|
||||
return FootprintParameter::class;
|
||||
case 'manufacturer':
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace App\DataFixtures;
|
|||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
|
@ -51,7 +51,7 @@ class DataStructureFixtures extends Fixture
|
|||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
//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, ];
|
||||
|
||||
foreach ($types as $type) {
|
||||
|
|
|
@ -44,7 +44,7 @@ use LogicException;
|
|||
* @ORM\DiscriminatorColumn(name="class_name", type="string")
|
||||
* @ORM\DiscriminatorMap({
|
||||
* "PartDB\Part" = "PartAttachment", "Part" = "PartAttachment",
|
||||
* "PartDB\Device" = "DeviceAttachment", "Device" = "DeviceAttachment",
|
||||
* "PartDB\Device" = "ProjectAttachment", "Device" = "ProjectAttachment",
|
||||
* "AttachmentType" = "AttachmentTypeAttachment", "Category" = "CategoryAttachment",
|
||||
* "Footprint" = "FootprintAttachment", "Manufacturer" = "ManufacturerAttachment",
|
||||
* "Currency" = "CurrencyAttachment", "Group" = "GroupAttachment",
|
||||
|
|
|
@ -22,7 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
|
@ -32,12 +32,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* @ORM\Entity()
|
||||
* @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
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="attachments")
|
||||
* @var Project the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
|
@ -29,6 +29,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
*
|
||||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\AbstractPartsContainingRepository")
|
||||
*/
|
||||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
abstract class
|
||||
AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
{
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace App\Entity\LogSystem;
|
|||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Devices\DevicePart;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parameters\AbstractParameter;
|
||||
use App\Entity\Parts\Category;
|
||||
|
@ -124,8 +124,8 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
self::TARGET_TYPE_ATTACHEMENT => Attachment::class,
|
||||
self::TARGET_TYPE_ATTACHEMENTTYPE => AttachmentType::class,
|
||||
self::TARGET_TYPE_CATEGORY => Category::class,
|
||||
self::TARGET_TYPE_DEVICE => Device::class,
|
||||
self::TARGET_TYPE_DEVICEPART => DevicePart::class,
|
||||
self::TARGET_TYPE_DEVICE => Project::class,
|
||||
self::TARGET_TYPE_DEVICEPART => ProjectBOMEntry::class,
|
||||
self::TARGET_TYPE_FOOTPRINT => Footprint::class,
|
||||
self::TARGET_TYPE_GROUP => Group::class,
|
||||
self::TARGET_TYPE_MANUFACTURER => Manufacturer::class,
|
||||
|
|
|
@ -46,7 +46,7 @@ use App\Entity\Attachments\AttachmentType;
|
|||
use App\Entity\Attachments\AttachmentTypeAttachment;
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Attachments\DeviceAttachment;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
use App\Entity\Attachments\ManufacturerAttachment;
|
||||
|
@ -58,12 +58,12 @@ use App\Entity\Attachments\UserAttachment;
|
|||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Contracts\LogWithEventUndoInterface;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parameters\AbstractParameter;
|
||||
use App\Entity\Parameters\AttachmentTypeParameter;
|
||||
use App\Entity\Parameters\CategoryParameter;
|
||||
use App\Entity\Parameters\CurrencyParameter;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\ProjectParameter;
|
||||
use App\Entity\Parameters\FootprintParameter;
|
||||
use App\Entity\Parameters\GroupParameter;
|
||||
use App\Entity\Parameters\ManufacturerParameter;
|
||||
|
@ -159,8 +159,8 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
|||
return CategoryParameter::class;
|
||||
case Currency::class:
|
||||
return CurrencyParameter::class;
|
||||
case Device::class:
|
||||
return DeviceParameter::class;
|
||||
case Project::class:
|
||||
return ProjectParameter::class;
|
||||
case Footprint::class:
|
||||
return FootprintParameter::class;
|
||||
case Group::class:
|
||||
|
@ -189,8 +189,8 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
|||
return CategoryAttachment::class;
|
||||
case Currency::class:
|
||||
return CurrencyAttachment::class;
|
||||
case Device::class:
|
||||
return DeviceAttachment::class;
|
||||
case Project::class:
|
||||
return ProjectAttachment::class;
|
||||
case Footprint::class:
|
||||
return FootprintAttachment::class;
|
||||
case Group::class:
|
||||
|
|
|
@ -62,7 +62,7 @@ use function sprintf;
|
|||
* @ORM\DiscriminatorMap({
|
||||
* 0 = "CategoryParameter",
|
||||
* 1 = "CurrencyParameter",
|
||||
* 2 = "DeviceParameter",
|
||||
* 2 = "ProjectParameter",
|
||||
* 3 = "FootprintParameter",
|
||||
* 4 = "GroupParameter",
|
||||
* 5 = "ManufacturerParameter",
|
||||
|
|
|
@ -41,7 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
|
@ -49,13 +49,13 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @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
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="parameters")
|
||||
* @var Project the element this para is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
|
@ -25,7 +25,7 @@ namespace App\Entity\Parts;
|
|||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parameters\ParametersTrait;
|
||||
use App\Entity\Parameters\PartParameter;
|
||||
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
|
||||
|
@ -152,7 +152,7 @@ class Part extends AttachmentContainingDBElement
|
|||
/**
|
||||
* 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)
|
||||
* * the array is sorted by the devices names
|
||||
*/
|
||||
|
|
|
@ -20,11 +20,12 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity\Devices;
|
||||
namespace App\Entity\ProjectSystem;
|
||||
|
||||
use App\Entity\Attachments\DeviceAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\ProjectParameter;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use InvalidArgumentException;
|
||||
|
@ -33,27 +34,27 @@ use InvalidArgumentException;
|
|||
* Class AttachmentType.
|
||||
*
|
||||
* @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"})
|
||||
* @var Collection
|
||||
*/
|
||||
protected $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Device", inversedBy="children")
|
||||
* @ORM\ManyToOne(targetEntity="Project", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="DevicePart", mappedBy="device")
|
||||
* @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="device")
|
||||
*/
|
||||
protected $parts;
|
||||
protected $bom_entries;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
|
@ -64,15 +65,21 @@ class Device extends AbstractPartsContainingDBElement
|
|||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected bool $order_only_missing_parts = false;
|
||||
|
||||
/**
|
||||
* @var Collection<int, DeviceAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
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"})
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<int, DeviceParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\DeviceParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
/** @var Collection<int, ProjectParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ProjectParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -131,7 +144,7 @@ class Device extends AbstractPartsContainingDBElement
|
|||
*
|
||||
* @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
|
||||
{
|
||||
|
@ -139,4 +152,42 @@ class Device extends AbstractPartsContainingDBElement
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,42 +20,60 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity\Devices;
|
||||
namespace App\Entity\ProjectSystem;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Parts\Part;
|
||||
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()
|
||||
*/
|
||||
class DevicePart extends AbstractDBElement
|
||||
class ProjectBOMEntry extends AbstractDBElement
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
* @ORM\Column(type="integer", name="quantity")
|
||||
*/
|
||||
protected int $quantity;
|
||||
use TimestampTrait;
|
||||
|
||||
/**
|
||||
* @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")
|
||||
*/
|
||||
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\JoinColumn(name="id_part", referencedColumnName="id")
|
||||
* @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
protected ?Part $part = null;
|
||||
}
|
42
src/Form/AdminPages/ProjectAdminForm.php
Normal file
42
src/Form/AdminPages/ProjectAdminForm.php
Normal 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,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ use App\Entity\Attachments\AttachmentType;
|
|||
use App\Entity\Attachments\AttachmentTypeAttachment;
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Attachments\DeviceAttachment;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
use App\Entity\Attachments\LabelAttachment;
|
||||
|
@ -80,7 +80,7 @@ class AttachmentFilterType extends AbstractType
|
|||
'attachment_type.label' => AttachmentTypeAttachment::class,
|
||||
'category.label' => CategoryAttachment::class,
|
||||
'currency.label' => CurrencyAttachment::class,
|
||||
'device.label' => DeviceAttachment::class,
|
||||
'device.label' => ProjectAttachment::class,
|
||||
'footprint.label' => FootprintAttachment::class,
|
||||
'group.label' => GroupAttachment::class,
|
||||
'label_profile.label' => LabelAttachment::class,
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace App\Form\Filters;
|
|||
use App\DataTables\Filters\LogFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Devices\DevicePart;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\LogSystem\CollectionElementDeleted;
|
||||
|
@ -135,8 +135,8 @@ class LogFilterType extends AbstractType
|
|||
'attachment.label' => AbstractLogEntry::targetTypeClassToID(Attachment::class),
|
||||
'attachment_type.label' => AbstractLogEntry::targetTypeClassToID(AttachmentType::class),
|
||||
'category.label' => AbstractLogEntry::targetTypeClassToID(Category::class),
|
||||
'device.label' => AbstractLogEntry::targetTypeClassToID(Device::class),
|
||||
'device_part.label' => AbstractLogEntry::targetTypeClassToID(DevicePart::class),
|
||||
'device.label' => AbstractLogEntry::targetTypeClassToID(Project::class),
|
||||
'device_part.label' => AbstractLogEntry::targetTypeClassToID(ProjectBOMEntry::class),
|
||||
'footprint.label' => AbstractLogEntry::targetTypeClassToID(Footprint::class),
|
||||
'group.label' => AbstractLogEntry::targetTypeClassToID(Group::class),
|
||||
'manufacturer.label' => AbstractLogEntry::targetTypeClassToID(Manufacturer::class),
|
||||
|
|
|
@ -45,7 +45,7 @@ use App\Entity\Parameters\AbstractParameter;
|
|||
use App\Entity\Parameters\AttachmentTypeParameter;
|
||||
use App\Entity\Parameters\CategoryParameter;
|
||||
use App\Entity\Parameters\CurrencyParameter;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\ProjectParameter;
|
||||
use App\Entity\Parameters\FootprintParameter;
|
||||
use App\Entity\Parameters\GroupParameter;
|
||||
use App\Entity\Parameters\ManufacturerParameter;
|
||||
|
@ -158,7 +158,7 @@ class ParameterType extends AbstractType
|
|||
AttachmentTypeParameter::class => 'attachment_type',
|
||||
CategoryParameter::class => 'category',
|
||||
CurrencyParameter::class => 'currency',
|
||||
DeviceParameter::class => 'device',
|
||||
ProjectParameter::class => 'device',
|
||||
FootprintParameter::class => 'footprint',
|
||||
GroupParameter::class => 'group',
|
||||
ManufacturerParameter::class => 'manufacturer',
|
||||
|
|
|
@ -22,18 +22,19 @@ namespace App\Repository\Parts;
|
|||
|
||||
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class DeviceRepository extends AbstractPartsContainingRepository
|
||||
class DeviceRepository extends StructuralDBElementRepository
|
||||
{
|
||||
|
||||
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!');
|
||||
}
|
||||
|
||||
|
@ -44,7 +45,7 @@ class DeviceRepository extends AbstractPartsContainingRepository
|
|||
|
||||
public function getPartsCount(object $element): int
|
||||
{
|
||||
if (!$element instanceof Device) {
|
||||
if (!$element instanceof Project) {
|
||||
throw new InvalidArgumentException('$element must be an Device!');
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ use App\Entity\Parameters\AbstractParameter;
|
|||
use App\Entity\Parameters\AttachmentTypeParameter;
|
||||
use App\Entity\Parameters\CategoryParameter;
|
||||
use App\Entity\Parameters\CurrencyParameter;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\ProjectParameter;
|
||||
use App\Entity\Parameters\FootprintParameter;
|
||||
use App\Entity\Parameters\GroupParameter;
|
||||
use App\Entity\Parameters\ManufacturerParameter;
|
||||
|
@ -95,7 +95,7 @@ class ParameterVoter extends ExtendedVoter
|
|||
$param = 'categories';
|
||||
} elseif ($subject instanceof CurrencyParameter) {
|
||||
$param = 'currencies';
|
||||
} elseif ($subject instanceof DeviceParameter) {
|
||||
} elseif ($subject instanceof ProjectParameter) {
|
||||
$param = 'devices';
|
||||
} elseif ($subject instanceof FootprintParameter) {
|
||||
$param = 'footprints';
|
||||
|
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Security\Voter;
|
||||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
|
@ -40,7 +40,7 @@ class StructureVoter extends ExtendedVoter
|
|||
protected const OBJ_PERM_MAP = [
|
||||
AttachmentType::class => 'attachment_types',
|
||||
Category::class => 'categories',
|
||||
Device::class => 'devices',
|
||||
Project::class => 'devices',
|
||||
Footprint::class => 'footprints',
|
||||
Manufacturer::class => 'manufacturers',
|
||||
Storelocation::class => 'storelocations',
|
||||
|
|
|
@ -28,7 +28,7 @@ use App\Entity\Attachments\AttachmentType;
|
|||
use App\Entity\Attachments\AttachmentTypeAttachment;
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Attachments\DeviceAttachment;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
use App\Entity\Attachments\ManufacturerAttachment;
|
||||
|
@ -82,7 +82,7 @@ class AttachmentSubmitHandler
|
|||
AttachmentTypeAttachment::class => 'attachment_type',
|
||||
CategoryAttachment::class => 'category',
|
||||
CurrencyAttachment::class => 'currency',
|
||||
DeviceAttachment::class => 'device',
|
||||
ProjectAttachment::class => 'device',
|
||||
FootprintAttachment::class => 'footprint',
|
||||
GroupAttachment::class => 'group',
|
||||
ManufacturerAttachment::class => 'manufacturer',
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace App\Services;
|
|||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parameters\AbstractParameter;
|
||||
use App\Entity\Parts\Category;
|
||||
|
@ -59,7 +59,7 @@ class ElementTypeNameGenerator
|
|||
Attachment::class => $this->translator->trans('attachment.label'),
|
||||
Category::class => $this->translator->trans('category.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'),
|
||||
Manufacturer::class => $this->translator->trans('manufacturer.label'),
|
||||
MeasurementUnit::class => $this->translator->trans('measurement_unit.label'),
|
||||
|
|
|
@ -26,7 +26,7 @@ use App\Entity\Attachments\Attachment;
|
|||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
@ -113,7 +113,7 @@ class EntityURLGenerator
|
|||
//As long we does not have own things for it use edit page
|
||||
AttachmentType::class => 'attachment_type_edit',
|
||||
Category::class => 'category_edit',
|
||||
Device::class => 'device_edit',
|
||||
Project::class => 'device_edit',
|
||||
Supplier::class => 'supplier_edit',
|
||||
Manufacturer::class => 'manufacturer_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
|
||||
AttachmentType::class => 'attachment_type_edit',
|
||||
Category::class => 'category_edit',
|
||||
Device::class => 'device_edit',
|
||||
Project::class => 'device_edit',
|
||||
Supplier::class => 'supplier_edit',
|
||||
Manufacturer::class => 'manufacturer_edit',
|
||||
Storelocation::class => 'store_location_edit',
|
||||
|
@ -234,7 +234,7 @@ class EntityURLGenerator
|
|||
Part::class => 'part_edit',
|
||||
AttachmentType::class => 'attachment_type_edit',
|
||||
Category::class => 'category_edit',
|
||||
Device::class => 'device_edit',
|
||||
Project::class => 'device_edit',
|
||||
Supplier::class => 'supplier_edit',
|
||||
Manufacturer::class => 'manufacturer_edit',
|
||||
Storelocation::class => 'store_location_edit',
|
||||
|
@ -264,7 +264,7 @@ class EntityURLGenerator
|
|||
Part::class => 'part_new',
|
||||
AttachmentType::class => 'attachment_type_new',
|
||||
Category::class => 'category_new',
|
||||
Device::class => 'device_new',
|
||||
Project::class => 'device_new',
|
||||
Supplier::class => 'supplier_new',
|
||||
Manufacturer::class => 'manufacturer_new',
|
||||
Storelocation::class => 'store_location_new',
|
||||
|
@ -295,7 +295,7 @@ class EntityURLGenerator
|
|||
Part::class => 'part_clone',
|
||||
AttachmentType::class => 'attachment_type_clone',
|
||||
Category::class => 'category_clone',
|
||||
Device::class => 'device_clone',
|
||||
Project::class => 'device_clone',
|
||||
Supplier::class => 'supplier_clone',
|
||||
Manufacturer::class => 'manufacturer_clone',
|
||||
Storelocation::class => 'store_location_clone',
|
||||
|
@ -338,7 +338,7 @@ class EntityURLGenerator
|
|||
Part::class => 'part_delete',
|
||||
AttachmentType::class => 'attachment_type_delete',
|
||||
Category::class => 'category_delete',
|
||||
Device::class => 'device_delete',
|
||||
Project::class => 'device_delete',
|
||||
Supplier::class => 'supplier_delete',
|
||||
Manufacturer::class => 'manufacturer_delete',
|
||||
Storelocation::class => 'store_location_delete',
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace App\Services\Tools;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
|
@ -111,7 +111,7 @@ class StatisticsHelper
|
|||
$arr = [
|
||||
'attachment_type' => AttachmentType::class,
|
||||
'category' => Category::class,
|
||||
'device' => Device::class,
|
||||
'device' => Project::class,
|
||||
'footprint' => Footprint::class,
|
||||
'manufacturer' => Manufacturer::class,
|
||||
'measurement_unit' => MeasurementUnit::class,
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace App\Services\Trees;
|
|||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
@ -156,7 +156,7 @@ class ToolsTreeBuilder
|
|||
$this->urlGenerator->generate('category_new')
|
||||
))->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(
|
||||
$this->translator->trans('tree.tools.edit.devices'),
|
||||
$this->urlGenerator->generate('device_new')
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace App\Services\Trees;
|
|||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
|
@ -161,7 +161,7 @@ class TreeViewGenerator
|
|||
return $this->translator->trans('manufacturer.labelp');
|
||||
case Supplier::class:
|
||||
return $this->translator->trans('supplier.labelp');
|
||||
case Device::class:
|
||||
case Project::class:
|
||||
return $this->translator->trans('device.labelp');
|
||||
default:
|
||||
return $this->translator->trans('tree.root_node.text');
|
||||
|
@ -182,7 +182,7 @@ class TreeViewGenerator
|
|||
return $icon . 'fa-industry';
|
||||
case Supplier::class:
|
||||
return $icon . 'fa-truck';
|
||||
case Device::class:
|
||||
case Project::class:
|
||||
return $icon . 'fa-archive';
|
||||
default:
|
||||
return null;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace App\Twig;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
@ -99,7 +99,7 @@ final class EntityExtension extends AbstractExtension
|
|||
Storelocation::class => 'storelocation',
|
||||
Manufacturer::class => 'manufacturer',
|
||||
Category::class => 'category',
|
||||
Device::class => 'device',
|
||||
Project::class => 'device',
|
||||
Attachment::class => 'attachment',
|
||||
Supplier::class => 'supplier',
|
||||
User::class => 'user',
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace App\Twig;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
|
|
@ -11,3 +11,7 @@
|
|||
{% block new_title %}
|
||||
{% trans %}device.new{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block additional_controls %}
|
||||
{{ form_row(form.description) }}
|
||||
{% endblock %}
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
|
@ -32,5 +32,5 @@ use App\Entity\Devices\Device;
|
|||
class DeviceControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static $base_path = '/en'.'/device';
|
||||
protected static $entity_class = Device::class;
|
||||
protected static $entity_class = Project::class;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ use App\Entity\Attachments\AttachmentType;
|
|||
use App\Entity\Attachments\AttachmentTypeAttachment;
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Attachments\DeviceAttachment;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
use App\Entity\Attachments\ManufacturerAttachment;
|
||||
|
@ -36,7 +36,7 @@ use App\Entity\Attachments\PartAttachment;
|
|||
use App\Entity\Attachments\StorelocationAttachment;
|
||||
use App\Entity\Attachments\SupplierAttachment;
|
||||
use App\Entity\Attachments\UserAttachment;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
|
@ -78,7 +78,7 @@ class AttachmentTest extends TestCase
|
|||
[AttachmentTypeAttachment::class, AttachmentType::class],
|
||||
[CategoryAttachment::class, Category::class],
|
||||
[CurrencyAttachment::class, Currency::class],
|
||||
[DeviceAttachment::class, Device::class],
|
||||
[ProjectAttachment::class, Project::class],
|
||||
[FootprintAttachment::class, Footprint::class],
|
||||
[GroupAttachment::class, Group::class],
|
||||
[ManufacturerAttachment::class, Manufacturer::class],
|
||||
|
@ -117,8 +117,8 @@ class AttachmentTest extends TestCase
|
|||
|
||||
/** @var Attachment $attachment */
|
||||
$attachment = new $attachment_class();
|
||||
if (Device::class !== $allowed_class) {
|
||||
$element = new Device();
|
||||
if (Project::class !== $allowed_class) {
|
||||
$element = new Project();
|
||||
} else {
|
||||
$element = new Category();
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ namespace App\Tests\Entity\LogSystem;
|
|||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Devices\DevicePart;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
use App\Entity\LogSystem\AbstractLogEntry;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
@ -82,8 +82,8 @@ class AbstractLogEntryTest extends TestCase
|
|||
[2, Attachment::class],
|
||||
[3, AttachmentType::class],
|
||||
[4, Category::class],
|
||||
[5, Device::class],
|
||||
[6, DevicePart::class],
|
||||
[5, Project::class],
|
||||
[6, ProjectBOMEntry::class],
|
||||
[7, Footprint::class],
|
||||
[8, Group::class],
|
||||
[9, Manufacturer::class],
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace App\Tests\Twig;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
@ -58,7 +58,7 @@ class EntityExtensionTest extends WebTestCase
|
|||
$this->assertEquals('storelocation', $this->service->getEntityType(new Storelocation()));
|
||||
$this->assertEquals('manufacturer', $this->service->getEntityType(new Manufacturer()));
|
||||
$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('supplier', $this->service->getEntityType(new Supplier()));
|
||||
$this->assertEquals('user', $this->service->getEntityType(new User()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue