Bug 35087: Discount rate only accepts a point as decimal separator

When a comma is used to define the discount rate of a vendor,
the data is not recorded (as NULL), it is however recorded if the
separator is a point.

Test plan:

1) Go to acqui module and edit a vendor
2) Set a discount rate with a comma as decimal separator
3) Edit again or request your database to see that there is no data
   saved
4) Do it again with a point as decimal and see it works
5) Apply this patch and reloard the build for the templates
 6) Repeat step 2 and see the warning to inform you that you must use a
    point

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Sonia <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit ebc2568109)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Thibaud Guillot 2024-01-18 09:28:29 +01:00 committed by Lucas Gass
parent 7449473418
commit 1625835375
3 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,7 @@
digits: _("Please enter only digits."),
equalTo: _("Please enter the same value again."),
number: _("Please add amount in valid format: 0.00"),
decimal_rate: $.validator.addMethod("decimal_rate", $.validator.methods.number, "Please add rate in valid format: 0.00"),
maxlength: $.validator.format(_("Please enter no more than {0} characters.")),
minlength: $.validator.format(_("Please enter at least {0} characters.")),
rangelength: $.validator.format(_("Please enter a value between {0} and {1} characters long.")),

View File

@ -358,7 +358,7 @@
<input type="hidden" name="tax_rate" value="0" />
[% END %]
<li><label for="discount">Discount: </label>
<input type="text" size="6" id="discount" name="discount" value="[% discount | format ('%.1f') %]" />%</li>
<input class="rate" type="text" size="6" id="discount" name="discount" value="[% discount | format ('%.1f') %]" />%</li>
<li>
<label for="deliverytime">Delivery time: </label>
<input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime | html %]" /> days

View File

@ -139,6 +139,10 @@ $(document).ready(function () {
number: true,
});
jQuery.validator.addClassRules("rate", {
decimal_rate: true
});
$("#logout").on("click", function () {
logOut();
});