From 56556ba222b8a353ac7c0a1e3b4eb8b85ecd70b8 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sun, 26 May 2013 10:15:43 +0200 Subject: [PATCH 1/2] Fix [ bug #911 ] Reorder intervention do not work --- htdocs/core/class/commonobject.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8b9e210b4f9..3938a799b37 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1068,7 +1068,13 @@ abstract class CommonObject // We frist search all lines that are parent lines (for multilevel details lines) $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; - $sql.= ' AND fk_parent_line IS NULL'; + + //This test is to fix Fix [ bug #911 ] Reorder intervention do not work in 3.3 + //Do not merge in 3.4 'table column fk_parent_line already added into 3.4 + if ($this->table_element_line != 'fichinterdet') { + $sql.= ' AND fk_parent_line IS NULL'; + } + $sql.= ' ORDER BY rang ASC, rowid '.$rowidorder; dol_syslog(get_class($this)."::line_order search all parent lines sql=".$sql, LOG_DEBUG); From f543f00024eb621ab6441b461d824e11dd059470 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sun, 26 May 2013 10:34:00 +0200 Subject: [PATCH 2/2] Fix PGSQL Bugs Removing parenthesis make query works for MySQL and PgSQL --- htdocs/comm/action/listactions.php | 4 ++-- htdocs/core/lib/agenda.lib.php | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 341d430f2ac..d535e2f64dd 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -153,9 +153,9 @@ $sql.= " ua.login as loginauthor, ua.rowid as useridauthor,"; $sql.= " ut.login as logintodo, ut.rowid as useridtodo,"; $sql.= " ud.login as logindone, ud.rowid as useriddone,"; $sql.= " sp.name, sp.firstname"; -$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,"; +$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,"; $sql.= " ".MAIN_DB_PREFIX.'user as u,'; -$sql.= " ".MAIN_DB_PREFIX."actioncomm as a)"; +$sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 0713430f66e..f9fd8814914 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -184,11 +184,10 @@ function show_array_actions_to_do($max=5) $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,"; $sql.= " c.code, c.libelle,"; $sql.= " s.nom as sname, s.rowid, s.client"; - $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,"; $sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ")"; $sql.= " WHERE c.id = a.fk_action"; $sql.= " AND a.entity = ".$conf->entity; $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; @@ -283,11 +282,10 @@ function show_array_last_actions_done($max=5) $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,"; $sql.= " c.code, c.libelle,"; $sql.= " s.rowid, s.nom as sname, s.client"; - $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,"; $sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.=")"; $sql.= " WHERE c.id = a.fk_action"; $sql.= " AND a.entity = ".$conf->entity; $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";