[Bug 43650] New: barcode value_builder: EAN13 treated as integer instead of string in JS
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 Bug ID: 43650 Summary: barcode value_builder: EAN13 treated as integer instead of string in JS Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: accounts@nyabla.net QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Target Milestone: --- Created attachment 206873 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206873&action=edit the unexpected sequence of ean-13 barcodes the script treats the barcode as an integer instead of a string, meaning that an unexpected sequence is created (see attachment) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 nela <accounts@nyabla.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|barcode value_builder: |incremental EAN-13 barcodes |EAN13 treated as integer |produce unexpected sequence |instead of string in JS | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 nela <accounts@nyabla.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |accounts@nyabla.net |ity.org | --- Comment #1 from nela <accounts@nyabla.net> --- Created attachment 206874 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206874&action=edit Bug 43650: incremental EAN-13 barcodes produce unexpected sequence -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 nela <accounts@nyabla.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|accounts@nyabla.net |koha-bugs@lists.koha-commun | |ity.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 --- Comment #2 from nela <accounts@nyabla.net> --- (In reply to nela from comment #1)
Created attachment 206874 [details] [review] Bug 43650: incremental EAN-13 barcodes produce unexpected sequence
When incremental EAN-13 barcodes are selected for autoBarcode and new item records are created an unexpected sequence of barcode numbers is produced instead of a sequence where the barcode is incremented by 1 between each item. This patch fixes that by adding quote marks in the inline JS, thus treating the barcode as a string rather than an integer :+) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 nela <accounts@nyabla.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #3 from David Cook <dcook@prosentient.com.au> --- Hmm sounds interesting. I'll take a look! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- Ah yes I see. On KTD, I set autoBarcode to "incremental EAN-13 barcodes." and then created 2 items and it went from "3999900000029" to "3999900000036". That's wild. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 --- Comment #5 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #4)
Ah yes I see. On KTD, I set autoBarcode to "incremental EAN-13 barcodes." and then created 2 items and it went from "3999900000029" to "3999900000036". That's wild.
Ah wait... no that's right because the final number is a check digit. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 --- Comment #6 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #5)
(In reply to David Cook from comment #4)
Ah yes I see. On KTD, I set autoBarcode to "incremental EAN-13 barcodes." and then created 2 items and it went from "3999900000029" to "3999900000036". That's wild.
Ah wait... no that's right because the final number is a check digit.
But yes if I delete all items and start from nothing... then I see that pattern of " 0000000000017" followed by "0000000000208"... For the second barcode, the generated code is: $('#' + id).val(incrementEAN13(0000000000024, offset)); And that gets warped into 0000000000208 That's neat... console.log(String('0000000000024')); 0000000000024 console.log(String(0000000000024)); 20 And it looks like that's because 0000000000024 is considered to be an octal number: console.log(0000000000024); console.log(024); VM4046:1 20 And that explains why the bug would only appear for a fresh database because there is no prefix aside from zeroes. Neato... -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |accounts@nyabla.net |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 --- Comment #7 from David Cook <dcook@prosentient.com.au> --- How I loathe Koha's barcode generating code 😅 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |dcook@prosentient.com.au |y.org | Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206874|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 --- Comment #8 from David Cook <dcook@prosentient.com.au> --- Created attachment 206891 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206891&action=edit Bug 43650: incremental EAN-13 barcodes produce unexpected sequence When incremental EAN-13 barcodes are selected for autoBarcode and new item records are created an unexpected sequence of barcode numbers is produced instead of a sequence where the barcode is incremented by 1 between each item. This patch fixes that by adding quote marks in the inline JS, thus treating the barcode as a string rather than an integer :+) Test plan: 1. have records imported from somewhere but with no items 2. autoBarcode set to incremental EAN-13 barcodes 3. create a number of new items 4. observe that the item barcodes don't follow the expected sequence 5. apply patch 6. delete item records 7. repeat step 3 8. observe that the item barcodes follow the expected sequence Signed-off-by: David Cook <dcook@prosentient.com.au> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #9 from David Cook <dcook@prosentient.com.au> --- Going to move this all the way through to Passed QA since it's a simple well understood change. Thanks, nela! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43650 --- Comment #10 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org