Bug 9374: The color should manage all zero format.
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 19 Sep 2013 15:03:00 +0000 (17:03 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 1 Nov 2013 00:03:18 +0000 (00:03 +0000)
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>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt

index 3d4cf43..edac2a7 100644 (file)
                               </p>
                             [% END %]
                         </td>
-                        <td class="number gste [% IF books_loo.rrpgste.search('^0.00') %]error[% END %]">[% books_loo.rrpgste %]</td>
-                        <td class="number gste [% IF books_loo.ecostgste.search('^0.00') %]error[% END %]">[% books_loo.ecostgste %]</td>
-                        <td class="number gsti [% IF books_loo.rrpgsti.search('^0.00') %]error[% END %]">[% books_loo.rrpgsti %]</td>
-                        <td class="number gsti [% IF books_loo.ecostgsti.search('^0.00') %]error[% END %]">[% books_loo.ecostgsti %]</td>
-                        <td class="number [% IF books_loo.quantity.search('^0.00') %]error[% END %]">[% books_loo.quantity %]</td>
-                        <td class="number gste [% IF books_loo.totalgste.search('^0.00') %]error[% END %]">[% books_loo.totalgste %]</td>
-                        <td class="number gsti [% IF books_loo.totalgsti.search('^0.00') %]error[% END %]">[% books_loo.totalgsti %]</td>
-                        <td class="number [% IF books_loo.gstgsti.search('^0.00') %]error[% END %]">[% books_loo.gstgsti %]</td>
-                        <td class="number [% IF books_loo.gstvalue.search('^0.00') %]error[% END %]">[% books_loo.gstvalue %]</td>
+                        [% SET zero_regex = "^0{1,}\.?0{1,}[^1-9]" %] [%# 0 or 0.0 or 0.00 or 00 or 00.0 or 00.00 or 0.000 ... %]
+                        <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste %]</td>
+                        <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste %]</td>
+                        <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti %]</td>
+                        <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti %]</td>
+                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
+                        <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste %]</td>
+                        <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti %]</td>
+                        <td class="number [% IF books_loo.gstgsti.search(zero_regex) %]error[% END %]">[% books_loo.gstgsti %]</td>
+                        <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue %]</td>
                         <td>[% books_loo.budget_name %]</td>
                         [% IF ( active ) %]
                             [% UNLESS ( closedate ) %]