From bd1ae42ececb3d8937d60a96202ca955a7cd56b5 Mon Sep 17 00:00:00 2001 From: Pascal Hubrecht Date: Thu, 12 Oct 2023 17:18:50 +0200 Subject: [PATCH] New | Add AGENDA_SORT_EVENT_TYPE_BY_POSITION_FIRST hidden conf to change sort method of actions (#25375) * Position defined in dictionnary must be main sort criterion The position defined in the dictionary must be the main sort criterion. * Use AGENDA_SORT_EVENT_TYPE_BY_POSITION_FIRST hidden conf to sort by position --- htdocs/comm/action/class/cactioncomm.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index ec9f072d702..cf668fb1077 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -178,7 +178,13 @@ class CActionComm if ($morefilter) { $sql .= " AND ".$morefilter; } - $sql .= " ORDER BY type, position, module"; + // If AGENDA_SORT_EVENT_TYPE_BY_POSITION_FIRST is defined, we use position as main sort criterion + // otherwise we use type as main sort criterion + if (!empty($conf->global->AGENDA_SORT_EVENT_TYPE_BY_POSITION_FIRST)) { + $sql .= " ORDER BY position, type, module"; + } else { + $sql .= " ORDER BY type, position, module"; + } dol_syslog(get_class($this)."::liste_array", LOG_DEBUG); $resql = $this->db->query($sql);