[Bug 7528] New: amount subtracting 1 cent
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 Bug #: 7528 Summary: amount subtracting 1 cent Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Platform: All OS/Version: All Status: NEW Severity: critical Priority: P5 - low Component: Acquisitions AssignedTo: henridamien@koha-fr.org ReportedBy: nengard@gmail.com QAContact: koha.sekjal@gmail.com When adding an order if you enter an amount and hit tab it puts the amount minus 1 cent in the next couple fields - see here: http://screencast.com/t/SbVVtte8zHvk It's crazy - and critical that it be fixed. Nicole -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |In Discussion CC| |veron@veron.ch --- Comment #1 from Marc Véron <veron@veron.ch> --- This one has to do with floating point precision in JavaScript. In koha-tmpl/intranet-tmpl/prog/en/js/acq.js function calcNeworderTotal() we have at line number 667: var ecost = new Number(Math.floor(rrp * (100 - discount ))/100); If discount rrp is 35.55 and discount is 0.00, we get a calculation 35.55*100 In JavaScript, this evaluates to 3554.9999999999995 which then is rounded down to the next deeper integer (floor) = 3554, divided by 100 = 35.54 Same can happen with other values. As a quick workaround I replaced the line with: var ecost = rrp; if (100-discount != 100) { //Prevent rounding issues if no discount ecost = new Number(Math.floor(rrp * (100 - discount ))/100); } Now, the field gets always the correct value if there is no discount. Note: With some discount there still could be some tiny rounding errors by 1 cent. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 --- Comment #2 from Marc Véron <veron@veron.ch> --- Created attachment 9207 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=9207&action=edit Bug 7528 - amount subtracting 1 cent Rounding issue with JavaScript and float numbers, JavaScript changed to do no calculation if discount is 0 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 Ian Walls <koha.sekjal@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #3 from Ian Walls <koha.sekjal@gmail.com> --- Javascript only change to prevent discount calculation if there is no discount to calculate. Marking as Signed Off and Passed QA in one go. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 --- Comment #4 from Ian Walls <koha.sekjal@gmail.com> --- Created attachment 9218 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=9218&action=edit Bug 7528 - amount subtracting 1 cent Rounding issue with JavaScript and float numbers, JavaScript changed to do no calculation if discount is 0 Signed-off-by: Ian Walls <koha.sekjal@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 Ian Walls <koha.sekjal@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #9207|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 Ian Walls <koha.sekjal@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |paul.poulain@biblibre.com Version|master |rel_3_8 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7528 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|rel_3_8 |rel_3_6 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org