diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9a9417a4dac..bc66514940d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -413,7 +413,8 @@ class ActionComm extends CommonObject $resql=$this->db->query($sql); if ($resql) { - if ($this->db->num_rows($resql)) + $num=$this->db->num_rows($resql); + if ($num) { $obj = $this->db->fetch_object($resql); @@ -469,13 +470,15 @@ class ActionComm extends CommonObject $this->elementtype = $obj->elementtype; } $this->db->free($resql); - return 1; } else { $this->error=$this->db->lasterror(); return -1; } + + return $num; + } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index cc602d08ed5..821ada820dc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -766,7 +766,7 @@ class ExtraFields $sqlwhere.= ' WHERE 1'; } if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it. - //$sql.=preg_replace('/^ AND /','',$sqlwhere); + $sql.=$sqlwhere; //print $sql; dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);