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 135-140 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
135
('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'),
135
('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'),
136
('DefaultToLoggedInLibraryOverdueTriggers',  '0', NULL ,  'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.',  'YesNo'),
136
('DefaultToLoggedInLibraryOverdueTriggers',  '0', NULL ,  'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.',  'YesNo'),
137
('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
137
('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
138
('DigitSeparator',  '.,', NULL ,  'The separator between entire and decimal part',  'Free'),
138
('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'),
139
('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'),
139
('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
140
('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
140
('displayFacetCount','0',NULL,NULL,'YesNo'),
141
('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 (+4 lines)
Lines 66-68 I18N/L10N: Link Here
66
              no: "Don't allow"
66
              no: "Don't allow"
67
        - notices to be translated.
67
        - notices to be translated.
68
        - If set, notices will be translatable from the "Notices and Slips" interface. The language used to send a notice to a patron will be the one defined for the patron.
68
        - If set, notices will be translatable from the "Notices and Slips" interface. The language used to send a notice to a patron will be the one defined for the patron.
69
    -
70
        - "The separator used between integer and decimal part"
71
        - pref: DigitSeparator
72
          class: long
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-1 / +29 lines)
Lines 67-73 $(document).ready(function(){ Link Here
67
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
67
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
68
	<li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
68
	<li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
69
    <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
69
    <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
70
    <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li>
70
    <li><label for="amount">Amount: </label><input type="text" name="amount" id="amount" required="required"/>
71
        Please use the "[% Koha.Preference('DigitSeparator').substr(0, 1) %]" as separator : ex "XX[% Koha.Preference('DigitSeparator').substr(0,1) %]XX"
72
    </li>
71
	</ol></fieldset>
73
	</ol></fieldset>
72
<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>
74
<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>
73
</form>
75
</form>
Lines 82-85 $(document).ready(function(){ Link Here
82
[% INCLUDE 'circ-menu.inc' %]
84
[% INCLUDE 'circ-menu.inc' %]
83
</div>
85
</div>
84
</div>
86
</div>
87
88
[% INCLUDE 'prices.inc' %]
89
90
<script type="text/javascript">
91
$('#amount').on('change', function(){Check(this)});
92
function Check(f){
93
    var ok=1;
94
    var _alertString="";
95
    var alertString2;
96
    if (!(isPrice(f.value))) {
97
        _alertString += "\n- " + _("Amount must be a valid number, or empty");
98
    }else{
99
        f.value=Price_from_string(f.value);
100
    }
101
    if (_alertString.length==0) {
102
        return true;
103
    } else {
104
        alertString2  = _("Form not submitted because of the following problem(s)");
105
        alertString2 += "\n------------------------------------------------------------------------------------\n";
106
        alertString2 += _alertString;
107
        alert(alertString2);
108
        return false;
109
    }
110
}
111
</script>
112
85
[% INCLUDE 'intranet-bottom.inc' %]
113
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-47 / +32 lines)
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
- 

Return to bug 12310