|
Lines 11-67
$(document).ready(function() {
Link Here
|
| 11 |
moneyFormat( this ); |
11 |
moneyFormat( this ); |
| 12 |
}); |
12 |
}); |
| 13 |
}); |
13 |
}); |
|
|
14 |
//]]> |
| 15 |
</script> |
| 14 |
|
16 |
|
| 15 |
function moneyFormat(textObj) { |
17 |
[% INCLUDE 'prices.inc' %] |
| 16 |
var newValue = textObj.value; |
18 |
|
| 17 |
var decAmount = ""; |
19 |
<script type="text/javascript"> |
| 18 |
var dolAmount = ""; |
20 |
function Check(f){ |
| 19 |
var decFlag = false; |
21 |
var ok=1; |
| 20 |
var aChar = ""; |
22 |
var _alertString=""; |
| 21 |
|
23 |
var alertString2; |
| 22 |
for(i=0; i < newValue.length; i++) { |
24 |
if (!(isPrice(f.value))) { |
| 23 |
aChar = newValue.substring(i, i+1); |
25 |
_alertString += "\n- " + _("Amount must be a valid number, or empty"); |
| 24 |
if (aChar >= "0" && aChar <= "9") { |
26 |
}else{ |
| 25 |
if(decFlag) { |
27 |
f.value=Price_from_string(f.value); |
| 26 |
decAmount = "" + decAmount + aChar; |
|
|
| 27 |
} |
| 28 |
else { |
| 29 |
dolAmount = "" + dolAmount + aChar; |
| 30 |
} |
| 31 |
} |
| 32 |
if (aChar == ".") { |
| 33 |
if (decFlag) { |
| 34 |
dolAmount = ""; |
| 35 |
break; |
| 36 |
} |
| 37 |
decFlag = true; |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
if (dolAmount == "") { |
| 42 |
dolAmount = "0"; |
| 43 |
} |
| 44 |
// Strip leading 0s |
| 45 |
if (dolAmount.length > 1) { |
| 46 |
while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") { |
| 47 |
dolAmount = dolAmount.substring(1,dolAmount.length); |
| 48 |
} |
| 49 |
} |
| 50 |
if (decAmount.length > 2) { |
| 51 |
decAmount = decAmount.substring(0,2); |
| 52 |
} |
28 |
} |
| 53 |
// Pad right side |
29 |
if (_alertString.length==0) { |
| 54 |
if (decAmount.length == 1) { |
30 |
return true; |
| 55 |
decAmount = decAmount + "0"; |
31 |
} else { |
|
|
32 |
alertString2 = _("Form not submitted because of the following problem(s)"); |
| 33 |
alertString2 += "\n------------------------------------------------------------------------------------\n"; |
| 34 |
alertString2 += _alertString; |
| 35 |
alert(alertString2); |
| 36 |
return false; |
| 56 |
} |
37 |
} |
| 57 |
if (decAmount.length == 0) { |
|
|
| 58 |
decAmount = decAmount + "00"; |
| 59 |
} |
| 60 |
|
| 61 |
textObj.value = dolAmount + "." + decAmount; |
| 62 |
} |
38 |
} |
| 63 |
//]]> |
|
|
| 64 |
</script> |
39 |
</script> |
|
|
40 |
|
| 41 |
|
| 65 |
</head> |
42 |
</head> |
| 66 |
<body id="pat_paycollect" class="pat"> |
43 |
<body id="pat_paycollect" class="pat"> |
| 67 |
[% INCLUDE 'header.inc' %] |
44 |
[% INCLUDE 'header.inc' %] |
|
Lines 146-152
function moneyFormat(textObj) {
Link Here
|
| 146 |
<li> |
123 |
<li> |
| 147 |
<label for="paid">Collect from patron: </label> |
124 |
<label for="paid">Collect from patron: </label> |
| 148 |
<!-- default to paying all --> |
125 |
<!-- default to paying all --> |
|
|
126 |
<<<<<<< 16ee11980e3d1f0c5cbd3650d3a90b7d00d971e4 |
| 149 |
<input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" /> |
127 |
<input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" /> |
|
|
128 |
======= |
| 129 |
<input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="Check(document.payindivfine.paid)"/> |
| 130 |
>>>>>>> BUG 12310 : Modified scripts in order to convert any string to the good format |
| 150 |
</li> |
131 |
</li> |
| 151 |
</ol> |
132 |
</ol> |
| 152 |
</fieldset> |
133 |
</fieldset> |
|
Lines 211-217
function moneyFormat(textObj) {
Link Here
|
| 211 |
<li> |
192 |
<li> |
| 212 |
<label for="paid">Collect from patron: </label> |
193 |
<label for="paid">Collect from patron: </label> |
| 213 |
<!-- default to paying all --> |
194 |
<!-- default to paying all --> |
|
|
195 |
<<<<<<< 16ee11980e3d1f0c5cbd3650d3a90b7d00d971e4 |
| 214 |
<input name="paid" id="paid" value="[% total | format('%.2f') %]" /> |
196 |
<input name="paid" id="paid" value="[% total | format('%.2f') %]" /> |
|
|
197 |
======= |
| 198 |
<input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="Check(document.payfine.paid)"/> |
| 199 |
Please use the "[% Koha.Preference('DigitSeparator') %]" as separator : ex "XX[% Koha.Preference('DigitSeparator') %]XX" |
| 200 |
>>>>>>> BUG 12310 : Modified scripts in order to convert any string to the good format |
| 215 |
</li> |
201 |
</li> |
| 216 |
<li> |
202 |
<li> |
| 217 |
<label for="selected_accts_notes">Note: </label> |
203 |
<label for="selected_accts_notes">Note: </label> |
| 218 |
- |
|
|