I have a table called 'team'.
In this table there is a field entidad_id that has a dropdown list that retrieves data from the 'entidad' table.
If in the team.class.inc I include this code (which I use to filter the records so each 'entidad' can see only their records):
function _cm_pre_getData ($where, $where_array, $fieldarray=null){
require_once 'classes/entidad.class.inc';
$entidad = new entidad;
$entidad->sql_select = 'entidad_id';
$entidad_id = $entidad->getData("entidad_id='" .$_SESSION['role_id'] ."'");
if ($entidad->numrows == 1){
if (empty($where)){
$where = "entidad_id=" .$entidad_id[0]['entidad_id'] ;
}else{
$where .= " AND entidad_id=" .$entidad_id[0]['entidad_id'] ;
}
}
return $where;
}
then, when adding a new record (logged as an 'entidad') with an add1 transaction in the 'team' table, the entidad_id field becomes a noedit field automatically (I haven't defined it 'noedit' in the dictionary).
For a user that is not an 'entidad' the dropdown list is displayed correctly.
I'm trying to understand what is happening here but can't seem to find the explanation.