FIX : avoid SQL error in getValueFrom common object when all params are
not send
This commit is contained in:
parent
84fa92045c
commit
206d6d0f7e
@ -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 = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
|
||||||
$sql.= " WHERE rowid = ".$id;
|
$sql.= " WHERE rowid = ".$id;
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
|
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$row = $this->db->fetch_row($resql);
|
$row = $this->db->fetch_row($resql);
|
||||||
$result = $row[0];
|
$result = $row[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user