From 04197d73adb6b783bbce3b6e45764d608b566f6a 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 --- 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 801143cf57..f22f5190c0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js +++ b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js @@ -342,14 +342,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