晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/akaindir/public_html/crm/include/utils/ |
Upload File : |
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
/** function used to get the permitted blocks
* @param string $module - module name
* @param string $disp_view - view name, this may be create_view, edit_view or detail_view
* @return string $blockid_list - list of block ids within the paranthesis with comma seperated
*/
function getPermittedBlocks($module, $disp_view)
{
global $adb, $log;
$log->debug("Entering into the function getPermittedBlocks($module, $disp_view)");
$tabid = getTabid($module);
$block_detail = Array();
$query="select blockid,blocklabel,show_title from vtiger_blocks where tabid=? and $disp_view=0 and visible = 0 order by sequence";
$result = $adb->pquery($query, array($tabid));
$noofrows = $adb->num_rows($result);
$blockid_list ='(';
for($i=0; $i<$noofrows; $i++)
{
$blockid = $adb->query_result($result,$i,"blockid");
if($i != 0)
$blockid_list .= ', ';
$blockid_list .= $blockid;
$block_label[$blockid] = $adb->query_result($result,$i,"blocklabel");
}
$blockid_list .= ')';
$log->debug("Exit from the function getPermittedBlocks($module, $disp_view). Return value = $blockid_list");
return $blockid_list;
}
/** function used to get the query which will list the permitted fields
* @param string $module - module name
* @param string $disp_view - view name, this may be create_view, edit_view or detail_view
* @return string $sql - query to get the list of fields which are permitted to the current user
*/
function getPermittedFieldsQuery($module, $disp_view)
{
global $adb, $log;
$log->debug("Entering into the function getPermittedFieldsQuery($module, $disp_view)");
global $current_user;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
//To get the permitted blocks
$blockid_list = getPermittedBlocks($module, $disp_view);
$tabid = getTabid($module);
if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0 || $module == "Users")
{
$sql = "SELECT vtiger_field.columnname, vtiger_field.fieldlabel, vtiger_field.tablename FROM vtiger_field WHERE vtiger_field.tabid=".$tabid." AND vtiger_field.block IN $blockid_list AND vtiger_field.displaytype IN (1,2,4,5) and vtiger_field.presence in (0,2) ORDER BY block,sequence";
}
else
{
$profileList = getCurrentUserProfileList();
$sql = "SELECT vtiger_field.columnname, vtiger_field.fieldlabel, vtiger_field.tablename FROM vtiger_field INNER JOIN vtiger_profile2field ON vtiger_profile2field.fieldid=vtiger_field.fieldid INNER JOIN vtiger_def_org_field ON vtiger_def_org_field.fieldid=vtiger_field.fieldid WHERE vtiger_field.tabid=".$tabid." AND vtiger_field.block IN ".$blockid_list." AND vtiger_field.displaytype IN (1,2,4,5) AND vtiger_profile2field.visible=0 AND vtiger_def_org_field.visible=0 AND vtiger_profile2field.profileid IN (". implode(",", $profileList) .") and vtiger_field.presence in (0,2) GROUP BY vtiger_field.fieldid ORDER BY block,sequence";
}
$log->debug("Exit from the function getPermittedFieldsQuery($module, $disp_view). Return value = $sql");
return $sql;
}
/** function used to get the list of fields from the input query as a comma seperated string
* @param string $query - field table query which contains the list of fields
* @return string $fields - list of fields as a comma seperated string
*/
function getFieldsListFromQuery($query)
{
global $adb, $log;
$log->debug("Entering into the function getFieldsListFromQuery($query)");
$result = $adb->query($query);
$num_rows = $adb->num_rows($result);
for($i=0; $i < $num_rows;$i++)
{
$columnName = $adb->query_result($result,$i,"columnname");
$fieldlabel = $adb->query_result($result,$i,"fieldlabel");
$tablename = $adb->query_result($result,$i,"tablename");
//HANDLE HERE - Mismatch fieldname-tablename in field table, in future we have to avoid these if elses
if($columnName == 'smownerid')//for all assigned to user name
{
$fields .= "case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as '".$fieldlabel."',";
}
elseif($tablename == 'vtiger_account' && $columnName == 'parentid')//Account - Member Of
{
$fields .= "vtiger_account2.accountname as '".$fieldlabel."',";
}
elseif($tablename == 'vtiger_contactdetails' && $columnName == 'accountid')//Contact - Account Name
{
$fields .= "vtiger_account.accountname as '".$fieldlabel."',";
}
elseif($tablename == 'vtiger_contactdetails' && $columnName == 'reportsto')//Contact - Reports To
{
$fields .= " concat(vtiger_contactdetails2.lastname,' ',vtiger_contactdetails2.firstname) as 'Reports To Contact',";
}
elseif($tablename == 'vtiger_potential' && $columnName == 'related_to')//Potential - Related to (changed for B2C model support)
{
$fields .= "vtiger_potential.related_to as '".$fieldlabel."',";
}
elseif($tablename == 'vtiger_potential' && $columnName == 'campaignid')//Potential - Campaign Source
{
$fields .= "vtiger_campaign.campaignname as '".$fieldlabel."',";
}
elseif($tablename == 'vtiger_seproductsrel' && $columnName == 'crmid')//Product - Related To
{
$fields .= "case vtiger_crmentityRelatedTo.setype
when 'Leads' then concat('Leads :::: ',vtiger_ProductRelatedToLead.lastname,' ',vtiger_ProductRelatedToLead.firstname)
when 'Accounts' then concat('Accounts :::: ',vtiger_ProductRelatedToAccount.accountname)
when 'Potentials' then concat('Potentials :::: ',vtiger_ProductRelatedToPotential.potentialname)
End as 'Related To',";
}
elseif($tablename == 'vtiger_products' && $columnName == 'contactid')//Product - Contact
{
$fields .= " concat(vtiger_contactdetails.lastname,' ',vtiger_contactdetails.firstname) as 'Contact Name',";
}
elseif($tablename == 'vtiger_products' && $columnName == 'vendor_id')//Product - Vendor Name
{
$fields .= "vtiger_vendor.vendorname as '".$fieldlabel."',";
}
elseif($tablename == 'vtiger_producttaxrel' && $columnName == 'taxclass')//avoid product - taxclass
{
$fields .= "";
}
elseif($tablename == 'vtiger_attachments' && $columnName == 'name')//Emails filename
{
$fields .= $tablename.".name as '".$fieldlabel."',";
}
//By Pavani...Handling mismatch field and table name for trouble tickets
elseif($tablename == 'vtiger_troubletickets' && $columnName == 'product_id')//Ticket - Product
{
$fields .= "vtiger_products.productname as '".$fieldlabel."',";
}
elseif($tablename == 'vtiger_notes' && ($columnName == 'filename' || $columnName == 'filetype' || $columnName == 'filesize' || $columnName == 'filelocationtype' || $columnName == 'filestatus' || $columnName == 'filedownloadcount' ||$columnName == 'folderid')){
continue;
}
elseif(($tablename == 'vtiger_invoice' || $tablename == 'vtiger_quotes' || $tablename == 'vtiger_salesorder')&& $columnName == 'accountid') {
$fields .= 'concat("Accounts::::",vtiger_account.accountname) as "'.$fieldlabel.'",';
}
elseif(($tablename == 'vtiger_invoice' || $tablename == 'vtiger_quotes' || $tablename == 'vtiger_salesorder' || $tablename == 'vtiger_purchaseorder') && $columnName == 'contactid') {
$fields .= 'concat("Contacts::::",vtiger_contactdetails.lastname," ",vtiger_contactdetails.firstname) as "'.$fieldlabel.'",';
}
elseif($tablename == 'vtiger_invoice' && $columnName == 'salesorderid') {
$fields .= 'concat("SalesOrder::::",vtiger_salesorder.subject) as "'.$fieldlabel.'",';
}
elseif(($tablename == 'vtiger_quotes' || $tablename == 'vtiger_salesorder') && $columnName == 'potentialid') {
$fields .= 'concat("Potentials::::",vtiger_potential.potentialname) as "'.$fieldlabel.'",';
}
elseif($tablename == 'vtiger_quotes' && $columnName == 'inventorymanager') {
$userNameSql = getSqlForNameInDisplayFormat(array('first_name'=>'vtiger_inventoryManager.first_name', 'last_name' => 'vtiger_inventoryManager.last_name'), 'Users');
$fields .= $userNameSql. ' as "'.$fieldlabel.'",';
}
elseif($tablename == 'vtiger_salesorder' && $columnName == 'quoteid') {
$fields .= 'concat("Quotes::::",vtiger_quotes.subject) as "'.$fieldlabel.'",';
}
elseif($tablename == 'vtiger_purchaseorder' && $columnName == 'vendorid') {
$fields .= 'concat("Vendors::::",vtiger_vendor.vendorname) as "'.$fieldlabel.'",';
}
else
{
$fields .= $tablename.".".$columnName. " as '" .$fieldlabel."',";
}
}
$fields = trim($fields,",");
$log->debug("Exit from the function getFieldsListFromQuery($query). Return value = $fields");
return $fields;
}
?>