[Koha-bugs] [Bug 12310] Accept different monetary formats as input
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Apr 5 17:16:56 CEST 2018
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12310
--- Comment #58 from M. Tompsett <mtompset at hotmail.com> ---
Comment on attachment 73657
--> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73657
Bug 12310 : Decimal separator issues: some fixes in fines
Review of attachment 73657:
--> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=12310&attachment=73657)
-----------------------------------------------------------------
::: koha-tmpl/intranet-tmpl/prog/en/includes/decimal-input-js.inc
@@ +16,5 @@
> + }
> +
> + var decimal_from_string = function(formatted_decimal) {
> + if (!is_decimal(formatted_decimal)) {
> + return false;
The function name is decimal_from_string. It's not intuitive to return false.
Why not just return what was passed when it isn't a decimal? Which leads to the
question, why call the parameter formatted_decimal if there is a is_decimal
check? It is just a formatted_value. It may or may not be a decimal. Also, why
do a is_decimal check in this function and the calling function?
@@ +34,5 @@
> + * to care about decimal separators (see DecimalSeparators syspref) and
> + * currency symbols for example.
> + */
> + handler_unformat_input: function(field) {
> + if (is_decimal(field.value)) {
Why do a is_decimal check here and in the decimal_from_string function?
Just do the assignment, and make sure the decimal_from_string returns what was
passed, if it isn't a decimal.
::: koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
@@ -40,4 @@
> <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
> <li><label for="desc">Description: </label><input type="text" name="desc" size="50" id="desc" /></li>
> <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
> - <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li>
placeholder="Example 5.00" would be a better solution than cutting this.
::: koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
@@ -53,4 @@
> <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
> <li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
> <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
> - <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li>
placeholder="Example 5.00" is a better solution.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list