Bug 9410 - Formatting of the discount field when doing a new order from new empty record is not correct
Summary: Formatting of the discount field when doing a new order from new empty record...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Hugh Davenport
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-16 23:07 UTC by Hugh Davenport
Modified: 2017-12-07 22:15 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
bug 9410 Fix formatting of discount rate (1.69 KB, patch)
2013-01-16 23:19 UTC, Hugh Davenport
Details | Diff | Splinter Review
bug 9410 Fix formatting of discount rate (1.73 KB, patch)
2013-02-15 12:36 UTC, Kyle M Hall
Details | Diff | Splinter Review
[ALT] Bug 9410: Draft: TT Plugin for formatting prices, etc. (21.88 KB, patch)
2013-07-19 10:52 UTC, Jonathan Druart
Details | Diff | Splinter Review
[ALT] Bug 9410: Draft: TT Plugin for formatting prices, etc. (22.26 KB, patch)
2013-09-20 07:45 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Hugh Davenport 2013-01-16 23:07:16 UTC
Discount shows 4 decimal places, it should show 1 like other places that show discount rate
Comment 1 Hugh Davenport 2013-01-16 23:19:56 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2013-02-15 12:36:20 UTC
Created attachment 15354 [details] [review]
bug 9410 Fix formatting of discount rate

The formatting for discount doesn't limit the number of decimal points
for the discount rate when creating a new order from an empty record.

This patch fixes that by limiting it to 2dp

Signed-off-by: Hugh Davenport <hugh@davenport.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 3 Jonathan Druart 2013-05-23 12:28:11 UTC
The aqorders.discount field is a float(6,4) in DB. If we limit the value to 2 in the interface, we should limit the number of decimals in the DB structure too.

However, maybe the 4 decimals are used by some library (hum... it should be surprising).

Switch to in discussion.
Comment 4 Jonathan Druart 2013-05-23 12:31:51 UTC
I just seen you already submitted a patch for the supplier form (bug 9062).
You limited the discount value to 1 decimal, we have to be consistent.
2 is certainly the best choice, but in this case a patch for the supplier form is required (and maybe for DB changes).
Comment 5 Hugh Davenport 2013-07-05 21:17:58 UTC
Hi Jonathan,

I would agree, prehaps we should make another bug for changing the patch made in bug 9062 to use 2dp as well, and push this one through as is, as long as everyone is happy with that.

Cheers,

Hugh
Comment 6 Jonathan Druart 2013-07-08 08:37:22 UTC
Ok, switch back to Signed Off and let someone else qa this patch.
Comment 7 Katrin Fischer 2013-07-14 13:46:38 UTC
Hm, there is some inconsistency in how we format tax and discount in various places in Koha:

Tax: Available tax values are controlled by system preference gist. It's possible to enter values <1% there but the display shows max 2dp%. 
Example: gist: 0.066, display when selecting: 0.7%, display in order summary page: 2dp.

tax
any    gist (input field, no validation)
1dp


discount
1dp    Vendor - summary
1dp    Vendor - edit (display of saved value)
any    Vendor - edit (input field, no validation)

2dp    Order - order line edit/add (with patch)
-      Order - summary, doesn't show discount
-      Receive, doesn't show discount
Comment 8 Katrin Fischer 2013-07-14 13:54:33 UTC
Accidentally submitted the form earlier, let's try that again:

There is some inconsistency in how we format tax and discount in various places in Koha:

Tax: Available tax values are controlled by system preference gist. It's possible to enter values <1% there but the display shows max 2dp%. 
Example: gist: 0.066, display in pull down: 0.7%, display in order summary page 0.66.

tax
any    gist (input field, no validation)
1dp    pull down used for add/edit/modify in vendor and order lines
1dp    Order - summary, rounded
2dp    Receive - summary


discount
1dp    Vendor - summary
1dp    Vendor - edit (display of saved value)
any    Vendor - edit (input field, no validation)

2dp    Order - order line edit/add (with patch)
-      Order - summary, doesn't show discount
-      Receive - summary, doesn't show the discount

So we have some mismatch here - I am not sure right now how to solve it. Can we get some opinions on this?
Comment 9 Jonathan Druart 2013-07-19 10:52:29 UTC Comment hidden (obsolete)
Comment 10 Jonathan Druart 2013-07-19 10:53:24 UTC
I think template plugin is much more appropriate in this case. What do you think about this patch?
Comment 11 Jonathan Druart 2013-09-20 07:45:46 UTC
Created attachment 21267 [details] [review]
[ALT] Bug 9410: Draft: TT Plugin for formatting prices, etc.
Comment 12 Jonathan Druart 2013-09-20 07:46:32 UTC
What about my proposed patch?
Comment 13 Marc Véron 2016-10-03 15:39:40 UTC
Still valid?
Comment 14 Jonathan Druart 2016-10-04 08:13:39 UTC
(In reply to Marc Véron from comment #13)
> Still valid?

Yes, the way to go is to use the TT plugin added by bug 12844.
Comment 15 Jonathan Druart 2016-10-04 08:14:10 UTC
(In reply to Jonathan Druart from comment #11)
> Created attachment 21267 [details] [review] [review]
> [ALT] Bug 9410: Draft: TT Plugin for formatting prices, etc.

This is now in, see bug 12844.
Comment 16 Jonathan Druart 2017-01-03 08:27:45 UTC
This has been fixed.