mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Use shorter format for barcodes, to generate shorter (better readable) barcodes.
This commit is contained in:
parent
f9f2774f36
commit
3dd0ef26b3
4 changed files with 22 additions and 9 deletions
|
@ -69,15 +69,15 @@ class BarcodeContentGenerator
|
|||
|
||||
/**
|
||||
* Returns a Code that can be used in a 1D barcode.
|
||||
* The return value has a format of "L-000123"
|
||||
* The return value has a format of "L0123"
|
||||
* @param AbstractDBElement $target
|
||||
* @return string
|
||||
*/
|
||||
public function get1DBarcodeContent(AbstractDBElement $target): string
|
||||
{
|
||||
$prefix = $this->classToString(self::PREFIX_MAP, $target);
|
||||
$id = sprintf('%06d', $target->getID());
|
||||
return $prefix . '-' . $id;
|
||||
$id = sprintf('%04d', $target->getID());
|
||||
return $prefix . $id;
|
||||
}
|
||||
|
||||
protected function classToString(array $map, object $target): string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue