本文整理汇总了PHP中getFieldsListFromQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP getFieldsListFromQuery函数的具体用法?PHP getFieldsListFromQuery怎么用?PHP getFieldsListFromQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getFieldsListFromQuery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_export_query
/**
* Create query to export the records.
*/
function create_export_query($where)
{
global $current_user;
$thismodule = $_REQUEST['module'];
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery($thismodule, "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT {$fields_list}, vtiger_users.user_name AS user_name \n\t\t\t\tFROM vtiger_crmentity INNER JOIN {$this->table_name} ON vtiger_crmentity.crmid={$this->table_name}.{$this->table_index}";
if (!empty($this->customFieldTable)) {
$query .= " INNER JOIN " . $this->customFieldTable[0] . " ON " . $this->customFieldTable[0] . '.' . $this->customFieldTable[1] . " = {$this->table_name}.{$this->table_index}";
}
$query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= " LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id and vtiger_users.status='Active'";
$linkedModulesQuery = $this->db->pquery("SELECT distinct fieldname, columnname, relmodule FROM vtiger_field" . " INNER JOIN vtiger_fieldmodulerel ON vtiger_fieldmodulerel.fieldid = vtiger_field.fieldid" . " WHERE uitype='10' AND vtiger_fieldmodulerel.module=?", array($thismodule));
$linkedFieldsCount = $this->db->num_rows($linkedModulesQuery);
$rel_mods[$this->table_name] = 1;
for ($i = 0; $i < $linkedFieldsCount; $i++) {
$related_module = $this->db->query_result($linkedModulesQuery, $i, 'relmodule');
$fieldname = $this->db->query_result($linkedModulesQuery, $i, 'fieldname');
$columnname = $this->db->query_result($linkedModulesQuery, $i, 'columnname');
$other = CRMEntity::getInstance($related_module);
vtlib_setup_modulevars($related_module, $other);
if ($rel_mods[$other->table_name]) {
$rel_mods[$other->table_name] = $rel_mods[$other->table_name] + 1;
$alias = $other->table_name . $rel_mods[$other->table_name];
$query_append = "as {$alias}";
} else {
$alias = $other->table_name;
$query_append = '';
$rel_mods[$other->table_name] = 1;
}
$query .= " LEFT JOIN {$other->table_name} {$query_append} ON {$alias}.{$other->table_index} = {$this->table_name}.{$columnname}";
}
$query .= $this->getNonAdminAccessControlQuery($thismodule, $current_user);
$where_auto = " vtiger_crmentity.deleted=0";
if ($where != '') {
$query .= " WHERE ({$where}) AND {$where_auto}";
} else {
$query .= " WHERE {$where_auto}";
}
return $query;
}
示例2: create_export_query
/** Function to export the lead records in CSV Format
* @param reference variable - where condition is passed when the query is executed
* Returns Export Leads Query.
*/
function create_export_query($where)
{
global $log, $current_user;
$log->debug("Entering create_export_query(" . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("Leads", "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = "SELECT {$fields_list},case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name\n\t\t\t\tFROM " . $this->entity_table . "\n\t\t\t\tINNER JOIN vtiger_leaddetails ON vtiger_crmentity.crmid=vtiger_leaddetails.leadid\n\t\t\t\tLEFT JOIN vtiger_leadsubdetails ON vtiger_leaddetails.leadid = vtiger_leadsubdetails.leadsubscriptionid\n\t\t\t\tLEFT JOIN vtiger_leadaddress ON vtiger_leaddetails.leadid=vtiger_leadaddress.leadaddressid\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_crmentity.smownerid = vtiger_users.id and vtiger_users.status='Active'";
$query .= $this->getNonAdminAccessControlQuery('Leads', $current_user);
$where_auto = " vtiger_crmentity.deleted=0 AND vtiger_leaddetails.converted =0";
if ($where != "") {
$query .= " where ({$where}) AND " . $where_auto;
} else {
$query .= " where " . $where_auto;
}
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例3: create_export_query
/** Function to export the account records in CSV Format
* @param reference variable - where condition is passed when the query is executed
* Returns Export Accounts Query.
*/
function create_export_query($where)
{
global $log;
global $current_user;
$log->debug("Entering create_export_query(" . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("Accounts", "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT {$fields_list},case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name\n\t \t\t\tFROM " . $this->entity_table . "\n\t\t\t\tINNER JOIN vtiger_account\n\t\t\t\t\tON vtiger_account.accountid = vtiger_crmentity.crmid\n\t\t\t\tLEFT JOIN vtiger_accountbillads\n\t\t\t\t\tON vtiger_accountbillads.accountaddressid = vtiger_account.accountid\n\t\t\t\tLEFT JOIN vtiger_accountshipads\n\t\t\t\t\tON vtiger_accountshipads.accountaddressid = vtiger_account.accountid\n\t\t\t\tLEFT JOIN vtiger_accountscf\n\t\t\t\t\tON vtiger_accountscf.accountid = vtiger_account.accountid\n\t LEFT JOIN vtiger_groups\n \t ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users\n\t\t\t\t\tON vtiger_users.id = vtiger_crmentity.smownerid and vtiger_users.status = 'Active'\n\t\t\t\tLEFT JOIN vtiger_account vtiger_account2\n\t\t\t\t\tON vtiger_account2.accountid = vtiger_account.parentid\n\t\t\t\t";
//vtiger_account2 is added to get the Member of account
$query .= $this->getNonAdminAccessControlQuery('Accounts', $current_user);
$where_auto = " vtiger_crmentity.deleted = 0 ";
if ($where != "") {
$query .= " WHERE ({$where}) AND " . $where_auto;
} else {
$query .= " WHERE " . $where_auto;
}
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例4: create_export_query
/** function used to get the export query for product
* @param reference $where - reference of the where variable which will be added with the query
* @return string $query - return the query which will give the list of products to export
*/
function create_export_query($where)
{
global $log;
$log->debug("Entering create_export_query(" . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("Products", "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT {$fields_list} FROM " . $this->table_name . "\n\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_products.productid \n\t\t\tLEFT JOIN vtiger_productcf\n\t\t\t\tON vtiger_products.productid = vtiger_productcf.productid\n\t\t\tINNER JOIN vtiger_users\n\t\t\t\tON vtiger_users.id=vtiger_products.handler \n\n\t\t\tLEFT JOIN vtiger_vendor\n\t\t\t\tON vtiger_vendor.vendorid = vtiger_products.vendor_id\n\t\t\tWHERE vtiger_crmentity.deleted = 0 and vtiger_users.status = 'Active'";
if ($where != "") {
$query .= " AND ({$where}) ";
}
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例5: create_export_query
/**
* Create query to export the records.
*/
function create_export_query($where)
{
global $current_user;
$thismodule = $_REQUEST['module'];
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery($thismodule, "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT {$fields_list}, vtiger_users.user_name AS user_name \n\t\t\t\t\tFROM vtiger_crmentity INNER JOIN {$this->table_name} ON vtiger_crmentity.crmid={$this->table_name}.{$this->table_index}";
if (!empty($this->customFieldTable)) {
$query .= " INNER JOIN " . $this->customFieldTable[0] . " ON " . $this->customFieldTable[0] . '.' . $this->customFieldTable[1] . " = {$this->table_name}.{$this->table_index}";
}
$query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= " LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id and vtiger_users.status='Active'";
$linkedModulesQuery = $this->db->pquery("SELECT distinct fieldname, columnname, relmodule FROM vtiger_field" . " INNER JOIN vtiger_fieldmodulerel ON vtiger_fieldmodulerel.fieldid = vtiger_field.fieldid" . " WHERE uitype='10' AND vtiger_fieldmodulerel.module=?", array($thismodule));
$linkedFieldsCount = $this->db->num_rows($linkedModulesQuery);
for ($i = 0; $i < $linkedFieldsCount; $i++) {
$related_module = $this->db->query_result($linkedModulesQuery, $i, 'relmodule');
$fieldname = $this->db->query_result($linkedModulesQuery, $i, 'fieldname');
$columnname = $this->db->query_result($linkedModulesQuery, $i, 'columnname');
$other = CRMEntity::getInstance($related_module);
vtlib_setup_modulevars($related_module, $other);
$query .= " LEFT JOIN {$other->table_name} ON {$other->table_name}.{$other->table_index} = {$this->table_name}.{$columnname}";
}
$where_auto = " vtiger_crmentity.deleted=0";
if ($where != '') {
$query .= " WHERE ({$where}) AND {$where_auto}";
} else {
$query .= " WHERE {$where_auto}";
}
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
// Security Check for Field Access
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[7] == 3) {
//Added security check to get the permitted records only
$query = $query . " " . getListViewSecurityParameter($thismodule);
}
return $query;
}
示例6: create_export_query
/**
* Create query to export the records.
*/
function create_export_query($where)
{
global $current_user;
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery('OSSMailView', "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT {$fields_list}, vtiger_users.user_name AS user_name\n\t\t\t\t\tFROM vtiger_crmentity INNER JOIN {$this->table_name} ON vtiger_crmentity.crmid={$this->table_name}.{$this->table_index}";
if (!empty($this->customFieldTable)) {
$query .= " INNER JOIN " . $this->customFieldTable[0] . " ON " . $this->customFieldTable[0] . '.' . $this->customFieldTable[1] . " = {$this->table_name}.{$this->table_index}";
}
$query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= " LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id and vtiger_users.status='Active'";
$where_auto = " vtiger_crmentity.deleted=0";
if ($where != '') {
$query .= " WHERE ({$where}) AND {$where_auto}";
} else {
$query .= " WHERE {$where_auto}";
}
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
// Security Check for Field Access
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[getTabid('OSSMailView')] == 3) {
//Added security check to get the permitted records only
$query = $query . " " . getListViewSecurityParameter($thismodule);
}
return $query;
}
示例7: create_export_query
/**
* Create query to export the records.
*/
function create_export_query($where)
{
global $current_user;
$thismodule = $_REQUEST['module'];
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery($thismodule, "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT {$fields_list}\n\t\t\t\t\tFROM vtiger_crmentity INNER JOIN {$this->table_name} ON vtiger_crmentity.crmid={$this->table_name}.{$this->table_index}";
if (!empty($this->customFieldTable)) {
$query .= " INNER JOIN " . $this->customFieldTable[0] . " ON " . $this->customFieldTable[0] . '.' . $this->customFieldTable[1] . " = {$this->table_name}.{$this->table_index}";
}
$query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= " LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id AND vtiger_users.status='Active'";
$query .= $this->getNonAdminAccessControlQuery('Services', $current_user);
$where_auto = " vtiger_crmentity.deleted=0";
if ($where != '') {
$query .= " WHERE ({$where}) AND {$where_auto}";
} else {
$query .= " WHERE {$where_auto}";
}
return $query;
}
示例8: create_export_query
/** Function to export the ticket records in CSV Format
* @param reference variable - where condition is passed when the query is executed
* Returns Export Tickets Query.
*/
function create_export_query($where)
{
global $log, $current_user;
$log->debug("Entering create_export_query(" . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("HelpDesk", "detail_view");
$fields_list = getFieldsListFromQuery($sql);
//Ticket changes--5198
$fields_list = str_replace(",vtiger_ticketcomments.comments as 'Add Comment'", ' ', $fields_list);
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = "SELECT {$fields_list},case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name\n\t\t\tFROM " . $this->entity_table . "\n\t\t\tINNER JOIN vtiger_troubletickets ON vtiger_troubletickets.ticketid =vtiger_crmentity.crmid\n\t\t\tLEFT JOIN vtiger_crmentity vtiger_crmentityRelatedTo ON vtiger_crmentityRelatedTo.crmid = vtiger_troubletickets.parent_id\n\t\t\tLEFT JOIN vtiger_account ON vtiger_account.accountid = vtiger_troubletickets.parent_id\n\t\t\tLEFT JOIN vtiger_contactdetails ON vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id\n\t\t\tLEFT JOIN vtiger_ticketcf ON vtiger_ticketcf.ticketid=vtiger_troubletickets.ticketid\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 and vtiger_users.status='Active'\n\t\t\tLEFT JOIN vtiger_seattachmentsrel ON vtiger_seattachmentsrel.crmid =vtiger_troubletickets.ticketid\n\t\t\tLEFT JOIN vtiger_attachments ON vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid\n\t\t\tLEFT JOIN vtiger_products ON vtiger_products.productid=vtiger_troubletickets.product_id";
$query .= getNonAdminAccessControlQuery('HelpDesk', $current_user);
$where_auto = " vtiger_crmentity.deleted = 0 ";
if ($where != "") {
$query .= " WHERE ({$where}) AND " . $where_auto;
} else {
$query .= " WHERE " . $where_auto;
}
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例9: create_export_query
/** function used to get the export query for product
* @param reference $where - reference of the where variable which will be added with the query
* @return string $query - return the query which will give the list of products to export
*/
function create_export_query($where)
{
global $log, $current_user;
$log->debug("Entering create_export_query(" . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("Products", "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT {$fields_list} FROM " . $this->table_name . "\n\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_products.productid\n\t\t\tLEFT JOIN vtiger_productcf\n\t\t\t\tON vtiger_products.productid = vtiger_productcf.productid\n\t\t\tLEFT JOIN vtiger_vendor\n\t\t\t\tON vtiger_vendor.vendorid = vtiger_products.vendor_id";
$query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= " LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id AND vtiger_users.status='Active'";
$query .= $this->getNonAdminAccessControlQuery('Products', $current_user);
$where_auto = " vtiger_crmentity.deleted=0";
if ($where != '') {
$query .= " WHERE ({$where}) AND {$where_auto}";
} else {
$query .= " WHERE {$where_auto}";
}
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例10: create_export_query
/** Function to export the account records in CSV Format
* @param reference variable - order by is passed when the query is executed
* @param reference variable - where condition is passed when the query is executed
* Returns Export Accounts Query.
*/
function create_export_query(&$order_by, &$where)
{
global $log;
global $current_user;
$log->debug("Entering create_export_query(" . $order_by . "," . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("Accounts", "detail_view");
global $mod_strings;
global $current_language;
if (empty($mod_strings)) {
$mod_strings = return_module_language($current_language, "Accounts");
}
$fields_list = getFieldsListFromQuery($sql, $mod_strings);
$query = "SELECT {$fields_list} FROM ec_account\n\t\t\t\tLEFT JOIN ec_users\n\t\t\t\t\tON ec_account.smownerid = ec_users.id\n\t\t\t\tLEFT JOIN ec_users as ucreator\n\t\t\t\t\tON ec_account.smcreatorid = ucreator.id ";
$where_auto = " ec_account.deleted = 0 ";
if ($where != "") {
$query .= "WHERE ({$where}) AND " . $where_auto;
} else {
$query .= "WHERE " . $where_auto;
}
$query .= " and ucreator.id=" . $_SESSION['authenticated_user_id'] . " ";
if (!empty($order_by)) {
$query .= " ORDER BY {$order_by}";
}
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例11: create_export_query
/** Function to export the notes in CSV Format
* @param reference variable - order by is passed when the query is executed
* @param reference variable - where condition is passed when the query is executed
* Returns Export Notes Query.
*/
function create_export_query(&$order_by, &$where)
{
global $log;
$log->debug("Entering create_export_query(" . $order_by . "," . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("Notes", "detail_view");
global $mod_strings;
global $current_language;
if (empty($mod_strings)) {
$mod_strings = return_module_language($current_language, "Notes");
}
$fields_list = getFieldsListFromQuery($sql, $mod_strings);
$query = "SELECT {$fields_list} FROM ec_notes\n\t\t\t\tLEFT JOIN ec_contactdetails\n\t\t\t\t\tON ec_notes.contact_id=ec_contactdetails.contactid\n\t\t\t\tLEFT JOIN ec_account\n\t\t\t\t\tON ec_notes.accountid=ec_account.accountid\n\t\t\t\tLEFT JOIN ec_users\n\t\t\t\t\tON ec_notes.smownerid = ec_users.id\n\t\t\t\tLEFT JOIN ec_users as ucreator\n\t\t\t\t\tON ec_notes.smcreatorid = ucreator.id\n\t\t\t\tWHERE ec_notes.deleted=0 " . $where;
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例12: create_export_query
/** Function to export the lead records in CSV Format
* @param reference variable - where condition is passed when the query is executed
* Returns Export OSSCosts Query.
*/
function create_export_query($where)
{
global $log;
global $current_user;
$log->debug("Entering create_export_query(" . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("OSSCosts", "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$fields_list .= getInventoryFieldsForExport($this->table_name);
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = "SELECT {$fields_list} FROM " . $this->entity_table . "\n\t\t\t\tINNER JOIN vtiger_osscosts ON vtiger_osscosts.osscostsid = vtiger_crmentity.crmid\n\t\t\t\tLEFT JOIN vtiger_osscostscf ON vtiger_osscostscf.osscostsid = vtiger_osscosts.osscostsid\n\t\t\t\tLEFT JOIN vtiger_inventoryproductrel ON vtiger_inventoryproductrel.id = vtiger_osscosts.osscostsid\n\t\t\t\tLEFT JOIN vtiger_products ON vtiger_products.productid = vtiger_inventoryproductrel.productid\n\t\t\t\tLEFT JOIN vtiger_service ON vtiger_service.serviceid = vtiger_inventoryproductrel.productid\n\t\t\t\tLEFT JOIN vtiger_contactdetails ON vtiger_contactdetails.contactid = vtiger_osscosts.relategid\n\t\t\t\tLEFT JOIN vtiger_osscosts ON vtiger_osscosts.osscostsid = vtiger_osscosts.relategid\n\t\t\t\tLEFT JOIN vtiger_vendor ON vtiger_vendor.vendorid = vtiger_osscosts.relategid\n\t\t\t\tLEFT JOIN vtiger_potential ON vtiger_potential.potentialid = vtiger_osscosts.potentialid\n\t\t\t\tLEFT JOIN vtiger_project ON vtiger_project.projectid = vtiger_osscosts.projectid\n\t\t\t\tLEFT JOIN vtiger_troubletickets ON vtiger_troubletickets.ticketid = vtiger_osscosts.ticketid\n\t\t\t\tLEFT JOIN vtiger_currency_info ON vtiger_currency_info.id = vtiger_osscosts.currency_id\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";
$query .= $this->getNonAdminAccessControlQuery('OSSCosts', $current_user);
$where_auto = " vtiger_crmentity.deleted=0";
if ($where != "") {
$query .= " where ({$where}) AND " . $where_auto;
} else {
$query .= " where " . $where_auto;
}
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例13: create_export_query
/** Function to export the contact records in CSV Format
* @param reference variable - where condition is passed when the query is executed
* Returns Export Contacts Query.
*/
function create_export_query($where)
{
global $log;
global $current_user;
$log->debug("Entering create_export_query(" . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("Contacts", "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT vtiger_contactdetails.salutation as 'Salutation',{$fields_list},case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name \n FROM vtiger_contactdetails\n inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid\n LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid=vtiger_users.id and vtiger_users.status='Active' \n LEFT JOIN vtiger_account on vtiger_contactdetails.accountid=vtiger_account.accountid\n\t\t\t\tleft join vtiger_contactaddress on vtiger_contactaddress.contactaddressid=vtiger_contactdetails.contactid\n\t\t\t\tleft join vtiger_contactsubdetails on vtiger_contactsubdetails.contactsubscriptionid=vtiger_contactdetails.contactid\n\t\t\t left join vtiger_contactscf on vtiger_contactscf.contactid=vtiger_contactdetails.contactid\n\t\t\t left join vtiger_customerdetails on vtiger_customerdetails.customerid=vtiger_contactdetails.contactid\n\t LEFT JOIN vtiger_groups\n \t ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_contactdetails vtiger_contactdetails2\n\t\t\t\t\tON vtiger_contactdetails2.contactid = vtiger_contactdetails.reportsto";
$where_auto = " vtiger_crmentity.deleted = 0 ";
if ($where != "") {
$query .= " WHERE ({$where}) AND " . $where_auto;
} else {
$query .= " WHERE " . $where_auto;
}
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
//we should add security check when the user has Private Access
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[4] == 3) {
//Added security check to get the permitted records only
$query = $query . " " . getListViewSecurityParameter("Contacts");
}
$log->info("Export Query Constructed Successfully");
$log->debug("Exiting create_export_query method ...");
return $query;
}
示例14: create_export_query
/**
* Create query to export the records.
*/
function create_export_query($where)
{
global $current_user;
include("include/utils/ExportUtils.php");
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery('Services', "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT $fields_list
FROM vtiger_crmentity INNER JOIN $this->table_name ON vtiger_crmentity.crmid=$this->table_name.$this->table_index";
if(!empty($this->customFieldTable)) {
$query .= " INNER JOIN ".$this->customFieldTable[0]." ON ".$this->customFieldTable[0].'.'.$this->customFieldTable[1] .
" = $this->table_name.$this->table_index";
}
$query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= " LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id AND vtiger_users.status='Active'";
$query .= $this->getNonAdminAccessControlQuery('Services',$current_user);
$where_auto = " vtiger_crmentity.deleted=0";
if($where != '') $query .= " WHERE ($where) AND $where_auto";
else $query .= " WHERE $where_auto";
return $query;
}
示例15: create_export_query
/** Function to export the vendors in CSV Format
* @param reference variable - where condition is passed when the query is executed
* Returns Export Vendors Query.
*/
function create_export_query($where)
{
global $log;
global $current_user;
$log->debug("Entering create_export_query(" . $where . ") method ...");
include "include/utils/ExportUtils.php";
//To get the Permitted fields query and the permitted fields list
$sql = getPermittedFieldsQuery("Vendors", "detail_view");
$fields_list = getFieldsListFromQuery($sql);
$query = "SELECT {$fields_list} FROM " . $this->entity_table . "\n INNER JOIN vtiger_vendor\n ON vtiger_crmentity.crmid = vtiger_vendor.vendorid\n LEFT JOIN vtiger_vendorcf\n ON vtiger_vendorcf.vendorid=vtiger_vendor.vendorid\n LEFT JOIN vtiger_seattachmentsrel\n ON vtiger_vendor.vendorid=vtiger_seattachmentsrel.crmid\n LEFT JOIN vtiger_attachments\n ON vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid\n LEFT JOIN vtiger_users\n ON vtiger_crmentity.smownerid = vtiger_users.id and vtiger_users.status='Active'\n ";
$where_auto = " vtiger_crmentity.deleted = 0 ";
if ($where != "") {
$query .= " WHERE ({$where}) AND " . $where_auto;
} else {
$query .= " WHERE " . $where_auto;
}
$log->debug("Exiting create_export_query method ...");
return $query;
}