Bug for search for patient from patient finder using "care_team_facility" as a column

Situation
There appears to have a bug, when I added patient care team facility as one of the columns in patient finder, it does not search by facilities.

OpenEMR Version
I’m using OpenEMR version 7

Browser:
I’m using: Chrome

Operating System
I’m using: Windows 10

Logs
Did you check the logs?
Was there anything pertinent in them?
Please paste them here (surround with three backticks (```) for readability.
You can also turn on User Debugging under Administration->Globals->Logging User Debugging Options=>All

Hi Bo Wang,

put this code on dynamic_finder_ajax.php next to line number 151 and after this paste the same code on the line number next to 218

elseif ($colname == ‘care_team_facility’) {
if(ctype_digit($sSearch)) {

            $where .= "`" . escape_sql_column_name($colname, array('patient_data')) . "` LIKE ? ";
            array_push($srch_bind, ($sSearch . '%'));
           
           }
           else
           {
            $row = sqlQuery("SELECT id FROM facility WHERE name like ?", array("%".$sSearch."%"));
            //print_r($row['id']);exit();
            if(!empty($row['id']))
            {
            $where .= "`" . escape_sql_column_name($colname, array('patient_data')) . "` LIKE ? ";
            array_push($srch_bind, ($row['id'] . '%'));
            
            }
            else
            {

                $where .= "`" . escape_sql_column_name($colname, array('patient_data')) . "` LIKE ? ";
            array_push($srch_bind, ($sSearch . '%'));  
            }
        }
       
    }

Thanks
Param
help@capminds.com