Bugzilla – Attachment 152803 Details for
Bug 33028
Wrongly formatted monetary amounts in circulation rules break scripts and calculations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33028: (follow-up) Add unformat_price js function
Bug-33028-follow-up-Add-unformatprice-js-function.patch (text/plain), 1.74 KB, created by
Martin Renvoize (ashimema)
on 2023-06-28 13:50:37 UTC
(
hide
)
Description:
Bug 33028: (follow-up) Add unformat_price js function
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-06-28 13:50:37 UTC
Size:
1.74 KB
patch
obsolete
>From a5c6b75680d876005e27474d3efb139c707e67a9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 27 Jun 2023 16:22:36 +0100 >Subject: [PATCH] Bug 33028: (follow-up) Add unformat_price js function > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../intranet-tmpl/prog/en/includes/format_price.inc | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/format_price.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/format_price.inc >index fd1d68112b..46aa768c43 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/format_price.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/format_price.inc >@@ -32,5 +32,17 @@ > var re = '\\d(?=(\\d{' + 3 + '})+' + '\\D' + ')', value = this.toFixed(decimal_digits); > return value.replace('.', decimal_point).replace(new RegExp(re, 'g'), '$&' + thousands_sep); > } >+ String.prototype.unformat_price = function (params) { >+ params = params == undefined ? {} : params; >+ var thousands_sep = params.thousands_sep == undefined ? default_value.thousands_sep : params.thousands_sep, >+ decimal_point = params.decimal_point == undefined ? default_value.decimal_point : params.decimal_point, >+ //symbol = params.symbol == undefined ? '$' : params.symbol, // Not implemented yet >+ decimal_digits = params.decimal_digits == undefined ? default_value.decimal_digits : params.decimal_digits; >+ >+ let value = this.valueOf(); >+ value = value.replace(thousands_sep, '').replace(decimal_point, '.').replace(new RegExp('[^\\d.]', 'g'), ''); >+ return Number(value).toFixed(decimal_digits); >+ } >+ > </script> > <!-- / format-price.inc --> >-- >2.41.0
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 33028
:
147058
|
147686
|
147687
|
147688
|
152441
|
152442
|
152443
|
152444
|
152445
|
152446
|
152509
|
152510
|
152511
|
152512
|
152513
|
152514
|
152515
|
152752
|
152753
|
152754
|
152755
|
152756
|
152757
|
152758
|
152759
|
152760
|
152761
|
152762
|
152763
|
152764
|
152803
|
152804
|
152805
|
152829
|
152928
|
152929
|
152930
|
152931
|
152932
|
152933
|
152934
|
152935
|
152936
|
153313
|
153314
|
153315
|
153316
|
153317
|
153318
|
153319
|
153320
|
153321
|
153322
|
153323
|
153619
|
153620
|
153632
|
153633
|
153634
|
153635
|
153636
|
153677