Fix for parseFloat
This commit is contained in:
parent
cebdf59eeb
commit
15324ffcb4
2 changed files with 18 additions and 17 deletions
|
|
@ -304,6 +304,24 @@
|
|||
<script type="text/javascript">
|
||||
NINJA.formIsChanged = {{ isset($formIsChanged) && $formIsChanged ? 'true' : 'false' }};
|
||||
|
||||
NINJA.parseFloat = function(str) {
|
||||
if (! str) {
|
||||
return '';
|
||||
} else {
|
||||
str = str + '';
|
||||
}
|
||||
|
||||
// check for comma as decimal separator
|
||||
if (str.match(/,[\d]{1,2}$/)) {
|
||||
str = str.replace(',', '.');
|
||||
str = str.replace('.', ',');
|
||||
}
|
||||
|
||||
str = str.replace(/[^0-9\.\-]/g, '');
|
||||
|
||||
return window.parseFloat(str);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('form.warn-on-exit input, form.warn-on-exit textarea, form.warn-on-exit select').change(function () {
|
||||
NINJA.formIsChanged = true;
|
||||
|
|
|
|||
|
|
@ -33,23 +33,6 @@
|
|||
NINJA.fontSize = {{ DEFAULT_FONT_SIZE }};
|
||||
@endif
|
||||
|
||||
NINJA.parseFloat = function(str) {
|
||||
if (! str) {
|
||||
return '';
|
||||
} else {
|
||||
str = str + '';
|
||||
}
|
||||
|
||||
// check for comma as decimal separator
|
||||
if (str.match(/,[\d]{1,2}$/)) {
|
||||
str = str.replace(',', '.');
|
||||
}
|
||||
|
||||
str = str.replace(/[^0-9\.\-]/g, '');
|
||||
|
||||
return window.parseFloat(str);
|
||||
}
|
||||
|
||||
function formatMoneyInvoice(value, invoice, decorator, precision) {
|
||||
var account = invoice.account;
|
||||
var client = invoice.client;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue