Skip to content
Snippets Groups Projects
Commit e9214c2e authored by JediKev's avatar JediKev
Browse files

issue: CDATA Phone Contains

This addresses an issue where people who do not have a phone field on the
contact information form go to search for a User in the User Directory and
the system crashes. This is due to the search query that always contains the
phone field variable. This only adds the phone variable to the search query
if the field actually exists.
parent b19cf261
No related branches found
No related tags found
No related merge requests found
......@@ -10,13 +10,15 @@ $users = User::objects()
if ($_REQUEST['query']) {
$search = $_REQUEST['query'];
$users->filter(Q::any(array(
$filter = Q::any(array(
'emails__address__contains' => $search,
'name__contains' => $search,
'org__name__contains' => $search,
'cdata__phone__contains' => $search,
// TODO: Add search for cdata
)));
));
if (UserForm::getInstance()->getField('phone'))
$filter->add(array('cdata__phone__contains' => $search));
$users->filter($filter);
$qs += array('query' => $_REQUEST['query']);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment