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 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
('DigitSeparator',  '.,', NULL ,  'The separator between entire and decimal part',  '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/price-conversion-message.inc (+14 lines)
Line 0 Link Here
1
[% USE Koha %]
2
[% INCLUDE 'prices.inc' %]
3
4
    <span class="hint">
5
        [% IF Koha.Preference('DigitSeparator') %]Please use any of the following character(s) "[% Koha.Preference('DigitSeparator').substr(0,1) %]" as separator : ex "XX[% Koha.Preference('DigitSeparator').substr(0,1) %]XX".</span>
6
            [% IF CAN_user_parameters %]
7
                <a href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=DigitSeparator">Edit Separator </a>
8
            [% END %]
9
        [% ELSE %]
10
            [% IF CAN_user_parameters %]
11
                No Digit separator defined <a href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=DigitSeparator">Chose one</a>
12
            [% END %]
13
       [% END %]
14
    </span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/prices.inc (+46 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
function CheckPriceAmount(f){
25
    var ok=1;
26
    var _alertString="";
27
    var alertString2;
28
    if (!(isPrice(f.value))) {
29
        _alertString += "\n- " + _("Amount must be a valid number, or empty");
30
    } else {
31
        f.value=Price_from_string(f.value);
32
    }
33
    if (_alertString.length==0) {
34
        return true;
35
    } else {
36
        alertString2  = _("Form not submitted because of the following problem(s)");
37
        alertString2 += "\n------------------------------------------------------------------------------------\n";
38
        alertString2 += _alertString;
39
        alert(alertString2);
40
        return false;
41
    }
42
}
43
44
45
//]]>
46
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-2 / +7 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 'prices.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="CheckPriceAmount(budget_period_total)" />
228
        [% INCLUDE 'price-conversion-message.inc' %]
225
    </li>
229
    </li>
226
230
227
    <li>
231
    <li>
Lines 243-249 Link Here
243
    <fieldset class="action">
247
    <fieldset class="action">
244
        <!-- "save changes" button -->
248
        <!-- "save changes" button -->
245
        <!-- ###################################### -->
249
        <!-- ###################################### -->
246
        <input type="button" value="Save"  onclick="Check(this.form)" />
250
        <input type="button" value="Save" onclick="Check(this.form)" />
247
        <!--             <input type="submit" value="Save Changes"  />  -->
251
        <!--             <input type="submit" value="Save Changes"  />  -->
248
        [% IF ( budget_period_id ) %]
252
        [% IF ( budget_period_id ) %]
249
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
253
            <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);
532
              alert(alertString);
529
            }
533
            }
530
        }
534
        }
535
531
        function Check(f) {
536
        function Check(f) {
532
            var ok=1;
537
            var ok=1;
533
            var _alertString="";
538
            var _alertString="";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt (-5 / +16 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 232-237 Link Here
232
    <li>
233
    <li>
233
    <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
234
    <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
234
    <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" size="8" />
235
    <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" size="8" />
236
        [% INCLUDE 'price-conversion-message.inc' %]
235
    </li>
237
    </li>
236
238
237
    <li>
239
    <li>
Lines 241-249 Link Here
241
    </li>
243
    </li>
242
244
243
    <li>
245
    <li>
244
      <label for="budget_expend">Warning at (amount): </label>
246
    <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" />
247
    <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>
248
249
    <span class="hint">0 to disable.</span>
250
        [% INCLUDE 'price-conversion-message.inc' %]
251
247
    </li>
252
    </li>
248
253
249
    <li>
254
    <li>
Lines 449-454 Link Here
449
454
450
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
455
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
451
    [% IF op == 'add_form' %]
456
    [% IF op == 'add_form' %]
457
        [% INCLUDE 'prices.inc' %]
452
        <script type="text/javascript">
458
        <script type="text/javascript">
453
        //<![CDATA[
459
        //<![CDATA[
454
460
Lines 563-569 Link Here
563
                    }
569
                    }
564
                }
570
                }
565
571
566
                 // else do lookup
572
                // else do lookup
567
                var budgetTotal = Math.abs(f.budget_amount.value);
573
                var budgetTotal = Math.abs(f.budget_amount.value);
568
                var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
574
                var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
569
                if (result) {
575
                if (result) {
Lines 579-585 Link Here
579
                    alert(alertString2);
585
                    alert(alertString2);
580
                }
586
                }
581
            }
587
            }
588
589
582
            $(document).ready(function(){
590
            $(document).ready(function(){
591
                $('#budget_expend').on('change', function(){CheckPriceAmount(this)});
592
                $('#budget_amount').on('change', function(){CheckPriceAmount(this)});
593
583
                $("#remove_owner").on("click",function(e){
594
                $("#remove_owner").on("click",function(e){
584
                    e.preventDefault();
595
                    e.preventDefault();
585
                    ownerRemove();
596
                    ownerRemove();
Lines 692-696 Link Here
692
        //]]>
703
        //]]>
693
        </script>
704
        </script>
694
    [% END %]
705
    [% END %]
695
[% END %]
706
[% END %][%# end of MACRO jsinclude %]
696
[% INCLUDE 'intranet-bottom.inc' %]
707
[% INCLUDE 'intranet-bottom.inc' %]
(-)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: DigitSeparator
72
          class: long
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt (-1 / +6 lines)
Lines 3-8 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 'prices.inc' %]
6
</head>
7
</head>
7
8
8
<body id="pat_mancredit" class="pat">
9
<body id="pat_mancredit" class="pat">
Lines 40-46 Link Here
40
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
41
	<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>
42
	<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>
43
    <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>
44
    <li><label for="amount">Amount: </label><input name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00
45
        [% INCLUDE 'price-conversion-message.inc' %]
46
    </li>
47
44
</ol></fieldset>
48
</ol></fieldset>
45
49
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>
50
<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(){
66
        $(document).ready(function(){
63
            $('#mancredit').preventDoubleFormSubmit();
67
            $('#mancredit').preventDoubleFormSubmit();
64
            $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
68
            $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
69
            $('#amount').on('change', function(){CheckPriceAmount(this)});
65
        });
70
        });
66
    </script>
71
    </script>
67
[% END %]
72
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-1 / +6 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"/>
57
        [% INCLUDE 'price-conversion-message.inc' %]
58
    </li>
57
	</ol></fieldset>
59
	</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>
60
<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>
61
</form>
Lines 69-74 Link Here
69
</div>
71
</div>
70
</div>
72
</div>
71
73
74
[% INCLUDE 'prices.inc' %]
72
[% MACRO jsinclude BLOCK %]
75
[% MACRO jsinclude BLOCK %]
73
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script>
76
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script>
74
    <script type="text/javascript">
77
    <script type="text/javascript">
Lines 83-90 Link Here
83
                this.form.desc.value = this.options[this.selectedIndex].value;
86
                this.form.desc.value = this.options[this.selectedIndex].value;
84
                this.form.amount.value = type_fees[this.options[this.selectedIndex].value];
87
                this.form.amount.value = type_fees[this.options[this.selectedIndex].value];
85
            });
88
            });
89
            $('#amount').on('change', function(){CheckPriceAmount(this)});
86
        });
90
        });
87
    </script>
91
    </script>
88
[% END %]
92
[% END %]
89
93
94
90
[% INCLUDE 'intranet-bottom.inc' %]
95
[% 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="CheckPriceAmount(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="CheckPriceAmount(document.payfine.paid)"/>
154
        [% INCLUDE 'price-conversion-message.inc' %]
154
    </li>
155
    </li>
155
    <li>
156
    <li>
156
        <label for="selected_accts_notes">Note: </label>
157
        <label for="selected_accts_notes">Note: </label>
Lines 206-235 Link Here
206
                    decFlag = true;
207
                    decFlag = true;
207
                }
208
                }
208
            }
209
            }
210
        </script>
209
211
210
            if (dolAmount == "") {
212
        [% INCLUDE 'prices.inc' %]
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
213
230
            textObj.value = dolAmount + "." + decAmount;
231
        }
232
    </script>
233
[% END %]
214
[% END %]
234
215
235
[% INCLUDE 'intranet-bottom.inc' %]
216
[% INCLUDE 'intranet-bottom.inc' %]
236
- 

Return to bug 12310