[Koha-bugs] [Bug 18736] Problems in order calculations (rounding errors)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jan 17 19:33:45 CET 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18736

--- Comment #19 from M. Tompsett <mtompset at hotmail.com> ---
Comment on attachment 70188
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70188
Bug 18736 - Use rounding syspref to determine correct prices in calculations

Review of attachment 70188:
 --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=18736&attachment=70188)
-----------------------------------------------------------------

::: C4/Acquisition.pm
@@ +2010,5 @@
> +
> +sub _get_rounding_sql {
> +    my $round_string = @_;
> +    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
> +    if ( $rounding_pref eq "nearest_cent"  ) { return ("ROUND($round_string,2)"); }

ROUND() is not ANSI SQL.
CEIL($round_string*100)/100 would be ANSI SQL 2003, I believe.

::: C4/Budgets.pm
@@ +1291,5 @@
> +
> +sub _get_rounding_sql {
> +    my $to_round = shift;
> +    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
> +    if   ($rounding_pref eq 'nearest_cent') { return "ROUND($to_round,2)"; }

Same problem here. Not ANSI SQL.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list