Bugzilla – Attachment 153320 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.79 KB, created by
Katrin Fischer
on 2023-07-11 13:27:44 UTC
(
hide
)
Description:
Bug 33028: (follow-up) Add unformat_price js function
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-07-11 13:27:44 UTC
Size:
1.79 KB
patch
obsolete
>From b53b8e87d3a549f13f3ada9619ecd4beddd97b82 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> >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > .../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..6790bc8d59 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.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 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