From ff2cf201e2db1f20979bd1f2c154e89150ff5c41 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 23 Aug 2023 16:53:31 +0000 Subject: [PATCH] Bug 32595: Add price formatting to cost and price paid fields in ILL list table Test plan: 1) Enable ILLmodule and install FreeForm, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 2) Create a new FreeForm request and edit its price on the manage page to something like '123' 3) Check back the ILL list table and confirm its shows as '123' 4) Apply patch 5) Verify the table again, see that it now shows as '123.00' Signed-off-by: Owen Leonard Signed-off-by: David Nind --- koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js index ef090e8102..704730a4ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js +++ b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js @@ -363,14 +363,18 @@ $(document).ready(function() { "data": "cost", "orderable": true, "render": function(data, type, row, meta) { - return escape_str(data); + let cost = row.cost && row.cost.replaceAll(',','.'); + cost = Number(cost) || 0; + return cost.escapeHtml().format_price(); } }, { "data": "paid_price", "orderable": true, "render": function(data, type, row, meta) { - return escape_str(data); + let paid_price = row.paid_price && row.paid_price.replaceAll(',','.'); + paid_price = Number(paid_price) || 0; + return paid_price.escapeHtml().format_price(); } }, { -- 2.30.2