Summary: | Barcode image generator doesn't generate correct Code39 barcode | ||
---|---|---|---|
Product: | Koha | Reporter: | Kevin Furst <kfurst> |
Component: | Tools | Assignee: | David Cook <dcook> |
Status: | CLOSED FIXED | QA Contact: | Victor Grousset/tuxayo <victor> |
Severity: | normal | ||
Priority: | P5 - low | CC: | dcook, fridolin.somers, victor |
Version: | 23.05 | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
23.11.00,23.05.04,22.11.11
|
|
Circulation function: | |||
Attachments: |
Code39 Examples
Label creator and barcode generator create different barcodes Bug 34732: For Code39, append or prepend asterisk if missing from barcode Bug 34732: For Code39, append or prepend asterisk if missing from barcode Bug 34732: For Code39, append or prepend asterisk if missing from barcode Bug 34732: (QA follow-up): tidy up code |
Created attachment 155282 [details]
Label creator and barcode generator create different barcodes
Thanks for the report, Kevin. I've been using Koha for over 11 years and this is the first time I've actually noticed the "Barcode image generator" tool. I typically use the "Label creator" and have had no issues with it in the past. But it looks like you're right. I've attached a screenshot comparing the two tools, and it looks like the "Barcode image generator" is missing some of the start and end of the barcode. I'll take a quick look and see if I can find anything obvious... (In reply to David Cook from comment #2) > I've been using Koha for over 11 years and this is the first time I've > actually noticed the "Barcode image generator" tool. I typically use the > "Label creator" and have had no issues with it in the past. Looks like the tool was added in Koha 22.05 so quite a recent feature, although the underlying barcode generation is much older, and I am sure I've used it for other things... (In reply to David Cook from comment #2) > But it looks like you're right. I've attached a screenshot comparing the two > tools, and it looks like the "Barcode image generator" is missing some of > the start and end of the barcode. Deep in the code, the "Label creator" puts a "*" at the start and end of the stored text barcode value before generating the barcode image. But the "Barcode image generator" doesn't do that automatically for you. To generate the barcode as you expect, you'd need to add the "*" to the start and end of your barcode before clicking "Show barcode". I suppose the question is whether or not we should have some automatic adding of the "*" prefix and suffix if it's not supplied... We've run into the same issue. When using in notices we add the * before and after what we want to print and that fixes the issue. I think it would be great to test for these and add them if not present. It's not obvious for users and it took us quite some research to figure it out :) (In reply to Katrin Fischer from comment #5) > We've run into the same issue. When using in notices we add the * before and > after what we want to print and that fixes the issue. > > I think it would be great to test for these and add them if not present. > It's not obvious for users and it took us quite some research to figure it > out :) Sounds like a plan. It should be easy enough to do. Created attachment 155350 [details] [review] Bug 34732: For Code39, append or prepend asterisk if missing from barcode This patch appends or prepends an asterisk on Code39 barcodes if they are missing from the input. This is so that they form correct Code39 barcode images. Test plan: 0. Apply the patch 1. koha-plack --reload kohadev 2. Go to http://localhost:8081/cgi-bin/koha/labels/barcode-print.pl 3. Type 39999000001310 into "Barcode" and click "Show barcode" 4. Note that the barcode text on the right includes asterisks around it 5. Type *39999000001310 into "Barcode" and click "Show barcode" 6. Note the same as above 7. Type 39999000001310* into "Barcode" and click "Show barcode" 8. Note the same as above 9. Type *39999000001310* into "Barcode" and click "Show barcode" 10. Note the same as above Created attachment 155391 [details] [review] Bug 34732: For Code39, append or prepend asterisk if missing from barcode This patch appends or prepends an asterisk on Code39 barcodes if they are missing from the input. This is so that they form correct Code39 barcode images. Test plan: 0. Apply the patch 1. koha-plack --reload kohadev 2. Go to http://localhost:8081/cgi-bin/koha/labels/barcode-print.pl 3. Type 39999000001310 into "Barcode" and click "Show barcode" 4. Note that the barcode text on the right includes asterisks around it 5. Type *39999000001310 into "Barcode" and click "Show barcode" 6. Note the same as above 7. Type 39999000001310* into "Barcode" and click "Show barcode" 8. Note the same as above 9. Type *39999000001310* into "Barcode" and click "Show barcode" 10. Note the same as above Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> For some reason GD::Barcode commented the addition of the surrounding "*" :o https://metacpan.org/release/KWITKNR/GD-Barcode-1.15/source/Barcode/Code39.pm#L85 19 years since last update but there is a more recent fork. I contacted both maintainers to know if they are still active in the maintenance of this package. To then know if there is a reason to not have the surrounding "*" added. At least having the choice with a different method or params. Maybe the root of the problem is this: > This code is traditionally mapped to the * character in barcode fonts and will often appear with the human-readable representation alongside the barcode https://en.wikipedia.org/wiki/Code_39 Anyway given all that context, the proposed fix here makes sense. Testing in progress. Created attachment 155708 [details] [review] Bug 34732: For Code39, append or prepend asterisk if missing from barcode This patch appends or prepends an asterisk on Code39 barcodes if they are missing from the input. This is so that they form correct Code39 barcode images. Test plan: 0. Apply the patch 1. koha-plack --reload kohadev 2. Go to http://localhost:8081/cgi-bin/koha/labels/barcode-print.pl 3. Type 39999000001310 into "Barcode" and click "Show barcode" 4. Note that the barcode text on the right includes asterisks around it 5. Type *39999000001310 into "Barcode" and click "Show barcode" 6. Note the same as above 7. Type 39999000001310* into "Barcode" and click "Show barcode" 8. Note the same as above 9. Type *39999000001310* into "Barcode" and click "Show barcode" 10. Note the same as above Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 155709 [details] [review] Bug 34732: (QA follow-up): tidy up code Works, makes sense, QA script happy, code looks good, passing QA :) (double checked scanning with a phone before and after the patch) Pushed to master for 23.11. Nice work everyone, thanks! Pushed to 23.05.x for 23.05.04 Nice work everyone! Pushed to oldstable for 22.11.x |
Created attachment 155281 [details] Code39 Examples When using the barcode generator tool in Koha with the code39 settings, the barcode image it generates is not a code39 barcode and thus can't be read by our book scanners at checkout desks. I'm not sure what type of barcode it is but the generated image does not have the telltale opening and closing lines of a code39. I've attached two screenshots. The first is from the Koha tool with the non-working barcode. The second is from another barcode generating tool that makes a barcode exactly the same as the one on the book I have (already in the catalog). The number it is using is 34517100048832 We're new to Koha so this has been happening since we started using it this summer. Expected behavior would be for it to generate the correct barcode image for a code39 barcode.