Bugzilla – Attachment 134969 Details for
Bug 30139
Point of sale sets wrong 'Amount being paid' with CurrencyFormat = FR
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30139: Fix javascript moneyFormat to be compatible with FR format
Bug-30139-Fix-javascript-moneyFormat-to-be-compati.patch (text/plain), 4.78 KB, created by
Shi Yao Wang
on 2022-05-13 12:49:23 UTC
(
hide
)
Description:
Bug 30139: Fix javascript moneyFormat to be compatible with FR format
Filename:
MIME Type:
Creator:
Shi Yao Wang
Created:
2022-05-13 12:49:23 UTC
Size:
4.78 KB
patch
obsolete
>From d8010e172fea579c5adb133f64f1d2e6f95ed26a Mon Sep 17 00:00:00 2001 >From: Shi Yao Wang <shi-yao.wang@inlibro.com> >Date: Tue, 10 May 2022 13:34:15 -0400 >Subject: [PATCH] Bug 30139: Fix javascript moneyFormat to be compatible with > FR format > >New way of formatting money amount to make it work with FR format > >Test plan: >1- Set CurrencyFormat pref to FR >2- Activate Point of sale and cash register features >3- Add cash register >4- Add debit type that 'can be sold' with a price of 10.00 >5- Go to point of sale, click on the item to purchase >6- Verify the Amount to be paid shows the wrong amount and can't be fixed on the interface >7- Apply the patch >8- Refresh the page and do step 5 again >9- Notice it now shows the right amount > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > .../prog/en/modules/members/paycollect.tt | 31 ++++++++++--------- > .../intranet-tmpl/prog/en/modules/pos/pay.tt | 27 ++++++++-------- > 2 files changed, 30 insertions(+), 28 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >index b153e3b91a..cd823fddd5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -476,28 +476,29 @@ > var newValue = textObj.value; > var decAmount = ""; > var dolAmount = ""; >- var decFlag = false; >+ var dolFlag = false; > var aChar = ""; > >- for(i=0; i < newValue.length; i++) { >- aChar = newValue.substring(i, i+1); >- if (aChar >= "0" && aChar <= "9") { >- if(decFlag) { >- decAmount = "" + decAmount + aChar; >+ for(var i = newValue.length; 0 < i; i--) { >+ aChar = newValue.substring(i-1, i); >+ if ("0" <= aChar && aChar <= "9") { >+ if(dolFlag) { >+ dolAmount = "" + aChar + dolAmount; > } > else { >- dolAmount = "" + dolAmount + aChar; >+ decAmount = "" + aChar + decAmount; > } > } >- if (aChar == ".") { >- if (decFlag) { >- dolAmount = ""; >- break; >- } >- decFlag = true; >+ if (aChar == "." || aChar == ",") { >+ dolFlag = true; > } > } > >+ if (!dolFlag) { >+ dolAmount = decAmount; >+ decAmount = ""; >+ } >+ > if (dolAmount == "") { > dolAmount = "0"; > } >@@ -512,10 +513,10 @@ > } > // Pad right side > if (decAmount.length == 1) { >- decAmount = decAmount + "0"; >+ decAmount = decAmount + "0"; > } > if (decAmount.length == 0) { >- decAmount = decAmount + "00"; >+ decAmount = decAmount + "00"; > } > > textObj.value = dolAmount + "." + decAmount; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >index 531869cb25..905ed4c0f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >@@ -203,28 +203,29 @@ > var newValue = textObj.value; > var decAmount = ""; > var dolAmount = ""; >- var decFlag = false; >+ var dolFlag = false; > var aChar = ""; > >- for(var i=0; i < newValue.length; i++) { >- aChar = newValue.substring(i, i+1); >- if (aChar >= "0" && aChar <= "9") { >- if(decFlag) { >- decAmount = "" + decAmount + aChar; >+ for(var i = newValue.length; 0 < i; i--) { >+ aChar = newValue.substring(i-1, i); >+ if ("0" <= aChar && aChar <= "9") { >+ if(dolFlag) { >+ dolAmount = "" + aChar + dolAmount; > } > else { >- dolAmount = "" + dolAmount + aChar; >+ decAmount = "" + aChar + decAmount; > } > } >- if (aChar == ".") { >- if (decFlag) { >- dolAmount = ""; >- break; >- } >- decFlag = true; >+ if (aChar == "." || aChar == ",") { >+ dolFlag = true; > } > } > >+ if (!dolFlag) { >+ dolAmount = decAmount; >+ decAmount = ""; >+ } >+ > if (dolAmount == "") { > dolAmount = "0"; > } >-- >2.25.1
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 30139
:
134830
|
134842
|
134843
|
134957
|
134969
|
134973
|
134974
|
134976