Owen Leonard
0658d84732
This patch removes the "type" attribute from <script> tags in several staff client include files. Also removed: Obsolete "//<![CDATA[ //]]>" markers. This patch also makes minor indentation changes, so diff using the "-w" flag. To test, apply the patch and confirm that examples of affected pages work properly without any JavaScript errors in the browser console: - Acquisitions -> Vendor (uses acuisitions-toolbar.inc) - Acquisitions -> Vendor -> Add to basket -> From a new (empty) record (uses additem.js.inc) - Catalog -> Search results -> Bibliographic detail view. (uses browser-strings.inc, catalog-strings.inc, datatables.inc, and format_price.inc ) - Tools -> Label creator -> Manage -> Label batches -> Export batch (uses greybox.inc) Validating the HTML source of any of these pages should return no errors related to the "type" attribute. Signed-off-by: Nadine Pierre <nadine.pierre@inLibro.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
34 lines
1.4 KiB
PHP
34 lines
1.4 KiB
PHP
[% USE Koha %]
|
|
<script>
|
|
[%# This should use the Format template plugin, but not pushed yet %]
|
|
[% IF Koha.Preference("CurrencyFormat") == 'FR' %]
|
|
var default_value = {
|
|
thousands_sep: ' ',
|
|
decimal_point: ',',
|
|
decimal_digits: 2
|
|
};
|
|
[% ELSIF Koha.Preference("CurrencyFormat") == 'CH' %]
|
|
var default_value = {
|
|
thousands_sep: '\'',
|
|
decimal_point: '.',
|
|
decimal_digits: 2
|
|
};
|
|
[% ELSE %]
|
|
var default_value = {
|
|
thousands_sep: ',',
|
|
decimal_point: '.',
|
|
decimal_digits: 2
|
|
};
|
|
|
|
[% END %]
|
|
Number.prototype.format_price = function( value, params ) {
|
|
params = params == undefined ? {} : params;
|
|
var thousands_sep = params.thousands_sep == undefined ? default_value.thousands_sep : params.thousands_sep,
|
|
decimal_point = params.decimal_point == undefined ? default_value.decimal_point : params.decimal_point,
|
|
//symbol = params.symbol == undefined ? '$' : params.symbol, // Not implemented yet
|
|
decimal_digits = params.decimal_digits == undefined ? default_value.decimal_digits : params.decimal_digits;
|
|
|
|
var re = '\\d(?=(\\d{' + 3 + '})+' + '\\D' + ')', value = this.toFixed(decimal_digits);
|
|
return value.replace('.', decimal_point).replace(new RegExp(re, 'g'), '$&' + thousands_sep);
|
|
}
|
|
</script>
|