Bug 27719: Apply _escape_str and _escape_price where needed
authorAgustin Moyano <agustinmoyano@theke.io>
Wed, 17 Feb 2021 15:49:32 +0000 (12:49 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 18 Feb 2021 10:52:01 +0000 (11:52 +0100)
commit740331c39e65aca18244bbf759ed6f722eeb0ac9
treeb81cef166208eea11d419a4308cb7ac7cd15edaa
parent6bd75d6dcaf77a7d5b11c1eabcbdb17ae0f6e12a
Bug 27719: Apply _escape_str and _escape_price where needed

This bug replaces calls for .escapeHtml and format_price for there null
checking counterparts

To test:

1: have a fresh Koha Testing Docker
2: have a basket set to create item records on ordering
3: populate basket from a marc file, only setting price and fund for the items
4: close basket
5: click to Receive, create invoice
6: on parcel.pl, "Processing" alert never resolves
CHECK => The console shows:
parcel.pl?invoiceid=1:810 Uncaught TypeError: Cannot read property 'format_price' of null
    at render (parcel.pl?invoiceid=1:810)
    at datatables.min_20.1200012.js:57
    at Object.b.fnGetData (datatables.min_20.1200012.js:51)
    at B (datatables.min_20.1200012.js:56)
    at Ha (datatables.min_20.1200012.js:64)
    at P (datatables.min_20.1200012.js:68)
    at vb (datatables.min_20.1200012.js:79)
    at datatables.min_20.1200012.js:76
    at i (datatables.min_20.1200012.js:74)
    at Object.success (datatables.min_20.1200012.js:75)

And that error points toward:
                        "data": "replacement_price",
                        "render": function(data, type, row, meta) {
                            return (row.replacement_price).format_price();
                        },
                    },
7: apply patch
8: redo steps 5 and 6
SUCCESS => "Processing" alert doesn't hangs, and prices with null values
are empty.

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt