https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43289 Bug ID: 43289 Summary: TypeError in cashup summary modal when API returns totals as strings Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Point of Sale Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: martin.renvoize@openfifth.co.uk Target Milestone: --- format_price() is only defined on Number.prototype (see koha-tmpl/intranet-tmpl/prog/en/includes/format_price.inc), but the /api/v1/cashups/:id summary endpoint's grouped and total amounts (out.total, income.total, type.total, data.summary.total, and the derived cashCollected/actualAmount) can come back as strings - DECIMAL columns are frequently stringified by the DB layer before JSON encoding. Calling e.g. out.total.format_price() on a string throws "TypeError: out.total.format_price is not a function", which aborts the rest of the AJAX success handler and leaves the cashup summary modal partially or fully unrendered. This patch wraps every such value in Number(...) before calling format_price(). It also fixes the "Other payment types collected" filter, which compared type.total !== 0 with strict inequality - always true when type.total is a string, so a $0.00 payment type could show a spurious row in the summary. Test plan: 1. Configure more than one payment type in the CashupPaymentTypes system preference 2. Complete a cashup (pos/register.pl) with income/payout/refund transactions across several payment types, including at least one with a zero total for some payment type 3. Click the cashup's "Summary" link to open the cashup summary modal 4. Before this patch: open the browser console - a TypeError is thrown and the modal's table/footer is only partially populated (or a spurious $0.00 payment type row appears) 5. Apply the patch and repeat step 3 6. The modal renders fully and correctly, with no console error and no spurious zero-amount row -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.