Example #1
0
                $sOrder .= " related_to_value " . $sort_order . ", ";
            } else {
                $sOrder .= $ahColumns[intval($_GET['iSortCol_' . $i])] . " " . $sort_order . ", ";
            }
        }
    }
    $sOrder = substr_replace($sOrder, "", -2);
    if ($sOrder == "ORDER BY") {
        $sOrder = "";
    }
}
$do_data_display->set_ds_order_by($sOrder);
// Get the security parameter for the user and add to the where condition
$security_where = "";
$security_where = $_SESSION["do_crm_action_permission"]->get_user_where_condition($entity_table_name, $mid);
$do_data_display->set_ds_list_security($security_where);
/* Filtering - NOTE this does not match the built-in DataTables filtering which does it
* word by word on any field. It's possible to do here, but concerned about efficiency
* on very large tables, and MySQL's regex functionality is very limited
*/
$sWhere = "";
$search_param = array();
if ($_GET['sSearch'] != "") {
    $sWhere .= " AND (";
    for ($i = 0; $i < count($aColumns); $i++) {
        if ($i == count($aColumns) - 1) {
            if ($fields_info[$aColumns[$i]]["field_type"] == 15) {
                // assigned_to
                $sWhere .= " `user`.`user_name` LIKE ? OR `group`.`group_name` LIKE ? )";
                $search_param[] = '%' . $_GET['sSearch'] . '%';
                $search_param[] = '%' . $_GET['sSearch'] . '%';