mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-19 18:01:30 +00:00
Enhance barcode format checking in isFormat06Code
Updated isFormat06Code method to handle additional barcode formats for compatibility with older Mouser parts and Eyoyo barcode scanners that don't omit the record separator character
This commit is contained in:
parent
753ecee849
commit
b6e0473252
1 changed files with 9 additions and 5 deletions
|
|
@ -254,12 +254,16 @@ readonly class EIGP114BarcodeScanResult implements BarcodeScanResultInterface
|
||||||
*/
|
*/
|
||||||
public static function isFormat06Code(string $input): bool
|
public static function isFormat06Code(string $input): bool
|
||||||
{
|
{
|
||||||
//Code must begin with [)><RS>06<GS>
|
//Code should begin with [)><RS>06<GS> as per the standard
|
||||||
if(!str_starts_with($input, "[)>\u{1E}06\u{1D}")){
|
if(!str_starts_with($input, "[)>\u{1E}06\u{1D}")
|
||||||
return false;
|
// some codes don't contain record separators
|
||||||
|
&& !str_starts_with($input, "[)>06\u{1D}")
|
||||||
|
// This is found on old Mouser parts
|
||||||
|
&& !str_starts_with($input, ">[)>06\u{1D}"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
//Digikey and Mouser don't put a trailer onto the barcode, so we just check for the header
|
||||||
//Digikey does not put a trailer onto the barcode, so we just check for the header
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue