OK, that makes sense. This change is not upgrade safe but you got to do what you got to do sometimes. Open data/SugarBean.php and look for:
PHP Code:
function getOwnerWhere($user_id)
{
if(isset($this->field_defs['assigned_user_id']))
{
return " $this->table_name.assigned_user_id ='$user_id' ";
}
if(isset($this->field_defs['created_by']))
{
return " $this->table_name.created_by ='$user_id' ";
}
return '';
}
and change to:
PHP Code:
function getOwnerWhere($user_id)
{
if(isset($this->field_defs['assigned_user_id']) || isset($this->field_defs['created_by']))
{
returnStr = " (";
if(isset($this->field_defs['assigned_user_id'])) {
returnStr .= " $this->table_name.assigned_user_id ='$user_id' ";
}
if(isset($this->field_defs['created_by']))
{
if(returnStr != " (") returnStr .= " OR ";
returnStr .= " $this->table_name.created_by ='$user_id' ";
}
returnStr .= ") ";
return returnStr;
}
return '';
}
I haven't tested it and there are probably better ways to code it but the general idea is to treat both the created by and the assigned to users as owners. The original code returns the assigned user as the owner if there is an assigned user id field which means the created by doesn't get used in your case.
Bookmarks