Renamed vendor_barcode to user_barcode in entities

This commit is contained in:
Jan Böhmer 2025-01-03 20:55:55 +01:00
parent 03ec4a9f84
commit baa7279adc
9 changed files with 30 additions and 18 deletions

View file

@ -106,7 +106,7 @@ class PartFixtures extends Fixture implements DependentFixtureInterface
$partLot2->setComment('Test'); $partLot2->setComment('Test');
$partLot2->setNeedsRefill(true); $partLot2->setNeedsRefill(true);
$partLot2->setStorageLocation($manager->find(StorageLocation::class, 3)); $partLot2->setStorageLocation($manager->find(StorageLocation::class, 3));
$partLot2->setVendorBarcode('lot2_vendor_barcode'); $partLot2->setUserBarcode('lot2_vendor_barcode');
$part->addPartLot($partLot2); $part->addPartLot($partLot2);
$orderdetail = new Orderdetail(); $orderdetail = new Orderdetail();

View file

@ -68,7 +68,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
#[ORM\Index(columns: ['needs_refill'], name: 'part_lots_idx_needs_refill')] #[ORM\Index(columns: ['needs_refill'], name: 'part_lots_idx_needs_refill')]
#[ORM\Index(columns: ['vendor_barcode'], name: 'part_lots_idx_barcode')] #[ORM\Index(columns: ['vendor_barcode'], name: 'part_lots_idx_barcode')]
#[ValidPartLot] #[ValidPartLot]
#[UniqueEntity(['vendor_barcode'], message: 'validator.part_lot.vendor_barcode_must_be_unique')] #[UniqueEntity(['user_barcode'], message: 'validator.part_lot.vendor_barcode_must_be_unique')]
#[ApiResource( #[ApiResource(
operations: [ operations: [
new Get(security: 'is_granted("read", object)'), new Get(security: 'is_granted("read", object)'),
@ -166,10 +166,10 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/** /**
* @var string|null The content of the barcode of this part lot (e.g. a barcode on the package put by the vendor) * @var string|null The content of the barcode of this part lot (e.g. a barcode on the package put by the vendor)
*/ */
#[ORM\Column(type: Types::STRING, nullable: true)] #[ORM\Column(name: "vendor_barcode", type: Types::STRING, nullable: true)]
#[Groups(['part_lot:read', 'part_lot:write'])] #[Groups(['part_lot:read', 'part_lot:write'])]
#[Length(max: 255)] #[Length(max: 255)]
protected ?string $vendor_barcode = null; protected ?string $user_barcode = null;
public function __clone() public function __clone()
{ {
@ -375,19 +375,19 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* null if no barcode is set. * null if no barcode is set.
* @return string|null * @return string|null
*/ */
public function getVendorBarcode(): ?string public function getUserBarcode(): ?string
{ {
return $this->vendor_barcode; return $this->user_barcode;
} }
/** /**
* Set the content of the barcode of this part lot (e.g. a barcode on the package put by the vendor). * Set the content of the barcode of this part lot (e.g. a barcode on the package put by the vendor).
* @param string|null $vendor_barcode * @param string|null $user_barcode
* @return $this * @return $this
*/ */
public function setVendorBarcode(?string $vendor_barcode): PartLot public function setUserBarcode(?string $user_barcode): PartLot
{ {
$this->vendor_barcode = $vendor_barcode; $this->user_barcode = $user_barcode;
return $this; return $this;
} }

View file

@ -71,8 +71,8 @@ class ScanDialogType extends AbstractType
null => 'scan_dialog.mode.auto', null => 'scan_dialog.mode.auto',
BarcodeSourceType::INTERNAL => 'scan_dialog.mode.internal', BarcodeSourceType::INTERNAL => 'scan_dialog.mode.internal',
BarcodeSourceType::IPN => 'scan_dialog.mode.ipn', BarcodeSourceType::IPN => 'scan_dialog.mode.ipn',
BarcodeSourceType::USER_DEFINED => 'scan_dialog.mode.vendor', BarcodeSourceType::USER_DEFINED => 'scan_dialog.mode.user',
BarcodeSourceType::VENDOR => 'Interpret vendor (digikey for now)' //TODO:translate BarcodeSourceType::VENDOR => 'scan_dialog.mode.eigp'
}, },
]); ]);

View file

@ -103,8 +103,8 @@ class PartLotType extends AbstractType
'help' => 'part_lot.owner.help', 'help' => 'part_lot.owner.help',
]); ]);
$builder->add('vendor_barcode', TextType::class, [ $builder->add('user_barcode', TextType::class, [
'label' => 'part_lot.edit.vendor_barcode', 'label' => 'part_lot.edit.user_barcode',
'help' => 'part_lot.edit.vendor_barcode.help', 'help' => 'part_lot.edit.vendor_barcode.help',
'required' => false, 'required' => false,
]); ]);

View file

@ -220,7 +220,7 @@ final class BarcodeScanHelper
{ {
$lot_repo = $this->entityManager->getRepository(PartLot::class); $lot_repo = $this->entityManager->getRepository(PartLot::class);
//Find only the first result //Find only the first result
$results = $lot_repo->findBy(['vendor_barcode' => $input], limit: 1); $results = $lot_repo->findBy(['user_barcode' => $input], limit: 1);
if (count($results) === 0) { if (count($results) === 0) {
return null; return null;

View file

@ -32,9 +32,9 @@ enum BarcodeSourceType
case INTERNAL; case INTERNAL;
/** This barcode is containing an internal part number (IPN) */ /** This barcode is containing an internal part number (IPN) */
case IPN; case IPN;
/** /**
* This barcode is a custom barcode from a third party like a vendor, which was set via the vendor_barcode * This barcode is a user defined barcode defined on a part lot
* field of a part lot.
*/ */
case USER_DEFINED; case USER_DEFINED;

View file

@ -108,7 +108,7 @@
<div class="collapse" id="{{ id }}"> <div class="collapse" id="{{ id }}">
{{ form_row(form.comment) }} {{ form_row(form.comment) }}
{{ form_row(form.owner) }} {{ form_row(form.owner) }}
{{ form_row(form.vendor_barcode) }} {{ form_row(form.user_barcode) }}
</div> </div>
</td> </td>
<td> <td>

View file

@ -148,7 +148,7 @@ class PartMergerTest extends KernelTestCase
public function testMergeOfPartLots(): void public function testMergeOfPartLots(): void
{ {
$lot1 = (new PartLot())->setAmount(2)->setNeedsRefill(true); $lot1 = (new PartLot())->setAmount(2)->setNeedsRefill(true);
$lot2 = (new PartLot())->setInstockUnknown(true)->setVendorBarcode('test'); $lot2 = (new PartLot())->setInstockUnknown(true)->setUserBarcode('test');
$lot3 = (new PartLot())->setDescription('lot3')->setAmount(3); $lot3 = (new PartLot())->setDescription('lot3')->setAmount(3);
$lot4 = (new PartLot())->setDescription('lot4')->setComment('comment'); $lot4 = (new PartLot())->setDescription('lot4')->setComment('comment');

View file

@ -12263,5 +12263,17 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>Category could not be automatically determined by the info provider. Review the data and select the category manually.</target> <target>Category could not be automatically determined by the info provider. Review the data and select the category manually.</target>
</segment> </segment>
</unit> </unit>
<unit id="v6oyTac" name="part_lot.edit.user_barcode">
<segment>
<source>part_lot.edit.user_barcode</source>
<target>User barcode</target>
</segment>
</unit>
<unit id="dXhegcm" name="scan_dialog.mode.user">
<segment>
<source>scan_dialog.mode.user</source>
<target>User defined barcode (configured at part lot)</target>
</segment>
</unit>
</file> </file>
</xliff> </xliff>