From 741a010df0d3bcdd0224e701ab352b53ef981cf6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 20 Aug 2010 17:09:07 +0000 Subject: [PATCH] Fix: possibility to defined rang with an external module --- htdocs/core/class/commonobject.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a6cf12d4b44..f5392961441 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -829,6 +829,23 @@ class CommonObject return $row[0]; } } + + /** + * Get rowid of the line relative to its position + * @result int Rowid of the line + */ + function getIdOfLine($rang) + { + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; + $sql.= ' AND rang = '.$rang; + $resql = $this->db->query($sql); + if ($resql) + { + $row = $this->db->fetch_row($resql); + return $row[0]; + } + } /** * Get max value used for position of line (rang)