Added internal part number field to parts

This commit is contained in:
Jan Böhmer 2022-12-04 02:28:47 +01:00
parent 81abf36867
commit b1d359f538
12 changed files with 123 additions and 3 deletions

View file

@ -153,6 +153,10 @@ final class PartsDataTable implements DataTableTypeInterface
'label' => $this->translator->trans('part.table.id'),
'visible' => false,
])
->add('ipn', TextColumn::class, [
'label' => $this->translator->trans('part.table.ipn'),
'visible' => false,
])
->add('description', MarkdownColumn::class, [
'label' => $this->translator->trans('part.table.description'),
]);

View file

@ -37,6 +37,7 @@ use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
@ -49,7 +50,9 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Table("`parts`", indexes={
* @ORM\Index(name="parts_idx_datet_name_last_id_needs", columns={"datetime_added", "name", "last_modified", "id", "needs_review"}),
* @ORM\Index(name="parts_idx_name", columns={"name"}),
* @ORM\Index(name="parts_idx_ipn", columns={"ipn"}),
* })
* @UniqueEntity(fields={"ipn"}, message="part.ipn.must_be_unique")
*/
class Part extends AttachmentContainingDBElement
{

View file

@ -50,6 +50,14 @@ trait AdvancedPropertyTrait
*/
protected ?float $mass = null;
/**
* @var string The internal part number of the part
* @ORM\Column(type="string", length=100, nullable=true, unique=true)
* @Assert\Length(max="100")
*
*/
protected ?string $ipn = null;
/**
* Checks if this part is marked, for that it needs further review.
*/
@ -117,4 +125,26 @@ trait AdvancedPropertyTrait
return $this;
}
/**
* Returns the internal part number of the part.
* @return string
*/
public function getIpn(): ?string
{
return $this->ipn;
}
/**
* Sets the internal part number of the part
* @param string $ipn The new IPN of the part
* @return Part
*/
public function setIpn(?string $ipn): Part
{
$this->ipn = $ipn;
return $this;
}
}

View file

@ -50,6 +50,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use function Sodium\add;
class PartBaseType extends AbstractType
{
protected Security $security;
@ -169,6 +171,11 @@ class PartBaseType extends AbstractType
'required' => false,
'disable_not_selectable' => true,
'label' => 'part.edit.partUnit',
])
->add('ipn', TextType::class, [
'required' => false,
'empty_data' => null,
'label' => 'part.edit.ipn',
]);
//Comment section

View file

@ -130,7 +130,9 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
public function postUp(Schema $schema): void
{
parent::postUp($schema);
$this->logger->warning('<question>[!!!] Permissions were updated! Please check if they fit your expectations!</question>');
if($this->permissions_updated) {
$this->logger->warning('<question>[!!!] Permissions were updated! Please check if they fit your expectations!</question>');
}
if (!empty($this->admin_pw)) {
$this->logger->warning('');