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

(-)a/installer/data/mysql/atomicupdate/bug12310_add_DecimalSeparators.sql (+2 lines)
Line 0 Link Here
1
INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
2
('DecimalSeparators',  ',.', NULL ,  'The allowed separators between entire and decimal parts of numbers',  'Free');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 138-143 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
138
('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'),
138
('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'),
139
('DefaultToLoggedInLibraryOverdueTriggers',  '0', NULL ,  'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.',  'YesNo'),
139
('DefaultToLoggedInLibraryOverdueTriggers',  '0', NULL ,  'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.',  'YesNo'),
140
('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
140
('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
141
('DecimalSeparators',  '.,', NULL ,  'The allowed separators between entire and decimal parts of numbers',  'Free'),
141
('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'),
142
('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'),
142
('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
143
('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
143
('displayFacetCount','0',NULL,NULL,'YesNo'),
144
('displayFacetCount','0',NULL,NULL,'YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/decimal-input-js.inc (+45 lines)
Line 0 Link Here
1
[% USE Koha %]
2
[% USE JSON.Escape %]
3
4
<script type="text/javascript">
5
var decimal = (function() {
6
7
    var is_decimal = function(input) {
8
        // JSON escaping to handle the strange case of " in the syspref
9
        var separators = [% Koha.Preference('DecimalSeparators').json %];
10
        var regex = "[0-9]{1,}(["+separators+"][0-9]{1,}|)";
11
        var decimal = new RegExp(regex);
12
        if (decimal.test(input)) {
13
            return true;
14
        }
15
        return false;
16
    }
17
18
    var decimal_from_string = function(formatted_decimal) {
19
        if (!is_decimal(formatted_decimal)) {
20
            return false;
21
        }
22
        // remove everything except digits, minuses, and the chars in DecimalSeparators syspref
23
        var formatted_decimal = formatted_decimal
24
                              .replace(/[^0-9-[% Koha.Preference('DecimalSeparators') %]]/g, '');
25
        var decimal = formatted_decimal
26
                    .replace(/[[% Koha.Preference('DecimalSeparators') %]]/g, '.');
27
        return decimal;
28
    }
29
30
    return {
31
        /**
32
         * Handler made to process an <input> field containing a decimal number
33
         * to unformat it. So it can be processed by the server without having
34
         * to care about decimal separators (see DecimalSeparators syspref) and
35
         * currency symbols for example.
36
         */
37
        handler_unformat_input: function(field) {
38
            if (is_decimal(field.value)) {
39
                field.value = decimal_from_string(field.value);
40
            }
41
        }
42
    };
43
44
})();
45
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-2 / +6 lines)
Lines 1-6 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Price %]
2
[% USE Price %]
3
[% USE Koha %]
3
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
5
4
[%- BLOCK action_menu %]
6
[%- BLOCK action_menu %]
5
    <div class="dropdown">
7
    <div class="dropdown">
6
        <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
8
        <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
Lines 33-38 Link Here
33
[% END -%]
35
[% END -%]
34
36
35
[% INCLUDE 'doc-head-open.inc' %]
37
[% INCLUDE 'doc-head-open.inc' %]
38
[% INCLUDE 'decimal-input-js.inc' %]
36
[% INCLUDE 'doc-head-close.inc' %]
39
[% INCLUDE 'doc-head-close.inc' %]
37
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
40
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
38
[% IF close_form %]
41
[% IF close_form %]
Lines 221-227 Link Here
221
        <!-- ############################## -->
224
        <!-- ############################## -->
222
        <label for="budget_period_total">Total amount: </label>
225
        <label for="budget_period_total">Total amount: </label>
223
        <input type="text" id="budget_period_total" name="budget_period_total"
226
        <input type="text" id="budget_period_total" name="budget_period_total"
224
        size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
227
        size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" onchange="decimal.handler_unformat_input(budget_period_total)" />
225
    </li>
228
    </li>
226
229
227
    <li>
230
    <li>
Lines 243-249 Link Here
243
    <fieldset class="action">
246
    <fieldset class="action">
244
        <!-- "save changes" button -->
247
        <!-- "save changes" button -->
245
        <!-- ###################################### -->
248
        <!-- ###################################### -->
246
        <input type="button" value="Save"  onclick="Check(this.form)" />
249
        <input type="button" value="Save" onclick="Check(this.form)" />
247
        <!--             <input type="submit" value="Save Changes"  />  -->
250
        <!--             <input type="submit" value="Save Changes"  />  -->
248
        [% IF ( budget_period_id ) %]
251
        [% IF ( budget_period_id ) %]
249
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
252
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
Lines 528-533 Link Here
528
              alert(alertString);
531
              alert(alertString);
529
            }
532
            }
530
        }
533
        }
534
531
        function Check(f) {
535
        function Check(f) {
532
            var ok=1;
536
            var ok=1;
533
            var _alertString="";
537
            var _alertString="";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt (-3 / +10 lines)
Lines 1-6 Link Here
1
[% USE AuthorisedValues %]
1
[% USE AuthorisedValues %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE Price %]
3
[% USE Price %]
4
[% USE Koha %]
4
[% SET footerjs = 1 %]
5
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == 'add_form' %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
7
<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == 'add_form' %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
Lines 243-249 Link Here
243
    <li>
244
    <li>
244
      <label for="budget_expend">Warning at (amount): </label>
245
      <label for="budget_expend">Warning at (amount): </label>
245
      <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 %]" size="10" />
246
      <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 %]" size="10" />
246
      <span class="hint">0 to disable</span>
247
      <span class="hint">0 to disable.</span>
247
    </li>
248
    </li>
248
249
249
    <li>
250
    <li>
Lines 449-454 Link Here
449
450
450
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
451
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
451
    [% IF op == 'add_form' %]
452
    [% IF op == 'add_form' %]
453
        [% INCLUDE 'decimal-input-js.inc' %]
452
        <script type="text/javascript">
454
        <script type="text/javascript">
453
        //<![CDATA[
455
        //<![CDATA[
454
456
Lines 563-569 Link Here
563
                    }
565
                    }
564
                }
566
                }
565
567
566
                 // else do lookup
568
                // else do lookup
567
                var budgetTotal = Math.abs(f.budget_amount.value);
569
                var budgetTotal = Math.abs(f.budget_amount.value);
568
                var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
570
                var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
569
                if (result) {
571
                if (result) {
Lines 579-585 Link Here
579
                    alert(alertString2);
581
                    alert(alertString2);
580
                }
582
                }
581
            }
583
            }
584
585
582
            $(document).ready(function(){
586
            $(document).ready(function(){
587
                $('#budget_expend').on('change', function(){decimal.handler_unformat_input(this)});
588
                $('#budget_amount').on('change', function(){prices.handler_unformat_input(this)});
589
583
                $("#remove_owner").on("click",function(e){
590
                $("#remove_owner").on("click",function(e){
584
                    e.preventDefault();
591
                    e.preventDefault();
585
                    ownerRemove();
592
                    ownerRemove();
Lines 692-696 Link Here
692
        //]]>
699
        //]]>
693
        </script>
700
        </script>
694
    [% END %]
701
    [% END %]
695
[% END %]
702
[% END %][%# end of MACRO jsinclude %]
696
[% INCLUDE 'intranet-bottom.inc' %]
703
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-1 / +1 lines)
Lines 28-34 Acquisitions: Link Here
28
                  branch: from staff member's library.
28
                  branch: from staff member's library.
29
                  all: in system, regardless of owner.
29
                  all: in system, regardless of owner.
30
        -
30
        -
31
            - Display currencies using the following format
31
            - Display currencies using the following format. It you want to choose the possible decimal separators for price input, please use the system preference 'DecimalSeparators'.
32
            - pref: CurrencyFormat
32
            - pref: CurrencyFormat
33
              choices:
33
              choices:
34
                  US: 360,000.00 (US)
34
                  US: 360,000.00 (US)
(-)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
        - "Any of these characters can be used as separator between integer and decimal parts in the price fields. To work well with thousands separators you must (usually) choose between dot and comma to avoid ambiguity. So thousands separators come at the expense of handling both dots and commas. It you want to format price output, please use the system preference 'CurrencyFormat'"
71
        - pref: DecimalSeparators
72
          class: long
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt (-5 / +9 lines)
Lines 3-11 Link Here
3
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Patrons &rsaquo; Create manual credit</title>
4
<title>Koha &rsaquo; Patrons &rsaquo; Create manual credit</title>
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'decimal-input-js.inc' %]
6
</head>
7
</head>
7
8
8
<body id="pat_mancredit" class="pat">
9
<body id="pat_mancredit" class="pat">
10
9
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
10
[% INCLUDE 'patron-search.inc' %]
12
[% INCLUDE 'patron-search.inc' %]
11
13
Lines 33-46 Link Here
33
35
34
<fieldset class="rows">
36
<fieldset class="rows">
35
<legend>Manual credit</legend><ol>
37
<legend>Manual credit</legend><ol>
36
	<li><label for="type">Credit type: </label><select name="type" id="type">
38
  <li><label for="type">Credit type: </label><select name="type" id="type">
37
<option value="C">Credit</option>
39
<option value="C">Credit</option>
38
<option value="FOR">Forgiven</option>
40
<option value="FOR">Forgiven</option>
39
</select></li>
41
</select></li>
40
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
42
  <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
41
	<li><label for="desc">Description: </label><input type="text" name="desc" size="50" id="desc" /></li>
43
  <li><label for="desc">Description: </label><input type="text" name="desc" size="50" id="desc" /></li>
42
    <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
44
  <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
43
    <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li>
45
  <li><label for="amount">Amount: </label><input name="amount" id="amount" required="required" value="" step="any" min="0" /></li>
46
44
</ol></fieldset>
47
</ol></fieldset>
45
48
46
<fieldset class="action"><input type="submit" name="add" value="Add credit" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></fieldset>
49
<fieldset class="action"><input type="submit" name="add" value="Add credit" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></fieldset>
Lines 62-67 Link Here
62
        $(document).ready(function(){
65
        $(document).ready(function(){
63
            $('#mancredit').preventDoubleFormSubmit();
66
            $('#mancredit').preventDoubleFormSubmit();
64
            $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
67
            $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
68
            $('#amount').on('change', function(){decimal.handler_unformat_input(this)});
65
        });
69
        });
66
    </script>
70
    </script>
67
[% END %]
71
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-1 / +4 lines)
Lines 53-59 Link Here
53
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
53
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
54
	<li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
54
	<li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
55
    <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
55
    <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
56
    <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li>
56
    <li><label for="amount">Amount: </label><input type="text" name="amount" id="amount" required="required"/></li>
57
	</ol></fieldset>
57
	</ol></fieldset>
58
<fieldset class="action"><input type="submit" name="add" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></fieldset>
58
<fieldset class="action"><input type="submit" name="add" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></fieldset>
59
</form>
59
</form>
Lines 69-74 Link Here
69
</div>
69
</div>
70
</div>
70
</div>
71
71
72
[% INCLUDE 'decimal-input-js.inc' %]
72
[% MACRO jsinclude BLOCK %]
73
[% MACRO jsinclude BLOCK %]
73
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script>
74
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script>
74
    <script type="text/javascript">
75
    <script type="text/javascript">
Lines 83-90 Link Here
83
                this.form.desc.value = this.options[this.selectedIndex].value;
84
                this.form.desc.value = this.options[this.selectedIndex].value;
84
                this.form.amount.value = type_fees[this.options[this.selectedIndex].value];
85
                this.form.amount.value = type_fees[this.options[this.selectedIndex].value];
85
            });
86
            });
87
            $('#amount').on('change', function(){decimal.handler_unformat_input(this)});
86
        });
88
        });
87
    </script>
89
    </script>
88
[% END %]
90
[% END %]
89
91
92
90
[% INCLUDE 'intranet-bottom.inc' %]
93
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-25 / +5 lines)
Lines 83-89 Link Here
83
    <li>
83
    <li>
84
        <label for="paid">Collect from patron: </label>
84
        <label for="paid">Collect from patron: </label>
85
            <!-- default to paying all -->
85
            <!-- default to paying all -->
86
        <input name="paid" id="paid" value="[% amountoutstanding %]" />
86
        <input name="paid" id="paid" value="[% amountoutstanding %]" onchange="decimal.unhandler_unformat_input(document.payindivfine.paid)"/>
87
    </li>
87
    </li>
88
</ol>
88
</ol>
89
</fieldset>
89
</fieldset>
Lines 150-156 Link Here
150
    <li>
150
    <li>
151
        <label for="paid">Collect from patron: </label>
151
        <label for="paid">Collect from patron: </label>
152
        <!-- default to paying all -->
152
        <!-- default to paying all -->
153
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
153
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="decimal.handler_unformat_input(document.payfine.paid)"/>
154
    </li>
154
    </li>
155
    <li>
155
    <li>
156
        <label for="selected_accts_notes">Note: </label>
156
        <label for="selected_accts_notes">Note: </label>
Lines 206-235 Link Here
206
                    decFlag = true;
206
                    decFlag = true;
207
                }
207
                }
208
            }
208
            }
209
210
            if (dolAmount == "") {
211
                dolAmount = "0";
212
            }
213
        // Strip leading 0s
214
            if (dolAmount.length > 1) {
215
                while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
216
                    dolAmount = dolAmount.substring(1,dolAmount.length);
217
                }
218
            }
219
            if (decAmount.length > 2) {
220
                decAmount = decAmount.substring(0,2);
221
            }
222
        // Pad right side
223
            if (decAmount.length == 1) {
224
               decAmount = decAmount + "0";
225
            }
226
            if (decAmount.length == 0) {
227
               decAmount = decAmount + "00";
228
            }
229
230
            textObj.value = dolAmount + "." + decAmount;
231
        }
209
        }
232
    </script>
210
    </script>
211
212
        [% INCLUDE 'decimal-input-js.inc' %]
213
233
[% END %]
214
[% END %]
234
215
235
[% INCLUDE 'intranet-bottom.inc' %]
216
[% INCLUDE 'intranet-bottom.inc' %]
236
- 

Return to bug 12310