Summary: | barcode not incrementing | ||
---|---|---|---|
Product: | Koha | Reporter: | Nicole C. Engard <nengard> |
Component: | Cataloging | Assignee: | Galen Charlton <gmcharlt> |
Status: | CLOSED FIXED | QA Contact: | Bugs List <koha-bugs> |
Severity: | normal | ||
Priority: | P5 - low | CC: | koha.sekjal, magnus, veron |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: |
Description
Nicole C. Engard
2011-10-06 12:35:27 UTC
Could this be similar to the problem described in bug 6944? that's why i included the barcode in question .. in case it is the same problem, but i don't know how to find out. Try something like "update <table> set <column> = 2345678765345432 where <column> = 2345678765345431;" and see what happens, maybe? mysql> update items set barcode = 2345678765345432 where barcode = 2345678765345431; Query OK, 0 rows affected (0.01 sec) Rows matched: 0 Changed: 0 Warnings: 0 It seems that it is an issue of representation of numbers in Perl. Up to a certain value they are repersented as integers, then as float, and that leads to a loss of precision. I did the following test: Using MySQL, set the highest value in the table to 2345678765345430 Adding an item, the form displays 2345678765345431 (as expected) Following item sticks with 2345678765345431 (as described in the bug report) However: I you set the value to 2345678765345435 the form will show a value of 2345678765345441 (!) This is the code snippet in barcode.pl (around line 90): ----snip---- elsif ($autoBarcodeType eq 'incremental') { # not the best, two catalogers could add the same barcode easily this way :/ $query = "select max(abs(barcode)) from items"; my $sth = $dbh->prepare($query); $sth->execute(); while (my ($count)= $sth->fetchrow_array) { $nextnum = $count; } $nextnum++; } ----end snip---- About numbers in Perl: http://perldoc.perl.org/perlnumber.html Maybe the issue could be solved with http://perldoc.perl.org/Math/BigInt.html Following questions should be considered: - Side effects with BigInt? - If the correct new number can be transferred into the java script code, what happens when writing back the number into the database? - What about the comment in the code snippet: # not the best, two catalogers could add the same barcode easily this way :/ ? Could be resolved together with Bug 7911 - Greater flexibility in auto barcode number generation Could no longer reproduce the issue on current master 3.19.00.005 |