function getUserByField($field, $search_in_object = false)
{
global $DB;
$id = array();
if (!$search_in_object) {
$id[] = $this->obj->getField($field);
} else {
if (!empty($this->target_object)) {
foreach ($this->target_object as $val) {
$id[] = $val->fields[$field];
}
}
}
if (!empty($id)) {
//Look for the user by his id
$query = $this->getDistinctUserSql() . "\n FROM `glpi_users`" . $this->getProfileJoinSql() . "\n WHERE `glpi_users`.`id` IN ('" . implode("','", $id) . "')";
foreach ($DB->request($query) as $data) {
//Add the user email and language in the notified users list
$this->addToAddressesList($data);
}
}
}