From e8f5a07a5c33926a6a38a2ed8d1aa467ed892854 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 Signed-off-by: Jonathan Druart (cherry picked from commit 8424f402bed2e71d9080d3adabf5e3255bc79629) Signed-off-by: Fridolin Somers --- 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 33f8fa0fab..0b17964828 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -596,9 +596,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.39.5