[Koha-bugs] [Bug 6981] barcode not incrementing
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Sun Apr 15 15:35:39 CEST 2012
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6981
Marc Véron <veron at veron.ch> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |veron at veron.ch
--- Comment #5 from Marc Véron <veron at veron.ch> ---
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 :/ ?
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list