Bugzilla – Attachment 158921 Details for
Bug 35087
Discount rate should only allow valid input formats
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35087: Discount rate only accepts a point as decimal separator
Bug-35087-Discount-rate-only-accepts-a-point-as-de.patch (text/plain), 3.66 KB, created by
Thibaud Guillot (thibaud_g)
on 2023-11-14 14:01:34 UTC
(
hide
)
Description:
Bug 35087: Discount rate only accepts a point as decimal separator
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2023-11-14 14:01:34 UTC
Size:
3.66 KB
patch
obsolete
>From 066e422fd858801d44adb0c339129d283c78298b Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Wed, 18 Oct 2023 10:45:48 +0200 >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 >--- > .../prog/en/modules/acqui/supplier.tt | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > >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 3042418cc6..06d05cf683 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >@@ -201,7 +201,8 @@ div.rows { padding: 1rem; } > [% END %] > [% UNLESS ( enter ) %][% INCLUDE 'acquisitions-toolbar.inc' %][% END %] > [% IF ( enter ) %] >- <form action="updatesupplier.pl" name="updatesupplier" style="display:block" class="validated" method="post"> >+ <form action="updatesupplier.pl" name="updatesupplier" id="updatesupplier" style="display:block" method="post"> >+ <input type="hidden" name="op" value="add_validated" /> > <div id="toolbar" class="btn-toolbar"> > <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button> > [% IF ( booksellerid ) %] >@@ -350,7 +351,7 @@ div.rows { padding: 1rem; } > <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 type="text" size="6" id="discount" name="discount" value="[% discount | html %]"/> % - Example: 7.5 %</li> > <li> > <label for="deliverytime">Delivery time: </label> > <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime | html %]" /> days >@@ -520,6 +521,7 @@ div.rows { padding: 1rem; } > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% Asset.js("lib/hc-sticky.js") | $raw %] > [% Asset.js("js/acq.js") | $raw %] >+ [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > <script> > function confirm_deletion() { >@@ -682,6 +684,10 @@ div.rows { padding: 1rem; } > } > > var Sticky; >+ jQuery.validator.addMethod("decimal_separator", function(value, element){ >+ var pattern = /^\d+(\.\d{1})?$/; >+ return this.optional(element) || value.match(pattern); >+ }, _("Respect decimal separator format")); > > $(document).ready(function() { > var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, { >@@ -732,6 +738,14 @@ div.rows { padding: 1rem; } > stickTo: "main", > stickyClass: "floating" > }); >+ >+ $('#updatesupplier').validate({ >+ rules: { >+ discount: { >+ decimal_separator: true, >+ }, >+ }, >+ }); > }); > </script> > [% END %] >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35087
:
157302
|
157626
|
158921
|
159831
|
161128
|
161225
|
161237
|
161596
|
161597
|
161598
|
161704
|
161705
|
161706
|
162065
|
162066
|
162067
|
164739
|
164740
|
167746
|
167747
|
171197
|
171198
|
171594
|
171595