From 0c35c1671833adf8c7f2a18d5b5b5754efad5d0f Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 2 Mar 2021 11:19:42 +0000 Subject: [PATCH] Bug 27807: (QA follow-up) Unique values only This patch filters the final _order_by clause such that we only have unique data fields present and we take the first occurence of a field. Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 25373b9306b..d47081cd5cc 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -640,9 +640,9 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { var order_by = options.columns[order_col].data; order_by = order_by.split(':'); var order_dir = e.dir == 'asc' ? '+' : '-'; - orderArray.push(order_by.map(x => order_dir + (!x.includes('.')?'me.'+x:x)).join(',')); + Array.prototype.push.apply(orderArray,order_by.map(x => order_dir + (!x.includes('.')?'me.'+x:x))); }); - dataSet._order_by = orderArray.join(','); + dataSet._order_by = orderArray.filter((v, i, a) => a.indexOf(v) === i).join(','); } return dataSet; -- 2.31.0