Fix: possibility to update a specific field
This commit is contained in:
parent
f7883c6cb6
commit
39d14974da
@ -573,6 +573,27 @@ class CommonObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a specific field from an object
|
||||||
|
* @param table Table element or element line
|
||||||
|
* @param id Object id
|
||||||
|
* @param field Field to update
|
||||||
|
* @param value New value
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function updateObjectField($table,$id,$field,$value)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$result=false;
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
||||||
|
$sql.= $field." = '".$value."'";
|
||||||
|
$sql.= " WHERE rowid = ".$id;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load properties id_previous and id_next
|
* \brief Load properties id_previous and id_next
|
||||||
* \param filter Optional filter
|
* \param filter Optional filter
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user