projects
/
civicrm-core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
74862f0
)
Support multiple decimal places in CRM_Utils_Rule::money for currencies such as bitco...
author
Matthew Wire
<mjw@mjwconsult.co.uk>
Mon, 7 Aug 2017 10:44:32 +0000
(11:44 +0100)
committer
Matthew Wire
<mjw@mjwconsult.co.uk>
Mon, 7 Aug 2017 10:44:32 +0000
(11:44 +0100)
CRM/Utils/Rule.php
patch
|
blob
|
blame
|
history
diff --git
a/CRM/Utils/Rule.php
b/CRM/Utils/Rule.php
index a40286d4b5c1a414e6d9b6ac0b9a8359eb75289c..897aa5dbbd306cdc8f9e16cb087b8cb62411f01d 100644
(file)
--- a/
CRM/Utils/Rule.php
+++ b/
CRM/Utils/Rule.php
@@
-574,7
+574,10
@@
class CRM_Utils_Rule {
return TRUE;
}
- return preg_match('/(^-?\d+\.\d?\d?$)|(^-?\.\d\d?$)/', $value) ? TRUE : FALSE;
+ // Allow values such as -0, 1.024555, -.1
+ // We need to support multiple decimal places here, not just the number allowed by locale
+ // otherwise tax calculations break when you want the inclusive amount to be a round number (eg. £10 inc. VAT requires 8.333333333 here).
+ return preg_match('/(^-?\d+\.?\d*$)|(^-?\.\d+$)/', $value) ? TRUE : FALSE;
}
/**