Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PZN8 #188

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Implement PZN8 #188

wants to merge 8 commits into from

Conversation

fostermaier
Copy link
Contributor

Implement PZN8 code generation. Fixes #167.

  • keeping PZN for PZN7, implementing PZN8 for PZN8
  • checksum is commonly part of the PZN* code. Hence, we verify or append the checksum based on the length of the supplied PZN7 or PZN8 code.
  • explicit error messages concerning code length for both classes respectively
  • different checksum calculation for PZN8. see http://www.pruefziffernberechnung.de/P/PZN.shtml

usage

check code length

>>> PZN('12345678')
barcode.errors.NumberOfDigitsError: PZN7 must have 6 digits (excluding checksum) or 7 digits (including checksum), not 8.
>>> PZN8('123456789')
barcode.errors.NumberOfDigitsError: PZN8 must have 7 digits (excluding checksum) or 8 digits (including checksum), not 9.

auto-append checksum

>>> PZN('123456')
<PZN7('PZN-1234562')>
>>> PZN8('1234567')
<PZN8('PZN-12345678')>

verify checksum if supplied

>>> PZN('1234568')
barcode.errors.BarcodeError: Checksum (last digit) is not valid for the supplied PZN7 code.
>>> PZN('1234562')
<PZN7('PZN-1234562')>

resources (mostly german)

samples

PZN7: https://barcode.tec-it.com/de/Health_PZN7
pzn7

PZN8: https://www.softmatic.com/de/barcode-code-pzn.html
pzn8

fostermaier and others added 8 commits November 24, 2022 21:45
pass
    'quiet_zone': 0,
    'margin_top': 0,
    'margin_bottom': 0,
for borderless codes
* verify or append checksum based on code length for PZN7 and PZN8
* explicit error messages for both classes respectively
* different checksum calculation for PZN8
@codecov
Copy link

codecov bot commented Dec 1, 2022

Codecov Report

Base: 80.63% // Head: 80.06% // Decreases project coverage by -0.56% ⚠️

Coverage data is based on head (25cf372) compared to base (3643a65).
Patch coverage: 61.11% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
- Coverage   80.63%   80.06%   -0.57%     
==========================================
  Files          17       17              
  Lines         888      898      +10     
==========================================
+ Hits          716      719       +3     
- Misses        172      179       +7     
Impacted Files Coverage Δ
barcode/codex.py 80.31% <58.82%> (-2.93%) ⬇️
barcode/__init__.py 96.00% <100.00%> (+0.08%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PZN8 support still in planning?
1 participant