From b8721e0c64af8ec050fe7059b65a31c67e9777cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Jul 2020 16:00:15 +0200 Subject: [PATCH] FIX Change position of line in BOM --- htdocs/core/ajax/row.php | 4 ++-- htdocs/core/class/commonobject.class.php | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 852910ce9e3..afb33907593 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -47,8 +47,8 @@ top_httphead(); print ''."\n"; // Registering the location of boxes -if ((!empty($_POST['roworder'])) && (!empty($_POST['table_element_line'])) - && (!empty($_POST['fk_element'])) && (!empty($_POST['element_id']))) +if (GETPOST('roworder', 'alpha') && GETPOST('table_element_line', 'alpha', 2) + && GETPOST('fk_element', 'alpha', 2) && GETPOST('element_id', 'int', 2)) { $roworder = GETPOST('roworder', 'alpha', 2); $table_element_line = GETPOST('table_element_line', 'alpha', 2); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 77a4c155fa6..9601320af49 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8154,6 +8154,9 @@ abstract class CommonObject $sql .= ' FROM '.MAIN_DB_PREFIX.$objectline->table_element; $sql .= ' WHERE fk_'.$this->element.' = '.$this->id; if ($morewhere) $sql .= $morewhere; + if (isset($objectline->fields['position'])) { + $sql .= $this->db->order('position', 'ASC'); + } $resql = $this->db->query($sql); if ($resql)