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)
|
||||
{
|
||||
$result=false;
|
||||
|
||||
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$result = $row[0];
|
||||
}
|
||||
|
||||
if (!empty($id) && !empty($field) && !empty($table)) {
|
||||
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$result = $row[0];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user