Bug 9374 - In baskets, prices between 0 and 1 are displayed in red
Summary: In baskets, prices between 0 and 1 are displayed in red
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Mathieu Saby
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-09 15:55 UTC by Mathieu Saby
Modified: 2015-06-04 23:23 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
[PATCH] Bug 9374: Only 0.00 prices must have class error in basket.tt (3.80 KB, patch)
2013-09-15 11:16 UTC, Mathieu Saby
Details | Diff | Splinter Review
Bug 9374: Only 0.00 prices must have class error in basket.tt (3.70 KB, patch)
2013-09-19 14:37 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 9374: Only 0.00 prices must have class error in basket.tt (3.76 KB, patch)
2013-09-20 07:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 9374: The color should manage all zero format. (3.75 KB, patch)
2013-09-20 07:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
pic of a basket with several prices (24.78 KB, image/png)
2013-09-20 07:47 UTC, Jonathan Druart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Saby 2013-01-09 15:55:34 UTC
Very cosmetic bug : 

In a basket, if some prices are between 0 and 1, they are displayed in red, with class = "number error".
For example, a VAT of 0.89 euros is displayed in red.
In don't think it is normal.
this behavior was introduced by http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7112

M. Saby
Rennes 2 university
Comment 1 Mathieu Saby 2013-09-15 11:16:09 UTC Comment hidden (obsolete)
Comment 2 cedric.vita 2013-09-19 13:49:59 UTC
Signing patches on sandbox (test1) did not work.
Thank you to "Sign-off" on.
Comment 3 Jonathan Druart 2013-09-19 14:37:24 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2013-09-20 07:43:29 UTC
Created attachment 21265 [details] [review]
Bug 9374: Only 0.00 prices must have class error in basket.tt

A regexp '^0' in basket.tt is used to give the class "error" to null prices.
It is wrong, because it matches prices like "0.15". It should only match "0.00".

To test :
- apply the patch
- display a basket with an order with a price between 0 and 1 (like "0.50") and an order with a price stricty null ("0.00")
- only the "0.00" price should be displayed in red

Signed-off-by: Cedric Vita <cedric.vita@dracenie.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 5 Jonathan Druart 2013-09-20 07:43:34 UTC
Created attachment 21266 [details] [review]
Bug 9374: The color should manage all zero format.

The format of prices in Koha is discuted in some bugs (e.g. 9410).
The good way will be to introduce a syspref in order to deal with the
number of decimal.
The previous patch is too restrictive, we should deal with other zero
format.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 6 Mathieu Saby 2013-09-20 07:46:21 UTC
I did not know bug 9410...
As you rewrite the patch, I suppose it need an other sign off ?

Mathieu
Comment 7 Jonathan Druart 2013-09-20 07:47:05 UTC
Created attachment 21268 [details]
pic of a basket with several prices
Comment 8 Galen Charlton 2013-09-21 21:32:34 UTC
Bugs 10792 and 10929 are somewhat related, as they touch on the general problem of  displaying monetary amounts.

Jonathan's follow-up patch bandaids the situation, but would become awkward if (say) the currency symbol started being displayed in the table.

The approach I'm proposing in my WIP branch for bug 10929 would instead just pass the numeric currency amount to the template and rely on TT filters to format it for display.  This, in turn, would mean that rather than having to use delicate regexes to see if an amount is zero, the template could simply do a numeric test.

I'll probably push the patches for this bug as is, but slap a FIXME on them, as the currency formatting revamp will simplify the template logic.
Comment 9 Jonathan Druart 2013-10-25 10:01:11 UTC
(In reply to Galen Charlton from comment #8)
> Bugs 10792 and 10929 are somewhat related, as they touch on the general
> problem of  displaying monetary amounts.

For information, I proposed a similar way in bug 9410.
Comment 10 Galen Charlton 2013-11-01 00:09:14 UTC
Pushed to master, along with a follow-up adding the promised FIXME.  Thanks, Mathieu!
Comment 11 Tomás Cohen Arazi 2013-12-05 19:02:08 UTC
This patch has been pushed to 3.12.x, will be in 3.12.8.

Thanks Mathieu!