From c56ffcdb9082ddf70448bf6b8760715eafcb2201 Mon Sep 17 00:00:00 2001 From: Thibaud Guillot Date: Thu, 18 Jan 2024 09:28:29 +0100 Subject: [PATCH] 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 --- .../intranet-tmpl/prog/en/includes/validator-strings.inc | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc index 87dde3e610..578b51da82 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc @@ -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.")), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index fae8f92e65..b100ed34e9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -346,7 +346,7 @@ [% END %]
  • - %
  • + %
  • days diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index ab24a9304e..36f50149f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -119,6 +119,10 @@ $(document).ready(function() { number: true }); + jQuery.validator.addClassRules("rate", { + decimal_rate: true + }); + $("#logout").on("click",function(){ logOut(); }); -- 2.30.2