[Koha-bugs] [Bug 16202] Rental fees can be generated for fractions of a penny/cent

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jul 22 16:32:58 CEST 2016


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

--- Comment #4 from Colin Campbell <colin.campbell at ptfs-europe.com> ---
(In reply to M. Tompsett from comment #2)
> Comment on attachment 49907 [details] [review]
> Proposed Patch
> 
> Review of attachment 49907 [details] [review]:
> -----------------------------------------------------------------
> 
> ::: C4/Circulation.pm
> @@ +3209,5 @@
> >              my $discount = _get_discount_from_rule($discount_rules, $branch, $item_type);
> >              $charge = ( $charge * ( 100 - $discount ) ) / 100;
> >          }
> > +        if ($charge) {
> > +            $charge = sprintf '%.2f', $charge; # ensure no fractions of a penny returned
> 
> This is not identical to the %.02f from line 984 before. Please add the 0
> back.

The value after the point is the number of decimal places presented the 0 is
meaningless in this context see the printf/sprintf documentation where it is
not used. ( 0 can be used on its own to suppress the decimal part). Using the
precision as documented is less ambiguous

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


More information about the Koha-bugs mailing list