FIX : avoid SQL error in getValueFrom common object when all params are

not send
This commit is contained in:
Florian HENRY 2015-09-23 13:17:58 +02:00
parent 84fa92045c
commit 206d6d0f7e

View File

@ -1083,18 +1083,18 @@ abstract class CommonObject
function getValueFrom($table, $id, $field) function getValueFrom($table, $id, $field)
{ {
$result=false; $result=false;
if (!empty($id) && !empty($field) && !empty($table)) {
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE rowid = ".$id;
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table; dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
$sql.= " WHERE rowid = ".$id; $resql = $this->db->query($sql);
if ($resql)
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG); {
$resql = $this->db->query($sql); $row = $this->db->fetch_row($resql);
if ($resql) $result = $row[0];
{ }
$row = $this->db->fetch_row($resql); }
$result = $row[0];
}
return $result; return $result;
} }