View | Details | Raw Unified | Return to bug 12310
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug12310_added_DigitSeparator.sql (+2 lines)
Line 0 Link Here
1
INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
2
('DigitSeparator',  ',.', NULL ,  'The separator between entire and decimal part',  'Free');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 130-135 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
130
('DefaultToLoggedInLibraryNoticesSlips',  '0', NULL ,  'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.',  'YesNo'),
130
('DefaultToLoggedInLibraryNoticesSlips',  '0', NULL ,  'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.',  'YesNo'),
131
('DefaultToLoggedInLibraryOverdueTriggers',  '0', NULL ,  'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.',  'YesNo'),
131
('DefaultToLoggedInLibraryOverdueTriggers',  '0', NULL ,  'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.',  'YesNo'),
132
('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
132
('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
133
('DigitSeparator',  '.,', NULL ,  'The separator between entire and decimal part',  'Free'),
133
('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','Choice'),
134
('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','Choice'),
134
('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
135
('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
135
('displayFacetCount','0',NULL,NULL,'YesNo'),
136
('displayFacetCount','0',NULL,NULL,'YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/prices.inc (+25 lines)
Line 0 Link Here
1
[% USE Koha %]
2
<script type="text/javascript">
3
//<![CDATA[
4
5
function isPrice(string){
6
    var reg ="[% Koha.Preference('DigitSeparator') %]";
7
    reg = "[0-9]{1,}(["+reg+"][0-9]{1,}|)";
8
    var prix = new RegExp(reg);
9
    if (!prix.test(string)) {
10
        return false;
11
    }
12
    return true;
13
}
14
15
function Price_from_string(string){
16
    if (!isPrice(string)) {
17
        return false;
18
    }
19
    string = string.replace(/[^0-9[% Koha.Preference('DigitSeparator') %]]/g, '');
20
    string = string.replace(/[% Koha.Preference('DigitSeparator') %]/g, '.');
21
    return string;
22
}
23
24
//]]>
25
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-2 / +24 lines)
Lines 1-5 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Price %]
2
[% USE Price %]
3
[% USE Koha %]
3
4
4
[%- BLOCK action_menu %]
5
[%- BLOCK action_menu %]
5
    <div class="dropdown">
6
    <div class="dropdown">
Lines 27-32 Link Here
27
[% END -%]
28
[% END -%]
28
29
29
[% INCLUDE 'doc-head-open.inc' %]
30
[% INCLUDE 'doc-head-open.inc' %]
31
[% INCLUDE 'prices.inc' %]
30
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
32
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
31
[% INCLUDE 'doc-head-close.inc' %]
33
[% INCLUDE 'doc-head-close.inc' %]
32
[% INCLUDE 'calendar.inc' %]
34
[% INCLUDE 'calendar.inc' %]
Lines 66-71 Link Here
66
              alert(alertString);
68
              alert(alertString);
67
            }
69
            }
68
    }
70
    }
71
    function CheckTot(f){
72
        var ok=1;
73
        var _alertString="";
74
        var alertString2;
75
        if (!(isPrice(f.value))) {
76
            _alertString += "\n- " + _("Amount must be a valid number, or empty");
77
        }else{
78
            f.value=Price_from_string(f.value);
79
        }
80
        if (_alertString.length==0) {
81
            return true;
82
        } else {
83
            alertString2  = _("Form not submitted because of the following problem(s)");
84
            alertString2 += "\n------------------------------------------------------------------------------------\n";
85
            alertString2 += _alertString;
86
            alert(alertString2);
87
            return false;
88
        }
89
    }
69
    function Check(f) {
90
    function Check(f) {
70
            var ok=1;
91
            var ok=1;
71
            var _alertString="";
92
            var _alertString="";
Lines 356-362 Link Here
356
        <!-- ############################## -->
377
        <!-- ############################## -->
357
        <label for="budget_period_total">Total amount: </label>
378
        <label for="budget_period_total">Total amount: </label>
358
        <input type="text" id="budget_period_total" name="budget_period_total"
379
        <input type="text" id="budget_period_total" name="budget_period_total"
359
        size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
380
        size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" onchange="CheckTot(budget_period_total)" />
381
        Please use the "[% Koha.Preference('DigitSeparator').substr(0,1) %]" as separator : ex "XX[% Koha.Preference('DigitSeparator').substr(0,1) %]XX"
360
    </li>
382
    </li>
361
383
362
    <li>
384
    <li>
Lines 378-384 Link Here
378
    <fieldset class="action">
400
    <fieldset class="action">
379
        <!-- "save changes" button -->
401
        <!-- "save changes" button -->
380
        <!-- ###################################### -->
402
        <!-- ###################################### -->
381
        <input type="button" value="Save"  onclick="Check(this.form)" />
403
        <input type="button" value="Save" onclick="Check(this.form)" />
382
        <!--             <input type="submit" value="Save Changes"  />  -->
404
        <!--             <input type="submit" value="Save Changes"  />  -->
383
        [% IF ( budget_period_id ) %]
405
        [% IF ( budget_period_id ) %]
384
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
406
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref (+5 lines)
Lines 58-60 I18N/L10N: Link Here
58
          choices:
58
          choices:
59
              us: US style ([Street number], [Address] - [City], [ZIP/Postal Code], [Country])
59
              us: US style ([Street number], [Address] - [City], [ZIP/Postal Code], [Country])
60
              de: German style ([Address] [Street number] - [ZIP/Postal Code] [City] - [Country])
60
              de: German style ([Address] [Street number] - [ZIP/Postal Code] [City] - [Country])
61
    -
62
        - "The separator used between integer and decimal part"
63
        - pref: DigitSeparator
64
          class: long
65
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-1 / +29 lines)
Lines 70-76 type_fees['[% invoice_types_loo.authorised_value %]'] = "[% invoice_types_loo.li Link Here
70
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
70
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
71
	<li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
71
	<li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
72
    <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
72
    <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
73
    <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li>
73
    <li><label for="amount">Amount: </label><input type="text" name="amount" id="amount" required="required"/>
74
        Please use the "[% Koha.Preference('DigitSeparator').substr(0, 1) %]" as separator : ex "XX[% Koha.Preference('DigitSeparator').substr(0,1) %]XX"
75
    </li>
74
	</ol></fieldset>
76
	</ol></fieldset>
75
<fieldset class="action"><input type="submit" name="add" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
77
<fieldset class="action"><input type="submit" name="add" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
76
</form>
78
</form>
Lines 85-88 type_fees['[% invoice_types_loo.authorised_value %]'] = "[% invoice_types_loo.li Link Here
85
[% INCLUDE 'circ-menu.inc' %]
87
[% INCLUDE 'circ-menu.inc' %]
86
</div>
88
</div>
87
</div>
89
</div>
90
91
[% INCLUDE 'prices.inc' %]
92
93
<script type="text/javascript">
94
$('#amount').on('change', function(){Check(this)});
95
function Check(f){
96
    var ok=1;
97
    var _alertString="";
98
    var alertString2;
99
    if (!(isPrice(f.value))) {
100
        _alertString += "\n- " + _("Amount must be a valid number, or empty");
101
    }else{
102
        f.value=Price_from_string(f.value);
103
    }
104
    if (_alertString.length==0) {
105
        return true;
106
    } else {
107
        alertString2  = _("Form not submitted because of the following problem(s)");
108
        alertString2 += "\n------------------------------------------------------------------------------------\n";
109
        alertString2 += _alertString;
110
        alert(alertString2);
111
        return false;
112
    }
113
}
114
</script>
115
88
[% INCLUDE 'intranet-bottom.inc' %]
116
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-50 / +24 lines)
Lines 10-67 $(document).ready(function() { Link Here
10
});
10
});
11
//]]>
11
//]]>
12
</script>
12
</script>
13
<script type= "text/javascript">
14
//<![CDATA[
15
function moneyFormat(textObj) {
16
    var newValue = textObj.value;
17
    var decAmount = "";
18
    var dolAmount = "";
19
    var decFlag   = false;
20
    var aChar     = "";
21
22
    for(i=0; i < newValue.length; i++) {
23
        aChar = newValue.substring(i, i+1);
24
        if (aChar >= "0" && aChar <= "9") {
25
            if(decFlag) {
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
13
41
    if (dolAmount == "") {
14
[% INCLUDE 'prices.inc' %]
42
        dolAmount = "0";
15
43
    }
16
<script type="text/javascript">
44
// Strip leading 0s
17
function Check(f){
45
    if (dolAmount.length > 1) {
18
    var ok=1;
46
        while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
19
    var _alertString="";
47
            dolAmount = dolAmount.substring(1,dolAmount.length);
20
    var alertString2;
48
        }
21
    if (!(isPrice(f.value))) {
49
    }
22
        _alertString += "\n- " + _("Amount must be a valid number, or empty");
50
    if (decAmount.length > 2) {
23
    }else{
51
        decAmount = decAmount.substring(0,2);
24
        f.value=Price_from_string(f.value);
52
    }
25
    }
53
// Pad right side
26
    if (_alertString.length==0) {
54
    if (decAmount.length == 1) {
27
        return true;
55
       decAmount = decAmount + "0";
28
    } else {
29
        alertString2  = _("Form not submitted because of the following problem(s)");
30
        alertString2 += "\n------------------------------------------------------------------------------------\n";
31
        alertString2 += _alertString;
32
        alert(alertString2);
33
        return false;
56
    }
34
    }
57
    if (decAmount.length == 0) {
58
       decAmount = decAmount + "00";
59
    }
60
61
    textObj.value = dolAmount + "." + decAmount;
62
}
35
}
63
//]]>
64
</script>
36
</script>
37
38
65
</head>
39
</head>
66
<body id="pat_paycollect" class="pat">
40
<body id="pat_paycollect" class="pat">
67
[% INCLUDE 'header.inc' %]
41
[% INCLUDE 'header.inc' %]
Lines 146-152 function moneyFormat(textObj) { Link Here
146
    <li>
120
    <li>
147
        <label for="paid">Collect from patron: </label>
121
        <label for="paid">Collect from patron: </label>
148
            <!-- default to paying all -->
122
            <!-- default to paying all -->
149
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payindivfine.paid)"/>
123
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="Check(document.payindivfine.paid)"/>
150
    </li>
124
    </li>
151
</ol>
125
</ol>
152
</fieldset>
126
</fieldset>
Lines 211-217 function moneyFormat(textObj) { Link Here
211
    <li>
185
    <li>
212
        <label for="paid">Collect from patron: </label>
186
        <label for="paid">Collect from patron: </label>
213
        <!-- default to paying all -->
187
        <!-- default to paying all -->
214
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payfine.paid)"/>
188
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="Check(document.payfine.paid)"/>
189
        Please use the "[% Koha.Preference('DigitSeparator') %]" as separator : ex "XX[% Koha.Preference('DigitSeparator') %]XX"
215
    </li>
190
    </li>
216
    <li>
191
    <li>
217
        <label for="selected_accts_notes">Note: </label>
192
        <label for="selected_accts_notes">Note: </label>
218
- 

Return to bug 12310