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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/prices.inc (+23 lines)
Line 0 Link Here
1
[% USE Koha %]
2
<script type="text/javascript">
3
//<![CDATA[
4
5
function isPrice(string){
6
    var prix = new RegExp("^[$|€]{0,1}[ ]{0,}[0-9]{1,10}(([,|.][0-9]{0,2})|)([ ]{0,})([$|€]|)([ ]{0,})$");
7
    if (!prix.test(string)) {
8
        return false;
9
    }
10
    return true;
11
}
12
13
function Price_from_string(string){
14
    if (!isPrice(string)) {
15
        return false;
16
    }
17
    string = string.replace(/[\s+|€|$]/g, '');
18
    string = string.replace(/,/g, '.');
19
    return string;
20
}
21
22
//]]>
23
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-1 / +4 lines)
Lines 27-32 Link Here
27
[% END -%]
27
[% END -%]
28
28
29
[% INCLUDE 'doc-head-open.inc' %]
29
[% INCLUDE 'doc-head-open.inc' %]
30
[% INCLUDE 'prices.inc' %]
30
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
31
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
31
[% INCLUDE 'doc-head-close.inc' %]
32
[% INCLUDE 'doc-head-close.inc' %]
32
[% INCLUDE 'calendar.inc' %]
33
[% INCLUDE 'calendar.inc' %]
Lines 87-94 Link Here
87
                    _alertString += "\n- " + _("Description missing");
88
                    _alertString += "\n- " + _("Description missing");
88
            }
89
            }
89
90
90
            if (!(isNum(f.budget_period_total))) {
91
            if (!(isPrice(f.budget_period_total.value))) {
91
                    _alertString += "\n- " + _("Amount must be a valid number, or empty");
92
                    _alertString += "\n- " + _("Amount must be a valid number, or empty");
93
            }else{
94
                    f.budget_period_total.value=Price_from_string(f.budget_period_total.value);
92
            }
95
            }
93
96
94
/*
97
/*
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-2 / +27 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"/> </li>
74
	</ol></fieldset>
74
	</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>
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>
76
</form>
76
</form>
Lines 85-88 type_fees['[% invoice_types_loo.authorised_value %]'] = "[% invoice_types_loo.li Link Here
85
[% INCLUDE 'circ-menu.inc' %]
85
[% INCLUDE 'circ-menu.inc' %]
86
</div>
86
</div>
87
</div>
87
</div>
88
89
[% INCLUDE 'prices.inc' %]
90
91
<script type="text/javascript">
92
$('#maninvoice').on('submit', function(){Check(this)});
93
function Check(f){
94
    var ok=1;
95
    var _alertString="";
96
    var alertString2;
97
    if (!(isPrice(f.amount.value))) {
98
        _alertString += "\n- " + _("Amount must be a valid number, or empty");
99
    }else{
100
        f.amount.value=Price_from_string(f.amount.value);
101
    }
102
    if (_alertString.length==0) {
103
        return true;
104
    } else {
105
        alertString2  = _("Form not submitted because of the following problem(s)");
106
        alertString2 += "\n------------------------------------------------------------------------------------\n";
107
        alertString2 += _alertString;
108
        alert(alertString2);
109
        return false;
110
    }
111
}
112
</script>
113
88
[% INCLUDE 'intranet-bottom.inc' %]
114
[% INCLUDE 'intranet-bottom.inc' %]
89
- 

Return to bug 12310