本文整理汇总了PHP中get_on_clause函数的典型用法代码示例。如果您正苦于以下问题:PHP get_on_clause函数的具体用法?PHP get_on_clause怎么用?PHP get_on_clause使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_on_clause函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}