[Bug 27426] New: Plugin barcode must keep leading zeros
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 Bug ID: 27426 Summary: Plugin barcode must keep leading zeros Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Cataloging Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl If autoBarcode is set to incremental, we are generating the next barcode adding 1, but casting to integer. If you have "0001" "0002" the next barcode will be "3". Should not we keep the leading zeros and generate "0003" instead? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hagud@orex.es Change sponsored?|--- |Sponsored -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 115115 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115115&action=edit Bug 27426: Keep leading zeros for barcode plugin (incremental) If autoBarcode is set to incremental, we are generating the next barcode adding 1, but casting to integer. If you have "0001" "0002" the next barcode will be "3". Should not we keep the leading zeros and generate "0003" instead? This patch suggests to keep them. If this behaviour is not the expected one we could create another barcode plugin. Test plan: Create an item with barcode 0001, another one with 0002 Set autoBarcode=incremental Create another item and click the barcode input With this patch the new barcode will be 0003 Without this patch the barcode was cast to int and resulted in 3 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #2 from David Cook <dcook@prosentient.com.au> --- It's an interesting idea, but I think that it is incompatible with Bug 26328. Explicitly casting to an integer is needed in Bug 26328 because barcode may not be an integer even in a database with autoBarcode set to "incremental", which can cause lots of problems. Hmm one way to solve both Bug 26328 and Bug 27426 could be to use the following SQL: SELECT barcode FROM items WHERE CAST(barcode AS unsigned) ORDER BY CAST(barcode AS unsigned) DESC LIMIT 1; It's an ugly bit of SQL but it should work. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- Btw, we can't use ABS() here because it interprets exponents. For instance, "select abs(978e0143019375)" will actually create an error or "Inf" if it's already stored in a database column. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 Hakam Almotlak <hakam.almotlak@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hakam.almotlak@inLibro.com --- Comment #4 from Hakam Almotlak <hakam.almotlak@inLibro.com> --- hey i applied the patch and it did`t work i still get the last bar code number plus one and without the zeros at the begging -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #5 from David Cook <dcook@prosentient.com.au> --- I should've actually marked this as Failed QA previously. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 --- Comment #6 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to David Cook from comment #3)
Btw, we can't use ABS() here because it interprets exponents. For instance, "select abs(978e0143019375)" will actually create an error or "Inf" if it's already stored in a database column.
How do we process then, David? The patch here has test to prove it is working. I can base it on top of yours, but you need to do what's needed to remove its FQA status. (In reply to Hakam Almotlak from comment #4)
hey i applied the patch and it did`t work i still get the last bar code number plus one and without the zeros at the begging
Please detail what you tried exactly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 --- Comment #7 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #6)
(In reply to David Cook from comment #3)
Btw, we can't use ABS() here because it interprets exponents. For instance, "select abs(978e0143019375)" will actually create an error or "Inf" if it's already stored in a database column.
How do we process then, David? The patch here has test to prove it is working. I can base it on top of yours, but you need to do what's needed to remove its FQA status.
Do you mean for Bug 26328? That tester never responded to my questions. I could re-test it myself, but it could be good to get someone new to test too. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 --- Comment #8 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- It could be nice to provide a test first :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 Eric Bégin <eric.begin@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|hakam.almotlak@inLibro.com | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27426 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrewfh@dubcolib.org --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- *** Bug 30827 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org