@@ -, +, @@ - x100 or /100 of the amounts - decimal part truncation - Gets rid of the spaces, currency symbols, names (EUR) There is nothing specific about currency symbols is this patch. It just removes everything that is not a digit a minus or a separator. - by default comma and dot as decimal separators on the same instance - dot or comma as thousands separators if choose to use only one of them as decimal separator. See DigitSeparator syspref. - minuses, doesn't remove them Check that you can't enter any string except like "XX.XX" (examples in Annex 1) without having an issue after validation. (x100, truncation, etc) versions, then try. You might spare librarian tears by finding something before it's released. (and prevent me from having bounty on my head) work! The details of expressing your happiness depend on your culture and habits. conversion. Validating the form does the same but it's a trick to test more quickly by not switching to another page. field. well handled. --- .../bug12310_add_DecimalSeparators.sql | 2 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/includes/decimal-input-js.inc | 50 ++++++++++++++++++ .../en/modules/admin/preferences/acquisitions.pref | 2 +- .../en/modules/admin/preferences/i18n_l10n.pref | 4 ++ .../prog/en/modules/members/mancredit.tt | 4 +- .../prog/en/modules/members/maninvoice.tt | 3 +- .../prog/en/modules/members/paycollect.tt | 59 ++-------------------- 8 files changed, 68 insertions(+), 57 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug12310_add_DecimalSeparators.sql create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/decimal-input-js.inc --- a/installer/data/mysql/atomicupdate/bug12310_add_DecimalSeparators.sql +++ a/installer/data/mysql/atomicupdate/bug12310_add_DecimalSeparators.sql @@ -0,0 +1,2 @@ +INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('DecimalSeparators', ',.', NULL , 'The allowed separators between entire and decimal parts of numbers', 'Free'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -137,6 +137,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('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'), ('DefaultToLoggedInLibraryOverdueTriggers', '0', NULL , 'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.', 'YesNo'), ('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), +('DecimalSeparators', '.,', NULL , 'The allowed separators between entire and decimal parts of numbers', 'Free'), ('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'), ('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'), ('displayFacetCount','0',NULL,NULL,'YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/includes/decimal-input-js.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/decimal-input-js.inc @@ -0,0 +1,50 @@ +[% USE Koha %] +[% USE JSON.Escape %] + + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref @@ -28,7 +28,7 @@ Acquisitions: branch: from staff member's library. all: in system, regardless of owner. - - - Display currencies using the following format + - Display currencies using the following format. It you want to choose the possible decimal separators for price input, please use the system preference 'DecimalSeparators'. - pref: CurrencyFormat choices: US: 360,000.00 (US) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref @@ -66,3 +66,7 @@ I18N/L10N: no: "Don't allow" - notices to be translated. - 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. + - + - "Any of these characters can be used as a 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'" + - pref: DecimalSeparators + class: long --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt @@ -3,6 +3,7 @@ [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Create manual credit [% INCLUDE 'doc-head-close.inc' %] +[% INCLUDE 'decimal-input-js.inc' %] @@ -40,7 +41,8 @@
  • -
  • Example: 5.00
  • +
  • +
    Cancel
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt @@ -53,7 +53,7 @@
  • -
  • Example: 5.00
  • +
  • Cancel
    @@ -69,6 +69,7 @@ +[% INCLUDE 'decimal-input-js.inc' %] [% MACRO jsinclude BLOCK %] + + [% INCLUDE 'decimal-input-js.inc' %] + [% END %] [% INCLUDE 'intranet-bottom.inc' %] --