@@ -, +, @@ --- .../prog/en/modules/ill/ill-requests.tt | 38 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -822,7 +822,8 @@ // Columns that require special treatment var specialCols = { action: { - func: createActionLink + func: createActionLink, + skipSanitize: true }, borrowernumber: { func: createPatronLink @@ -835,7 +836,8 @@ }, biblio_id: { name: _("Bibliograpic record ID"), - func: createBiblioLink + func: createBiblioLink, + skipSanitize: true }, metadata_Type: { func: createType @@ -845,6 +847,9 @@ }, patron_cardnumber: { name: _("Cardnumber") + }, + patron: { + skipSanitize: true } }; @@ -889,6 +894,21 @@ $('#dataPreview').modal({show:true}); }); + // Allow us to chain Datatable render helpers together, so we + // can use our custom functions and render.text(), which + // provides us with data sanitization + $.fn.dataTable.render.multi = function(renderArray) { + return function(d, type, row, meta) { + for(var r = 0; r < renderArray.length; r++) { + var toCall = renderArray[r].hasOwnProperty('display') ? + renderArray[r].display : + renderArray[r]; + d = toCall(d, type, row, meta); + } + return d; + } + } + // Get our data from the API and process it prior to passing // it to datatables var ajax = $.ajax( @@ -921,9 +941,21 @@ specialCols.hasOwnProperty(colName) && specialCols[colName].hasOwnProperty('func') ) { - colObj.render = specialCols[colName].func; + var renderArray = [ + specialCols[colName].func + ]; + if (!specialCols[colName].skipSanitize) { + renderArray.push( + $.fn.dataTable.render.text() + ); + } + + colObj.render = $.fn.dataTable.render.multi( + renderArray + ); } else { colObj.data = colName; + colObj.render = $.fn.dataTable.render.text() } // Make sure properties that aren't present in the API // response are populated with null to avoid Datatables --