• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_on_clause函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_on_clause函数的典型用法代码示例。如果您正苦于以下问题:PHP get_on_clause函数的具体用法?PHP get_on_clause怎么用?PHP get_on_clause使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_on_clause函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getDuplicateQuery

/** Function to get a to find duplicates in a particular module*/
function getDuplicateQuery($module, $field_values, $ui_type_arr)
{
    global $current_user;
    $tbl_col_fld = explode(",", $field_values);
    $i = 0;
    foreach ($tbl_col_fld as $val) {
        list($tbl[$i], $cols[$i], $fields[$i]) = explode(".", $val);
        $tbl_cols[$i] = $tbl[$i] . "." . $cols[$i];
        $i++;
    }
    $table_cols = implode(",", $tbl_cols);
    $sec_parameter = getSecParameterforMerge($module);
    if ($module == 'Contacts') {
        $nquery = "SELECT vtiger_contactdetails.contactid AS recordid,\n\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_contactdetails\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_contactdetails.contactid\n\t\t\t\tINNER JOIN vtiger_contactaddress ON vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid\n\t\t\t\tINNER JOIN vtiger_contactsubdetails ON vtiger_contactaddress.contactaddressid = vtiger_contactsubdetails.contactsubscriptionid\n\t\t\t\tLEFT JOIN vtiger_contactscf ON vtiger_contactscf.contactid = vtiger_contactdetails.contactid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_contactdetails.contactid\n\t\t\t\tLEFT JOIN vtiger_account ON vtiger_account.accountid=vtiger_contactdetails.accountid\n\t\t\t\tLEFT JOIN vtiger_customerdetails ON vtiger_customerdetails.customerid=vtiger_contactdetails.contactid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\tFROM vtiger_contactdetails\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid\n\t\t\t\t\t\tINNER JOIN vtiger_contactaddress ON vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid\n\t\t\t\t\t\tINNER JOIN vtiger_contactsubdetails ON vtiger_contactaddress.contactaddressid = vtiger_contactsubdetails.contactsubscriptionid\n\t\t\t\t\t\tLEFT JOIN vtiger_contactscf ON vtiger_contactscf.contactid = vtiger_contactdetails.contactid\n\t\t\t\t\t\tLEFT JOIN vtiger_account ON vtiger_account.accountid=vtiger_contactdetails.accountid\n\t\t\t\t\t\tLEFT JOIN vtiger_customerdetails ON vtiger_customerdetails.customerid=vtiger_contactdetails.contactid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_contactdetails.contactid ASC";
    } else {
        if ($module == 'Accounts') {
            $nquery = "SELECT vtiger_account.accountid AS recordid,\n\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\tFROM vtiger_account\n\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_account.accountid\n\t\t\tINNER JOIN vtiger_accountbillads ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid\n\t\t\tINNER JOIN vtiger_accountshipads ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid\n\t\t\tLEFT JOIN vtiger_accountscf ON vtiger_account.accountid=vtiger_accountscf.accountid\n\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_account.accountid\n\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\tFROM vtiger_account\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_account.accountid\n\t\t\t\tINNER JOIN vtiger_accountbillads ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid\n\t\t\t\tINNER JOIN vtiger_accountshipads ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid\n\t\t\t\tLEFT JOIN vtiger_accountscf ON vtiger_account.accountid=vtiger_accountscf.accountid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_account.accountid ASC";
        } else {
            if ($module == 'Leads') {
                $nquery = "SELECT vtiger_leaddetails.leadid AS recordid, vtiger_users_last_import.deleted,{$table_cols}\n\t\t\t\tFROM vtiger_leaddetails\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_leaddetails.leadid\n\t\t\t\tINNER JOIN vtiger_leadsubdetails ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid\n\t\t\t\tINNER JOIN vtiger_leadaddress ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid\n\t\t\t\tLEFT JOIN vtiger_leadscf ON vtiger_leadscf.leadid=vtiger_leaddetails.leadid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_leaddetails.leadid\n\t\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\tFROM vtiger_leaddetails\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_leaddetails.leadid\n\t\t\t\t\t\tINNER JOIN vtiger_leadsubdetails ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid\n\t\t\t\t\t\tINNER JOIN vtiger_leadaddress ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid\n\t\t\t\t\t\tLEFT JOIN vtiger_leadscf ON vtiger_leadscf.leadid=vtiger_leaddetails.leadid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 AND vtiger_leaddetails.converted = 0 {$sec_parameter}\n\t\t\t\t\t\tGROUP BY {$table_cols} HAVING COUNT(*)>1) as temp\n\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\tWHERE vtiger_crmentity.deleted=0  AND vtiger_leaddetails.converted = 0 {$sec_parameter} ORDER BY {$table_cols},vtiger_leaddetails.leadid ASC";
            } else {
                if ($module == 'Products') {
                    $nquery = "SELECT vtiger_products.productid AS recordid,\n\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\tFROM vtiger_products\n\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_products.productid\n\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_products.productid\n\t\t\tLEFT JOIN vtiger_productcf ON vtiger_productcf.productid = vtiger_products.productid\n\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\tFROM vtiger_products\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_products.productid\n\t\t\t\t\t\tLEFT JOIN vtiger_productcf ON vtiger_productcf.productid = vtiger_products.productid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_products.productid ASC";
                } else {
                    if ($module == "HelpDesk") {
                        $nquery = "SELECT vtiger_troubletickets.ticketid AS recordid,\n\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\tFROM vtiger_troubletickets\n\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_troubletickets.ticketid\n\t\t\tLEFT JOIN vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid\n\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_troubletickets.ticketid\n\t\t\tLEFT JOIN vtiger_attachments ON vtiger_attachments.attachmentsid=vtiger_crmentity.crmid\n\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\tLEFT JOIN vtiger_contactdetails ON vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id\n\t\t\tLEFT JOIN vtiger_ticketcomments ON vtiger_ticketcomments.ticketid = vtiger_crmentity.crmid\n\t\t\tINNER JOIN (SELECT {$table_cols} FROM vtiger_troubletickets\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid\n\t\t\t\t\t\tLEFT JOIN vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid\n\t\t\t\t\t\tLEFT JOIN vtiger_attachments ON vtiger_attachments.attachmentsid=vtiger_crmentity.crmid\n\t\t\t\t\t\tLEFT JOIN vtiger_contactdetails ON vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id\n\t\t\t\t\t\tLEFT JOIN vtiger_ticketcomments ON vtiger_ticketcomments.ticketid = vtiger_crmentity.crmid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_contactdetails contd ON contd.contactid = vtiger_troubletickets.parent_id\n\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_troubletickets.ticketid ASC";
                    } else {
                        if ($module == "Potentials") {
                            $nquery = "SELECT vtiger_potential.potentialid AS recordid,\n\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\tFROM vtiger_potential\n\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_potential.potentialid\n\t\t\tLEFT JOIN vtiger_potentialscf ON vtiger_potentialscf.potentialid = vtiger_potential.potentialid\n\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_potential.potentialid\n\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\tFROM vtiger_potential\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_potential.potentialid\n\t\t\t\t\t\tLEFT JOIN vtiger_potentialscf ON vtiger_potentialscf.potentialid = vtiger_potential.potentialid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_potential.potentialid ASC";
                        } else {
                            if ($module == "Vendors") {
                                $nquery = "SELECT vtiger_vendor.vendorid AS recordid,\n\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\tFROM vtiger_vendor\n\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_vendor.vendorid\n\t\t\tLEFT JOIN vtiger_vendorcf ON vtiger_vendorcf.vendorid=vtiger_vendor.vendorid\n\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_vendor.vendorid\n\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\tFROM vtiger_vendor\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_vendor.vendorid\n\t\t\t\t\t\tLEFT JOIN vtiger_vendorcf ON vtiger_vendorcf.vendorid=vtiger_vendor.vendorid\n\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0\n\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0  ORDER BY {$table_cols},vtiger_vendor.vendorid ASC";
                            } else {
                                $modObj = CRMEntity::getInstance($module);
                                if ($modObj != null && method_exists($modObj, 'getDuplicatesQuery')) {
                                    $nquery = $modObj->getDuplicatesQuery($module, $table_cols, $field_values, $ui_type_arr);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $nquery;
}
开发者ID:jgjermeni,项目名称:corebos,代码行数:47,代码来源:utils.php


示例2: getDuplicatesQuery

 /**
  * Function which will give the basic query to find duplicates
  */
 function getDuplicatesQuery($module, $table_cols, $field_values, $ui_type_arr, $select_cols = '')
 {
     $select_clause = "SELECT " . $this->table_name . "." . $this->table_index . " AS recordid, vtiger_users_last_import.deleted," . $table_cols;
     // Select Custom Field Table Columns if present
     if (isset($this->customFieldTable)) {
         $query .= ", " . $this->customFieldTable[0] . ".* ";
     }
     $from_clause = " FROM {$this->table_name}";
     $from_clause .= " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = {$this->table_name}.{$this->table_index}";
     // Consider custom table join as well.
     if (isset($this->customFieldTable)) {
         $from_clause .= " INNER JOIN " . $this->customFieldTable[0] . " ON " . $this->customFieldTable[0] . '.' . $this->customFieldTable[1] . " = {$this->table_name}.{$this->table_index}";
     }
     $from_clause .= " LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
     $where_clause = " WHERE vtiger_crmentity.deleted = 0";
     $where_clause .= $this->getListViewSecurityParameter($module);
     if (isset($select_cols) && trim($select_cols) != '') {
         $sub_query = "SELECT {$select_cols} FROM {$this->table_name} AS t " . " INNER JOIN vtiger_crmentity AS crm ON crm.crmid = t." . $this->table_index;
         // Consider custom table join as well.
         if (isset($this->customFieldTable)) {
             $sub_query .= " LEFT JOIN " . $this->customFieldTable[0] . " tcf ON tcf." . $this->customFieldTable[1] . " = t.{$this->table_index}";
         }
         $sub_query .= " WHERE crm.deleted=0 GROUP BY {$select_cols} HAVING COUNT(*)>1";
     } else {
         $sub_query = "SELECT {$table_cols} {$from_clause} {$where_clause} GROUP BY {$table_cols} HAVING COUNT(*)>1";
     }
     $query = $select_clause . $from_clause . " LEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=" . $this->table_name . "." . $this->table_index . " INNER JOIN (" . $sub_query . ") AS temp ON " . get_on_clause($field_values, $ui_type_arr, $module) . $where_clause . " ORDER BY {$table_cols}," . $this->table_name . "." . $this->table_index . " ASC";
     return $query;
 }
开发者ID:jgjermeni,项目名称:corebos,代码行数:32,代码来源:InventoryDetails.php


示例3: getDuplicateQuery

/** Function to get a to find duplicates in a particular module*/
function getDuplicateQuery($module, $field_values, $ui_type_arr)
{
    global $current_user;
    $tbl_col_fld = explode(",", $field_values);
    $i = 0;
    foreach ($tbl_col_fld as $val) {
        list($tbl[$i], $cols[$i], $fields[$i]) = explode(".", $val);
        $tbl_cols[$i] = $tbl[$i] . "." . $cols[$i];
        $i++;
    }
    $table_cols = implode(",", $tbl_cols);
    $sec_parameter = getSecParameterforMerge($module);
    if (stristr($_REQUEST['action'], 'ImportStep') || $_REQUEST['action'] == $_REQUEST['module'] . 'Ajax' && $_REQUEST['current_action'] == 'ImportSteplast') {
        if ($module == 'Contacts') {
            $ret_arr = get_special_on_clause($table_cols);
            $select_clause = $ret_arr['sel_clause'];
            $on_clause = $ret_arr['on_clause'];
            $nquery = "select vtiger_contactdetails.contactid as recordid,vtiger_users_last_import.deleted,{$table_cols} \n\t\t\t\t\tFROM vtiger_contactdetails\n\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_contactdetails.contactid\n\t\t\t\t\tINNER JOIN vtiger_contactaddress ON vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid\n\t\t\t\t\tINNER JOIN vtiger_contactsubdetails ON vtiger_contactaddress.contactaddressid = vtiger_contactsubdetails.contactsubscriptionid\n\t\t\t\t\tLEFT JOIN vtiger_contactscf ON vtiger_contactscf.contactid = vtiger_contactdetails.contactid \n\t\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_contactdetails.contactid\n\t\t\t\t\tLEFT JOIN vtiger_account ON vtiger_account.accountid=vtiger_contactdetails.accountid\n\t\t\t\t\tLEFT JOIN vtiger_customerdetails ON vtiger_customerdetails.customerid=vtiger_contactdetails.contactid\n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\tINNER JOIN (select {$select_clause} from vtiger_contactdetails t\n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity crm ON crm.crmid=t.contactid\n\t\t\t\t\t\t\tINNER JOIN vtiger_contactaddress addr ON t.contactid = addr.contactaddressid\n\t\t\t\t\t\t\tINNER JOIN vtiger_contactsubdetails subd ON addr.contactaddressid = subd.contactsubscriptionid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_contactscf tcf ON t.contactid = tcf.contactid \n    \t\t\t\t\t\tLEFT JOIN vtiger_account acc ON acc.accountid=t.accountid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_customerdetails custd ON custd.customerid=t.contactid\n\t\t\t\t\t\t\tWHERE crm.deleted=0 group by {$select_clause}  HAVING COUNT(*)>1) as temp\n\t\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_contactdetails.contactid ASC";
        } else {
            if ($module == 'Accounts') {
                $ret_arr = get_special_on_clause($field_values);
                $select_clause = $ret_arr['sel_clause'];
                $on_clause = $ret_arr['on_clause'];
                $nquery = "SELECT vtiger_account.accountid AS recordid,vtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_account\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_account.accountid\n\t\t\t\tINNER JOIN vtiger_accountbillads ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid\n\t\t\t\tINNER JOIN vtiger_accountshipads ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid\n\t\t\t\tLEFT JOIN vtiger_accountscf ON vtiger_account.accountid=vtiger_accountscf.accountid \n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_account.accountid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tINNER JOIN (select {$select_clause} from vtiger_account t\n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity crm ON crm.crmid=t.accountid\n\t\t\t\t\t\t\tINNER JOIN vtiger_accountbillads badd ON t.accountid = badd.accountaddressid\n\t\t\t\t\t\t\tINNER JOIN vtiger_accountshipads sadd ON t.accountid = sadd.accountaddressid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_accountscf tcf ON t.accountid = tcf.accountid\n\t\t\t\t\t\t\tWHERE crm.deleted=0 group by {$select_clause} HAVING COUNT(*)>1) as temp \n\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_account.accountid ASC";
            } else {
                if ($module == 'Leads') {
                    $ret_arr = get_special_on_clause($field_values);
                    $select_clause = $ret_arr['sel_clause'];
                    $on_clause = $ret_arr['on_clause'];
                    $nquery = "select vtiger_leaddetails.leadid as recordid, vtiger_users_last_import.deleted,{$table_cols} \n\t\t\t\t\tFROM vtiger_leaddetails \n\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_leaddetails.leadid \n\t\t\t\t\tINNER JOIN vtiger_leadsubdetails ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid \n\t\t\t\t\tINNER JOIN vtiger_leadaddress ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid\n\t\t\t\t\tLEFT JOIN vtiger_leadscf ON vtiger_leadscf.leadid=vtiger_leaddetails.leadid \n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_leaddetails.leadid \n\t\t\t\t\tINNER JOIN (select {$select_clause} from vtiger_leaddetails t \n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity crm ON crm.crmid=t.leadid \n\t\t\t\t\t\t\tINNER JOIN vtiger_leadsubdetails subd ON subd.leadsubscriptionid = t.leadid \n\t\t\t\t\t\t\tINNER JOIN vtiger_leadaddress addr ON addr.leadaddressid = subd.leadsubscriptionid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_leadscf tcf ON tcf.leadid=t.leadid \n\t\t\t\t\t\t\tWHERE crm.deleted=0 and t.converted = 0 group by {$select_clause} HAVING COUNT(*)>1) as temp \n\t\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . " \n\t\t\t\tWHERE vtiger_crmentity.deleted=0 AND vtiger_leaddetails.converted = 0 {$sec_parameter} ORDER BY {$table_cols},vtiger_leaddetails.leadid ASC";
                } else {
                    if ($module == 'Products') {
                        $ret_arr = get_special_on_clause($field_values);
                        $select_clause = $ret_arr['sel_clause'];
                        $on_clause = $ret_arr['on_clause'];
                        $nquery = "SELECT vtiger_products.productid AS recordid,vtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_products\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_products.productid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_products.productid\n\t\t\t\tLEFT JOIN vtiger_productcf ON vtiger_productcf.productid = vtiger_products.productid\n\t\t\t\tINNER JOIN (select {$select_clause} from vtiger_products t\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity crm ON crm.crmid=t.productid\n\t\t\t\t\t\tLEFT JOIN vtiger_productcf tcf ON tcf.productid=t.productid\n\t\t\t\t\t\tWHERE crm.deleted=0 group by {$select_clause} HAVING COUNT(*)>1) as temp\n\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\tWHERE vtiger_crmentity.deleted=0 ORDER BY {$table_cols},vtiger_products.productid ASC";
                    } else {
                        if ($module == 'HelpDesk') {
                            $ret_arr = get_special_on_clause($field_values);
                            $select_clause = $ret_arr['sel_clause'];
                            $on_clause = $ret_arr['on_clause'];
                            $nquery = "SELECT vtiger_troubletickets.ticketid AS recordid,vtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_troubletickets\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_troubletickets.ticketid\n\t\t\t\tLEFT JOIN vtiger_account ON vtiger_account.accountid = vtiger_troubletickets.parent_id \n\t\t\t\tLEFT JOIN vtiger_contactdetails ON vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id\n\t\t\t\tLEFT JOIN vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_troubletickets.ticketid\n\t\t\t\tLEFT JOIN vtiger_attachments ON vtiger_attachments.attachmentsid=vtiger_crmentity.crmid\n\t\t\t\tLEFT JOIN vtiger_ticketcomments ON vtiger_ticketcomments.ticketid = vtiger_crmentity.crmid\t\t\t\t\n\t\t\t\tINNER JOIN (select {$select_clause} from vtiger_troubletickets t\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity crm ON crm.crmid=t.ticketid\n\t\t\t\t\t\tLEFT JOIN vtiger_account acc ON acc.accountid = t.parent_id \n\t\t\t\t\t\tLEFT JOIN vtiger_contactdetails contd ON contd.contactid = t.parent_id\n\t\t\t\t\t\tLEFT JOIN vtiger_ticketcf tcf ON tcf.ticketid = t.ticketid\n\t\t\t\t\t\tWHERE crm.deleted=0 group by {$select_clause} HAVING COUNT(*)>1) as temp\n\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\tWHERE vtiger_crmentity.deleted=0" . $sec_parameter . " ORDER BY {$table_cols},vtiger_troubletickets.ticketid ASC";
                        } else {
                            if ($module == 'Potentials') {
                                $ret_arr = get_special_on_clause($field_values);
                                $select_clause = $ret_arr['sel_clause'];
                                $on_clause = $ret_arr['on_clause'];
                                $nquery = "SELECT vtiger_potential.potentialid AS recordid,\n\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_potential \n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_potential.potentialid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_potential.potentialid\n\t\t\t\tLEFT JOIN vtiger_potentialscf ON vtiger_potentialscf.potentialid = vtiger_potential.potentialid \n\t\t\t\tINNER JOIN (select {$select_clause} from vtiger_potential t\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity crm ON crm.crmid=t.potentialid\n\t\t\t\t\t\tLEFT JOIN vtiger_potentialscf tcf ON tcf.potentialid=t.potentialid\n\t\t\t\t\t\tWHERE crm.deleted=0 group by {$select_clause} HAVING COUNT(*)>1) as temp\n\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_potential.potentialid ASC";
                            } else {
                                if ($module == 'Vendors') {
                                    $ret_arr = get_special_on_clause($field_values);
                                    $select_clause = $ret_arr['sel_clause'];
                                    $on_clause = $ret_arr['on_clause'];
                                    $nquery = "SELECT vtiger_vendor.vendorid AS recordid,\n\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_vendor\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_vendor.vendorid\n\t\t\t\tLEFT JOIN vtiger_vendorcf ON vtiger_vendorcf.vendorid=vtiger_vendor.vendorid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_vendor.vendorid\t\t\t\t\n\t\t\t\tINNER JOIN (select {$select_clause} from vtiger_vendor t\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity crm ON crm.crmid=t.vendorid\n\t\t\t\t\t\tLEFT JOIN vtiger_vendorcf tcf ON tcf.vendorid=t.vendorid\n\t\t\t\t\t\tWHERE crm.deleted=0 group by {$select_clause} HAVING COUNT(*)>1) as temp\n\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\tWHERE vtiger_crmentity.deleted=0 ORDER BY {$table_cols},vtiger_vendor.vendorid ASC";
                                } else {
                                    $ret_arr = get_special_on_clause($field_values);
                                    $select_clause = $ret_arr['sel_clause'];
                                    $on_clause = $ret_arr['on_clause'];
                                    $modObj = CRMEntity::getInstance($module);
                                    if ($modObj != null && method_exists($modObj, 'getDuplicatesQuery')) {
                                        $nquery = $modObj->getDuplicatesQuery($module, $table_cols, $field_values, $ui_type_arr, $select_clause);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        if ($module == 'Contacts') {
            $nquery = "SELECT vtiger_contactdetails.contactid AS recordid,\n\t\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\t\tFROM vtiger_contactdetails\n\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_contactdetails.contactid\n\t\t\t\t\tINNER JOIN vtiger_contactaddress ON vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid\n\t\t\t\t\tINNER JOIN vtiger_contactsubdetails ON vtiger_contactaddress.contactaddressid = vtiger_contactsubdetails.contactsubscriptionid\n\t\t\t\t\tLEFT JOIN vtiger_contactscf ON vtiger_contactscf.contactid = vtiger_contactdetails.contactid\n\t\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_contactdetails.contactid\n\t\t\t\t\tLEFT JOIN vtiger_account ON vtiger_account.accountid=vtiger_contactdetails.accountid\n\t\t\t\t\tLEFT JOIN vtiger_customerdetails ON vtiger_customerdetails.customerid=vtiger_contactdetails.contactid\n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\t\tFROM vtiger_contactdetails\n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid\n\t\t\t\t\t\t\tINNER JOIN vtiger_contactaddress ON vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid\n\t\t\t\t\t\t\tINNER JOIN vtiger_contactsubdetails ON vtiger_contactaddress.contactaddressid = vtiger_contactsubdetails.contactsubscriptionid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_contactscf ON vtiger_contactscf.contactid = vtiger_contactdetails.contactid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_account ON vtiger_account.accountid=vtiger_contactdetails.accountid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_customerdetails ON vtiger_customerdetails.customerid=vtiger_contactdetails.contactid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t                                WHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_contactdetails.contactid ASC";
        } else {
            if ($module == 'Accounts') {
                $nquery = "SELECT vtiger_account.accountid AS recordid,\n\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_account\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_account.accountid\n\t\t\t\tINNER JOIN vtiger_accountbillads ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid\n\t\t\t\tINNER JOIN vtiger_accountshipads ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid\n\t\t\t\tLEFT JOIN vtiger_accountscf ON vtiger_account.accountid=vtiger_accountscf.accountid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_account.accountid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\tFROM vtiger_account\n\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_account.accountid\n\t\t\t\t\tINNER JOIN vtiger_accountbillads ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid\n\t\t\t\t\tINNER JOIN vtiger_accountshipads ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid\n\t\t\t\t\tLEFT JOIN vtiger_accountscf ON vtiger_account.accountid=vtiger_accountscf.accountid \n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n                                WHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_account.accountid ASC";
            } else {
                if ($module == 'Leads') {
                    $nquery = "SELECT vtiger_leaddetails.leadid AS recordid, vtiger_users_last_import.deleted,{$table_cols} \n\t\t\t\t\tFROM vtiger_leaddetails \n\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_leaddetails.leadid \n\t\t\t\t\tINNER JOIN vtiger_leadsubdetails ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid \n\t\t\t\t\tINNER JOIN vtiger_leadaddress ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid \n\t\t\t\t\tLEFT JOIN vtiger_leadscf ON vtiger_leadscf.leadid=vtiger_leaddetails.leadid\n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_leaddetails.leadid \n\t\t\t\t\tINNER JOIN (SELECT {$table_cols} \n\t\t\t\t\t\t\tFROM vtiger_leaddetails \n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_leaddetails.leadid \n\t\t\t\t\t\t\tINNER JOIN vtiger_leadsubdetails ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid \n\t\t\t\t\t\t\tINNER JOIN vtiger_leadaddress ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_leadscf ON vtiger_leadscf.leadid=vtiger_leaddetails.leadid \n\t\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 AND vtiger_leaddetails.converted = 0 {$sec_parameter}\n\t\t\t\t\t\t\tGROUP BY {$table_cols} HAVING COUNT(*)>1) as temp \n\t\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n\t\t\t\t\tWHERE vtiger_crmentity.deleted=0  AND vtiger_leaddetails.converted = 0 {$sec_parameter} ORDER BY {$table_cols},vtiger_leaddetails.leadid ASC";
                } else {
                    if ($module == 'Products') {
                        $nquery = "SELECT vtiger_products.productid AS recordid,\n\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_products\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_products.productid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_products.productid\n\t\t\t\tLEFT JOIN vtiger_productcf ON vtiger_productcf.productid = vtiger_products.productid\n\t\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\t\tFROM vtiger_products\n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_products.productid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_productcf ON vtiger_productcf.productid = vtiger_products.productid \n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0\n\t\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n                                WHERE vtiger_crmentity.deleted=0  ORDER BY {$table_cols},vtiger_products.productid ASC";
                    } else {
                        if ($module == "HelpDesk") {
                            $nquery = "SELECT vtiger_troubletickets.ticketid AS recordid,\n\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_troubletickets\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_troubletickets.ticketid\n\t\t\t\tLEFT JOIN vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_troubletickets.ticketid\n\t\t\t\tLEFT JOIN vtiger_attachments ON vtiger_attachments.attachmentsid=vtiger_crmentity.crmid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_contactdetails ON vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id\n\t\t\t\tLEFT JOIN vtiger_ticketcomments ON vtiger_ticketcomments.ticketid = vtiger_crmentity.crmid\n\t\t\t\tINNER JOIN (SELECT {$table_cols} FROM vtiger_troubletickets\n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid \n\t\t\t\t\t\t\tLEFT JOIN vtiger_attachments ON vtiger_attachments.attachmentsid=vtiger_crmentity.crmid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_contactdetails ON vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id\n\t\t\t\t\t\t\tLEFT JOIN vtiger_ticketcomments ON vtiger_ticketcomments.ticketid = vtiger_crmentity.crmid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_contactdetails contd ON contd.contactid = vtiger_troubletickets.parent_id\n\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n                                WHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_troubletickets.ticketid ASC";
                        } else {
                            if ($module == "Potentials") {
                                $nquery = "SELECT vtiger_potential.potentialid AS recordid,\n\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_potential\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_potential.potentialid\n\t\t\t\tLEFT JOIN vtiger_potentialscf ON vtiger_potentialscf.potentialid = vtiger_potential.potentialid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_potential.potentialid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\t\tFROM vtiger_potential\n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_potential.potentialid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_potentialscf ON vtiger_potentialscf.potentialid = vtiger_potential.potentialid \n\t\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\t\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 {$sec_parameter}\n\t\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n                                WHERE vtiger_crmentity.deleted=0 {$sec_parameter} ORDER BY {$table_cols},vtiger_potential.potentialid ASC";
                            } else {
                                if ($module == "Vendors") {
                                    $nquery = "SELECT vtiger_vendor.vendorid AS recordid,\n\t\t\t\tvtiger_users_last_import.deleted," . $table_cols . "\n\t\t\t\tFROM vtiger_vendor\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_vendor.vendorid\n\t\t\t\tLEFT JOIN vtiger_vendorcf ON vtiger_vendorcf.vendorid=vtiger_vendor.vendorid\n\t\t\t\tLEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_vendor.vendorid\n\t\t\t\tINNER JOIN (SELECT {$table_cols}\n\t\t\t\t\t\t\tFROM vtiger_vendor\n\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_vendor.vendorid\n\t\t\t\t\t\t\tLEFT JOIN vtiger_vendorcf ON vtiger_vendorcf.vendorid=vtiger_vendor.vendorid \n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0\n\t\t\t\t\t\t\tGROUP BY " . $table_cols . " HAVING COUNT(*)>1) as temp\n\t\t\t\tON " . get_on_clause($field_values, $ui_type_arr, $module) . "\n                                WHERE vtiger_crmentity.deleted=0  ORDER BY {$table_cols},vtiger_vendor.vendorid ASC";
                                } else {
                                    $modObj = CRMEntity::getInstance($module);
                                    if ($modObj != null && method_exists($modObj, 'getDuplicatesQuery')) {
                                        $nquery = $modObj->getDuplicatesQuery($module, $table_cols, $field_values, $ui_type_arr);
                                    }
                                }
                            }
                        }
                    }
//.........这里部分代码省略.........
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:101,代码来源:utils.php



注:本文中的get_on_clause函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_one函数代码示例发布时间:2022-05-15
下一篇:
PHP get_offset_sec函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap