Skip to content

Commit bed3468

Browse files
Merge branch 'picqer:main' into main
2 parents cc333ce + b98f110 commit bed3468

11 files changed

+227
-131
lines changed

Readme.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ It creates SVG, PNG, JPG and HTML images, from the most used 1D barcode standard
88
*The codebase is based on the [TCPDF barcode generator](https://github.com/tecnickcom/TCPDF) by Nicola Asuni. This code is therefor licensed under LGPLv3.*
99

1010
## No support for...
11-
We do not support any 2D barcodes, like QR codes. We also only generate the 'bars' part of a barcode. If you want text of the code below the barcode, you could add it later to the output of this package.
11+
- No support for any **2D** barcodes, like QR codes.
12+
- We only generate the 'bars' part of a barcode, without text below the barcode. If you want text of the code below the barcode, you could add it later to the output of this package.
1213

1314
## Installation
1415
Install through [composer](https://getcomposer.org/doc/00-intro.md):

src/Types/TypeCode39.php

-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ public function getBarcodeData(string $code): Barcode
7070
throw new InvalidLengthException('You should provide a barcode string.');
7171
}
7272

73-
$code = strtoupper($code);
74-
7573
if ($this->extended) {
7674
// extended mode
7775
$code = $this->encode_code39_ext($code);

src/Types/TypeStandard2of5.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,12 @@ public function getBarcodeData(string $code): Barcode
2626
$chr['5'] = '11101011101010';
2727
$chr['6'] = '10111011101010';
2828
$chr['7'] = '10101011101110';
29-
$chr['8'] = '10101110111010';
29+
$chr['8'] = '11101010111010';
3030
$chr['9'] = '10111010111010';
3131
if ($this->checksum) {
3232
// add checksum
3333
$code .= $this->checksum_s25($code);
3434
}
35-
if ((strlen($code) % 2) != 0) {
36-
// add leading zero if code-length is odd
37-
$code = '0' . $code;
38-
}
3935
$seq = '11011010';
4036

4137
for ($i = 0; $i < strlen($code); ++$i) {

tests/TypesTest.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,27 @@ class TypesTest extends TestCase
77
public function test_generator_can_generate_code_39_barcode()
88
{
99
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
10-
$result = $generator->getBarcode('1234567890abcABC', $generator::TYPE_CODE_39);
10+
$result = $generator->getBarcode('1234567890ABC', $generator::TYPE_CODE_39);
1111

12-
$this->assertStringEqualsFile('tests/verified-files/C39-1234567890abcABC.svg', $result);
12+
$this->assertStringEqualsFile('tests/verified-files/C39-1234567890ABC.svg', $result);
1313
}
1414

1515
public function test_generator_can_generate_code_39_checksum_barcode()
1616
{
1717
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
18-
$result = $generator->getBarcode('1234567890abcABC', $generator::TYPE_CODE_39_CHECKSUM);
18+
$result = $generator->getBarcode('1234567890ABC', $generator::TYPE_CODE_39_CHECKSUM);
1919

2020
$this->assertGreaterThan(100, strlen($result));
2121
}
2222

23+
public function test_generator_can_generate_code_39_extended_barcode()
24+
{
25+
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
26+
$result = $generator->getBarcode('1234567890abcABC', $generator::TYPE_CODE_39E);
27+
28+
$this->assertStringEqualsFile('tests/verified-files/C39E-1234567890abcABC.svg', $result);
29+
}
30+
2331
public function test_generator_can_generate_code_39_extended_checksum_barcode()
2432
{
2533
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();

tests/VerifiedBarcodeTest.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
class VerifiedBarcodeTest extends TestCase
1515
{
1616
public static $supportedBarcodes = [
17-
['type' => BarcodeGenerator::TYPE_CODE_39, 'barcodes' => ['1234567890abcABC']],
18-
['type' => BarcodeGenerator::TYPE_CODE_39_CHECKSUM, 'barcodes' => ['1234567890abcABC']],
17+
['type' => BarcodeGenerator::TYPE_CODE_39, 'barcodes' => ['1234567890ABC']],
18+
['type' => BarcodeGenerator::TYPE_CODE_39_CHECKSUM, 'barcodes' => ['1234567890ABC']],
19+
['type' => BarcodeGenerator::TYPE_CODE_39E, 'barcodes' => ['1234567890abcABC']],
1920
['type' => BarcodeGenerator::TYPE_CODE_39E_CHECKSUM, 'barcodes' => ['1234567890abcABC']],
2021
['type' => BarcodeGenerator::TYPE_CODE_93, 'barcodes' => ['1234567890abcABC']],
2122
['type' => BarcodeGenerator::TYPE_STANDARD_2_5, 'barcodes' => ['1234567890']],

tests/verified-files/C39-1234567890abcABC.svg renamed to tests/verified-files/C39+-1234567890ABC.svg

+11-21
Loading

tests/verified-files/C39+-1234567890abcABC.svg renamed to tests/verified-files/C39-1234567890ABC.svg

+6-26
Loading

tests/verified-files/C39E+-1234567890abcABC.svg

+37-22
Loading
Loading

0 commit comments

Comments
 (0)