Fix: move sql in dao class

This commit is contained in:
Regis Houssin 2011-06-19 15:21:43 +00:00
parent 36223de560
commit 1944639026

View File

@ -401,15 +401,15 @@ class ActionComm extends CommonObject
$sql = "SELECT a.id"; $sql = "SELECT a.id";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " WHERE a.entity = ".$conf->entity; $sql.= " WHERE a.entity = ".$conf->entity;
if ($socid) $sql.= " AND a.fk_soc = ".$socid; if (! empty($socid)) $sql.= " AND a.fk_soc = ".$socid;
if ($elementtype!='') if (! empty($elementtype))
{ {
if ($elementtype == 'project') $sql.= ' AND a.fk_project = '.$fk_element; if ($elementtype == 'project') $sql.= ' AND a.fk_project = '.$fk_element;
else $sql.= " AND a.fk_element = ".$fk_element." AND a.elementtype = '".$elementtype."'"; else $sql.= " AND a.fk_element = ".$fk_element." AND a.elementtype = '".$elementtype."'";
} }
if ($filter) $sql.= $filter; if (! empty($filter)) $sql.= $filter;
dol_syslog("ActionComm::fetchAll sql=".$sql); dol_syslog("ActionComm::getActions sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {