Bugzilla – Attachment 159831 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.56 KB, created by
Biblibre Sandboxes
on 2023-12-14 11:09:42 UTC
(
hide
)
Description:
Bug 35087: Discount rate only accepts a point as decimal separator
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2023-12-14 11:09:42 UTC
Size:
3.56 KB
patch
obsolete
>From 1d7712ed44ee7a3090bb728721c089086549afa0 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 > >Signed-off-by: Sabrina <kiehl@mpis.mpg.de> >--- > .../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 fae8f92e65..50332643b5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >@@ -197,7 +197,8 @@ > [% 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 ) %] >@@ -346,7 +347,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 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 >@@ -516,6 +517,7 @@ > [% 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() { >@@ -678,6 +680,10 @@ > } > > 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, { >@@ -728,6 +734,14 @@ > 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