id,'unit_price') == '0') {
$unitprice=$adb->query_result($list_result,$list_result_count,'unit_price');
if($_REQUEST['currencyid'] != null) {
$prod_prices = getPricesForProducts($_REQUEST['currencyid'], array($entity_id), $module);
$unitprice = $prod_prices[$entity_id];
}
} else {
$unit_price = '';
}
$slashes_temp_val = popup_from_html($field_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val,ENT_QUOTES,$default_charset);
$description = popup_from_html($adb->query_result($list_result,$list_result_count,'description'));
$slashes_temp_desc = decode_html(htmlspecialchars($description,ENT_QUOTES,$default_charset));
$slashes_desc = str_replace(array("\r","\n"),array('\r','\n'), $slashes_temp_desc);
$tmp_arr = array("entityid"=>$entity_id,"prodname"=>"".stripslashes(decode_html(nl2br($slashes_temp_val)))."","unitprice" => "$unitprice","taxstring"=>"$tax_str","rowid"=>"$row_id","desc"=>"$slashes_desc");
require_once('include/Zend/Json.php');
$prod_arr = Zend_Json::encode($tmp_arr);
$value = '';
}
elseif($popuptype == "inventory_pb")
{
$prod_id = $_REQUEST['productid'];
$flname = $_REQUEST['fldname'];
$listprice=getListPrice($prod_id,$entity_id);
$temp_val = popup_from_html($temp_val);
$value = ''.$temp_val.' ';
}
elseif($popuptype == "specific_account_address")
{
require_once('modules/Accounts/Accounts.php');
$acct_focus = new Accounts();
$acct_focus->retrieve_entity_info($entity_id,"Accounts");
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val,ENT_QUOTES,$default_charset);
$xyz=array('bill_street','bill_city','bill_code','bill_pobox','bill_country','bill_state','ship_street','ship_city','ship_code','ship_pobox','ship_country','ship_state');
for($i=0;$i<12;$i++){
if (getFieldVisibilityPermission($module, $current_user->id,$xyz[$i]) == '0'){
$acct_focus->column_fields[$xyz[$i]] = $acct_focus->column_fields[$xyz[$i]];
}
else
$acct_focus->column_fields[$xyz[$i]] = '';
}
$bill_street = str_replace(array("\r","\n"),array('\r','\n'), popup_decode_html($acct_focus->column_fields['bill_street']));
$ship_street = str_replace(array("\r","\n"),array('\r','\n'), popup_decode_html($acct_focus->column_fields['ship_street']));
$value = 'column_fields['bill_city']).'", "'.popup_decode_html($acct_focus->column_fields['ship_city']).'", "'.popup_decode_html($acct_focus->column_fields['bill_state']).'", "'.popup_decode_html($acct_focus->column_fields['ship_state']).'", "'.popup_decode_html($acct_focus->column_fields['bill_code']).'", "'.popup_decode_html($acct_focus->column_fields['ship_code']).'", "'.popup_decode_html($acct_focus->column_fields['bill_country']).'", "'.popup_decode_html($acct_focus->column_fields['ship_country']).'","'.popup_decode_html($acct_focus->column_fields['bill_pobox']).'", "'.popup_decode_html($acct_focus->column_fields['ship_pobox']).'");\'>'.$temp_val.' ';
}
elseif($popuptype == "specific_contact_account_address")
{
require_once('modules/Accounts/Accounts.php');
$acct_focus = new Accounts();
$acct_focus->retrieve_entity_info($entity_id,"Accounts");
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val,ENT_QUOTES,$default_charset);
$bill_street = str_replace(array("\r","\n"),array('\r','\n'), popup_decode_html($acct_focus->column_fields['bill_street']));
$ship_street = str_replace(array("\r","\n"),array('\r','\n'), popup_decode_html($acct_focus->column_fields['ship_street']));
$value = 'column_fields['bill_city']).'", "'.popup_decode_html($acct_focus->column_fields['ship_city']).'", "'.popup_decode_html($acct_focus->column_fields['bill_state']).'", "'.popup_decode_html($acct_focus->column_fields['ship_state']).'", "'.popup_decode_html($acct_focus->column_fields['bill_code']).'", "'.popup_decode_html($acct_focus->column_fields['ship_code']).'", "'.popup_decode_html($acct_focus->column_fields['bill_country']).'", "'.popup_decode_html($acct_focus->column_fields['ship_country']).'","'.popup_decode_html($acct_focus->column_fields['bill_pobox']).'", "'.popup_decode_html($acct_focus->column_fields['ship_pobox']).'");\'>'.$temp_val.' ';
}
elseif($popuptype == "specific_potential_account_address")
{
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val,ENT_QUOTES,$default_charset);
// For B2C support, Potential was enabled to be linked to Contacts also.
// Hence we need case handling for it.
$relatedid = $adb->query_result($list_result,$list_result_count,"related_to");
$relatedentity = getSalesEntityType($relatedid);
if($relatedentity == 'Accounts') {
require_once('modules/Accounts/Accounts.php');
$acct_focus = new Accounts();
$acct_focus->retrieve_entity_info($relatedid,"Accounts");
$account_name = getAccountName($relatedid);
$slashes_account_name = popup_from_html($account_name);
$slashes_account_name = htmlspecialchars($slashes_account_name,ENT_QUOTES,$default_charset);
$xyz=array('bill_street','bill_city','bill_code','bill_pobox','bill_country','bill_state','ship_street','ship_city','ship_code','ship_pobox','ship_country','ship_state');
for($i=0;$i<12;$i++){
if (getFieldVisibilityPermission('Accounts', $current_user->id,$xyz[$i]) == '0'){
$acct_focus->column_fields[$xyz[$i]] = $acct_focus->column_fields[$xyz[$i]];
}
else
$acct_focus->column_fields[$xyz[$i]] = '';
}
$bill_street = str_replace(array("\r","\n"),array('\r','\n'), popup_decode_html($acct_focus->column_fields['bill_street']));
$ship_street = str_replace(array("\r","\n"),array('\r','\n'), popup_decode_html($acct_focus->column_fields['ship_street']));
$value = 'column_fields['bill_city']).'", "'.popup_decode_html($acct_focus->column_fields['ship_city']).'", "'.popup_decode_html($acct_focus->column_fields['bill_state']).'", "'.popup_decode_html($acct_focus->column_fields['ship_state']).'", "'.popup_decode_html($acct_focus->column_fields['bill_code']).'", "'.popup_decode_html($acct_focus->column_fields['ship_code']).'", "'.popup_decode_html($acct_focus->column_fields['bill_country']).'", "'.popup_decode_html($acct_focus->column_fields['ship_country']).'","'.popup_decode_html($acct_focus->column_fields['bill_pobox']).'", "'.popup_decode_html($acct_focus->column_fields['ship_pobox']).'");\'>'.$temp_val.' ';
} else if($relatedentity == 'Contacts') {
require_once('modules/Contacts/Contacts.php');
$contact_name = getContactName($relatedid);
$slashes_contact_name = popup_from_html($contact_name);
$slashes_contact_name = htmlspecialchars($slashes_contact_name,ENT_QUOTES,$default_charset);
$value = ''.$temp_val.' ';
} else {
$value = $temp_val;
}
}
//added by rdhital/Raju for better emails
elseif($popuptype == "set_return_emails")
{
if ($module=='Accounts')
{
$name = $adb->query_result($list_result,$list_result_count,'accountname');
$accid =$adb->query_result($list_result,$list_result_count,'accountid');
if(CheckFieldPermission('email1',$module) == "true")
{
$emailaddress=$adb->query_result($list_result,$list_result_count,"email1");
$email_check = 1;
}
else
$email_check = 0;
if($emailaddress == '')
{
if(CheckFieldPermission('email2',$module) == 'true')
{
$emailaddress2=$adb->query_result($list_result,$list_result_count,"email2");
$email_check = 2;
}
else
{
if($email_check == 1)
$email_check = 4;
else
$email_check = 3;
}
}
$querystr="SELECT fieldid,fieldlabel,columnname FROM vtiger_field WHERE tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
$queryres = $adb->pquery($querystr, array(getTabid($module)));
//Change this index 0 - to get the vtiger_fieldid based on email1 or email2
$fieldid = $adb->query_result($queryres,0,'fieldid');
$slashes_name = popup_from_html($name);
$slashes_name = htmlspecialchars($slashes_name,ENT_QUOTES,$default_charset);
$value = ''.textlength_check($name).' ';
}elseif ($module=='Vendors')
{
$name = $adb->query_result($list_result,$list_result_count,'vendorname');
$venid =$adb->query_result($list_result,$list_result_count,'vendorid');
if(CheckFieldPermission('email',$module) == "true")
{
$emailaddress=$adb->query_result($list_result,$list_result_count,"email");
$email_check = 1;
}
else
$email_check = 0;
$querystr="SELECT fieldid,fieldlabel,columnname FROM vtiger_field WHERE tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
$queryres = $adb->pquery($querystr, array(getTabid($module)));
//Change this index 0 - to get the vtiger_fieldid based on email1 or email2
$fieldid = $adb->query_result($queryres,0,'fieldid');
$slashes_name = popup_from_html($name);
$slashes_name = htmlspecialchars($slashes_name,ENT_QUOTES,$default_charset);
$value = ''.textlength_check($name).' ';
}elseif ($module=='Contacts' || $module=='Leads')
{
$name=getFullNameFromQResult($list_result,$list_result_count,$module);
if(CheckFieldPermission('email',$module) == "true")
{
$emailaddress=$adb->query_result($list_result,$list_result_count,"email");
$email_check = 1;
}
else
$email_check = 0;
if($emailaddress == '')
{
if(CheckFieldPermission('yahooid',$module) == 'true')
{
$emailaddress2=$adb->query_result($list_result,$list_result_count,"yahooid");
$email_check = 2;
}
else{
if($email_check == 1)
$email_check = 4;
else
$email_check = 3;
}
}
$querystr="SELECT fieldid,fieldlabel,columnname FROM vtiger_field WHERE tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
$queryres = $adb->pquery($querystr, array(getTabid($module)));
//Change this index 0 - to get the vtiger_fieldid based on email or yahooid
$fieldid = $adb->query_result($queryres,0,'fieldid');
$slashes_name = popup_from_html($name);
$slashes_name = htmlspecialchars($slashes_name,ENT_QUOTES,$default_charset);
$value = ''.$name.' ';
}else
{
$firstname=$adb->query_result($list_result,$list_result_count,"first_name");
$lastname=$adb->query_result($list_result,$list_result_count,"last_name");
$name=$lastname.' '.$firstname;
$emailaddress=$adb->query_result($list_result,$list_result_count,"email1");
$slashes_name = popup_from_html($name);
$slashes_name = htmlspecialchars($slashes_name,ENT_QUOTES,$default_charset);
$email_check = 1;
$value = ''.textlength_check($name) .' ';
}
}
elseif($popuptype == "specific_vendor_address")
{
require_once('modules/Vendors/Vendors.php');
$acct_focus = new Vendors();
$acct_focus->retrieve_entity_info($entity_id,"Vendors");
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val,ENT_QUOTES,$default_charset);
$xyz=array('street','city','postalcode','pobox','country','state');
for($i=0;$i<6;$i++){
if (getFieldVisibilityPermission($module, $current_user->id,$xyz[$i]) == '0'){
$acct_focus->column_fields[$xyz[$i]] = $acct_focus->column_fields[$xyz[$i]];
}
else
$acct_focus->column_fields[$xyz[$i]] = '';
}
$bill_street = str_replace(array("\r","\n"),array('\r','\n'), popup_decode_html($acct_focus->column_fields['street']));
$value = 'column_fields['city']).'", "'.popup_decode_html($acct_focus->column_fields['state']).'", "'.popup_decode_html($acct_focus->column_fields['postalcode']).'", "'.popup_decode_html($acct_focus->column_fields['country']).'","'.popup_decode_html($acct_focus->column_fields['pobox']).'");\'>'.$temp_val.' ';
}
elseif($popuptype == "specific_campaign")
{
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val,ENT_QUOTES,$default_charset);
$value = ''.$temp_val.' ';
}
else
{
if($colname == "lastname")
$temp_val = getFullNameFromQResult($list_result,$list_result_count,$module);
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val,ENT_QUOTES,$default_charset);
$log->debug("Exiting getValue method ...");
if($_REQUEST['maintab'] == 'Calendar')
$value = ''.$temp_val.' ';
else
$value = ''.$temp_val.' ';
}
}
else
{
if(($module == "Leads" && $colname == "lastname") || ($module == "Contacts" && $colname == "lastname"))
{
$value = ''.$temp_val.' ';
}
elseif($module == "Calendar")
{
$actvity_type = $adb->query_result($list_result,$list_result_count,'activitytype');
$actvity_type = ($actvity_type != '') ? $actvity_type : $adb->query_result($list_result,$list_result_count,'type');
if($actvity_type == "Task")
{
$value = ''.$temp_val.' ';
}
else
{
$value = ''.$temp_val.' ';
}
}
elseif($module == "Vendors")
{
$value = ''.$temp_val.' ';
}
elseif($module == "PriceBooks")
{
$value = ''.$temp_val.' ';
}
elseif($module == "SalesOrder")
{
$value = ''.$temp_val.' ';
}
elseif($module == 'Emails')
{
$value = $temp_val;
}
else
{
$value = ''.$temp_val.' ';
}
}
}
elseif($fieldname == 'expectedroi' || $fieldname == 'actualroi' || $fieldname == 'actualcost' || $fieldname == 'budgetcost' || $fieldname == 'expectedrevenue')
{
$rate = $user_info['conv_rate'];
$value = convertFromDollar($temp_val,$rate);
}
elseif(($module == 'Invoice' || $module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder')
&& ($fieldname == 'hdnGrandTotal' || $fieldname == 'hdnSubTotal' || $fieldname == 'txtAdjustment'
|| $fieldname == 'hdnDiscountAmount' || $fieldname == 'hdnS_H_Amount'))
{
$currency_info = getInventoryCurrencyInfo($module, $entity_id);
$currency_id = $currency_info['currency_id'];
$currency_symbol = $currency_info['currency_symbol'];
$value = $currency_symbol.$temp_val;
}
else
{
$value = $temp_val;
}
}
// Mike Crowe Mod --------------------------------------------------------Make right justified and vtiger_currency value
if ( in_array($uitype,array(71,72,7,9,90)) )
{
$value = ''.$value.'';
}
$log->debug("Exiting getValue method ...");
return $value;
}
/** Function to get the list query for a module
* @param $module -- module name:: Type string
* @param $where -- where:: Type string
* @returns $query -- query:: Type query
*/
function getListQuery($module,$where='')
{
global $log;
$log->debug("Entering getListQuery(".$module.",".$where.") method ...");
global $current_user;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
$tab_id = getTabid($module);
switch($module)
{
Case "HelpDesk":
$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
vtiger_troubletickets.title, vtiger_troubletickets.status,
vtiger_troubletickets.priority, vtiger_troubletickets.parent_id,
vtiger_contactdetails.contactid, vtiger_contactdetails.firstname,
vtiger_contactdetails.lastname, vtiger_account.accountid,
vtiger_account.accountname, vtiger_ticketcf.*, vtiger_troubletickets.ticket_no
FROM vtiger_troubletickets
INNER JOIN vtiger_ticketcf
ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_contactdetails
ON vtiger_troubletickets.parent_id = vtiger_contactdetails.contactid
LEFT JOIN vtiger_account
ON vtiger_account.accountid = vtiger_troubletickets.parent_id
LEFT JOIN vtiger_users
ON vtiger_crmentity.smownerid = vtiger_users.id
LEFT JOIN vtiger_products
ON vtiger_products.productid = vtiger_troubletickets.product_id";
$query .= ' '.getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Accounts":
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
vtiger_account.accountname, vtiger_account.email1,
vtiger_account.email2, vtiger_account.website, vtiger_account.phone,
vtiger_accountbillads.bill_city,
vtiger_accountscf.*
FROM vtiger_account
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_account.accountid
INNER JOIN vtiger_accountbillads
ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid
INNER JOIN vtiger_accountshipads
ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid
INNER JOIN vtiger_accountscf
ON vtiger_account.accountid = vtiger_accountscf.accountid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid
LEFT JOIN vtiger_account vtiger_account2
ON vtiger_account.parentid = vtiger_account2.accountid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Potentials":
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
vtiger_account.accountname,
vtiger_potential.related_to, vtiger_potential.potentialname,
vtiger_potential.sales_stage, vtiger_potential.amount,
vtiger_potential.currency, vtiger_potential.closingdate,
vtiger_potential.typeofrevenue,
vtiger_potentialscf.*
FROM vtiger_potential
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_potential.potentialid
INNER JOIN vtiger_potentialscf
ON vtiger_potentialscf.potentialid = vtiger_potential.potentialid
LEFT JOIN vtiger_account
ON vtiger_potential.related_to = vtiger_account.accountid
LEFT JOIN vtiger_contactdetails
ON vtiger_potential.related_to = vtiger_contactdetails.contactid
LEFT JOIN vtiger_campaign
ON vtiger_campaign.campaignid = vtiger_potential.campaignid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Leads":
$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
vtiger_leaddetails.firstname, vtiger_leaddetails.lastname,
vtiger_leaddetails.company, vtiger_leadaddress.phone,
vtiger_leadsubdetails.website, vtiger_leaddetails.email,
vtiger_leadscf.*
FROM vtiger_leaddetails
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid
INNER JOIN vtiger_leadsubdetails
ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid
INNER JOIN vtiger_leadaddress
ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid
INNER JOIN vtiger_leadscf
ON vtiger_leaddetails.leadid = vtiger_leadscf.leadid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 AND vtiger_leaddetails.converted = 0 ".
$where;
break;
Case "Products":
$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.description, vtiger_products.*, vtiger_productcf.*
FROM vtiger_products
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_products.productid
INNER JOIN vtiger_productcf
ON vtiger_products.productid = vtiger_productcf.productid
LEFT JOIN vtiger_vendor
ON vtiger_vendor.vendorid = vtiger_products.vendor_id
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_products.handler";
if((isset($_REQUEST["from_dashboard"]) && $_REQUEST["from_dashboard"] == true) && (isset($_REQUEST["type"]) && $_REQUEST["type"] =="dbrd"))
$query .= " INNER JOIN vtiger_inventoryproductrel on vtiger_inventoryproductrel.productid = vtiger_products.productid";
$query .= " WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Documents":
$query = "SELECT case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name,vtiger_crmentity.crmid, vtiger_crmentity.modifiedtime,
vtiger_crmentity.smownerid,vtiger_attachmentsfolder.*,vtiger_notes.*
FROM vtiger_notes
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_notes.notesid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid
LEFT JOIN vtiger_attachmentsfolder
ON vtiger_notes.folderid = vtiger_attachmentsfolder.folderid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Contacts":
//Query modified to sort by assigned to
$query = "SELECT vtiger_contactdetails.firstname, vtiger_contactdetails.lastname,
vtiger_contactdetails.title, vtiger_contactdetails.accountid,
vtiger_contactdetails.email, vtiger_contactdetails.phone,
vtiger_crmentity.smownerid, vtiger_crmentity.crmid
FROM vtiger_contactdetails
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid
INNER JOIN vtiger_contactaddress
ON vtiger_contactaddress.contactaddressid = vtiger_contactdetails.contactid
INNER JOIN vtiger_contactsubdetails
ON vtiger_contactsubdetails.contactsubscriptionid = vtiger_contactdetails.contactid
INNER JOIN vtiger_contactscf
ON vtiger_contactscf.contactid = vtiger_contactdetails.contactid
LEFT JOIN vtiger_account
ON vtiger_account.accountid = vtiger_contactdetails.accountid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid
LEFT JOIN vtiger_contactdetails vtiger_contactdetails2
ON vtiger_contactdetails.reportsto = vtiger_contactdetails2.contactid
LEFT JOIN vtiger_customerdetails
ON vtiger_customerdetails.customerid = vtiger_contactdetails.contactid";
if((isset($_REQUEST["from_dashboard"]) && $_REQUEST["from_dashboard"] == true) &&
(isset($_REQUEST["type"]) && $_REQUEST["type"] =="dbrd")) {
$query .= " INNER JOIN vtiger_campaigncontrel on vtiger_campaigncontrel.contactid = ".
"vtiger_contactdetails.contactid";
}
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Calendar":
$query="SELECT vtiger_activity.activityid as act_id,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.setype,
vtiger_activity.*,
vtiger_contactdetails.lastname, vtiger_contactdetails.firstname,
vtiger_contactdetails.contactid,
vtiger_account.accountid, vtiger_account.accountname
FROM vtiger_activity
LEFT JOIN vtiger_activitycf
ON vtiger_activitycf.activityid = vtiger_activity.activityid
LEFT JOIN vtiger_cntactivityrel
ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid
LEFT JOIN vtiger_contactdetails
ON vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid
LEFT JOIN vtiger_seactivityrel
ON vtiger_seactivityrel.activityid = vtiger_activity.activityid
LEFT OUTER JOIN vtiger_activity_reminder
ON vtiger_activity_reminder.activity_id = vtiger_activity.activityid
LEFT JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_activity.activityid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT OUTER JOIN vtiger_account
ON vtiger_account.accountid = vtiger_contactdetails.accountid
LEFT OUTER JOIN vtiger_leaddetails
ON vtiger_leaddetails.leadid = vtiger_seactivityrel.crmid
LEFT OUTER JOIN vtiger_account vtiger_account2
ON vtiger_account2.accountid = vtiger_seactivityrel.crmid
LEFT OUTER JOIN vtiger_potential
ON vtiger_potential.potentialid = vtiger_seactivityrel.crmid
LEFT OUTER JOIN vtiger_troubletickets
ON vtiger_troubletickets.ticketid = vtiger_seactivityrel.crmid
LEFT OUTER JOIN vtiger_salesorder
ON vtiger_salesorder.salesorderid = vtiger_seactivityrel.crmid
LEFT OUTER JOIN vtiger_purchaseorder
ON vtiger_purchaseorder.purchaseorderid = vtiger_seactivityrel.crmid
LEFT OUTER JOIN vtiger_quotes
ON vtiger_quotes.quoteid = vtiger_seactivityrel.crmid
LEFT OUTER JOIN vtiger_invoice
ON vtiger_invoice.invoiceid = vtiger_seactivityrel.crmid
LEFT OUTER JOIN vtiger_campaign
ON vtiger_campaign.campaignid = vtiger_seactivityrel.crmid";
//added to fix #5135
if(isset($_REQUEST['from_homepage']) && ($_REQUEST['from_homepage'] ==
"upcoming_activities" || $_REQUEST['from_homepage'] == "pending_activities")) {
$query.=" LEFT OUTER JOIN vtiger_recurringevents
ON vtiger_recurringevents.activityid=vtiger_activity.activityid";
}
//end
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query.=" WHERE vtiger_crmentity.deleted = 0 AND activitytype != 'Emails' ".$where;
break;
Case "Emails":
$query = "SELECT DISTINCT vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
vtiger_activity.activityid, vtiger_activity.subject,
vtiger_activity.date_start,
vtiger_contactdetails.lastname, vtiger_contactdetails.firstname,
vtiger_contactdetails.contactid
FROM vtiger_activity
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_activity.activityid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid
LEFT JOIN vtiger_seactivityrel
ON vtiger_seactivityrel.activityid = vtiger_activity.activityid
LEFT JOIN vtiger_contactdetails
ON vtiger_contactdetails.contactid = vtiger_seactivityrel.crmid
LEFT JOIN vtiger_cntactivityrel
ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid
AND vtiger_cntactivityrel.contactid = vtiger_cntactivityrel.contactid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_salesmanactivityrel
ON vtiger_salesmanactivityrel.activityid = vtiger_activity.activityid
LEFT JOIN vtiger_emaildetails
ON vtiger_emaildetails.emailid = vtiger_activity.activityid
WHERE vtiger_activity.activitytype = 'Emails'";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "AND vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Faq":
$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.createdtime, vtiger_crmentity.modifiedtime,
vtiger_faq.*
FROM vtiger_faq
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_faq.id
LEFT JOIN vtiger_products
ON vtiger_faq.product_id = vtiger_products.productid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Vendors":
$query = "SELECT vtiger_crmentity.crmid, vtiger_vendor.*
FROM vtiger_vendor
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_vendor.vendorid
INNER JOIN vtiger_vendorcf
ON vtiger_vendor.vendorid = vtiger_vendorcf.vendorid
WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "PriceBooks":
$query = "SELECT vtiger_crmentity.crmid, vtiger_pricebook.*, vtiger_currency_info.currency_name
FROM vtiger_pricebook
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_pricebook.pricebookid
INNER JOIN vtiger_pricebookcf
ON vtiger_pricebook.pricebookid = vtiger_pricebookcf.pricebookid
LEFT JOIN vtiger_currency_info
ON vtiger_pricebook.currency_id = vtiger_currency_info.id
WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Quotes":
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.*,
vtiger_quotes.*,
vtiger_quotesbillads.*,
vtiger_quotesshipads.*,
vtiger_potential.potentialname,
vtiger_account.accountname,
vtiger_currency_info.currency_name
FROM vtiger_quotes
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_quotes.quoteid
INNER JOIN vtiger_quotesbillads
ON vtiger_quotes.quoteid = vtiger_quotesbillads.quotebilladdressid
INNER JOIN vtiger_quotesshipads
ON vtiger_quotes.quoteid = vtiger_quotesshipads.quoteshipaddressid
LEFT JOIN vtiger_quotescf
ON vtiger_quotes.quoteid = vtiger_quotescf.quoteid
LEFT JOIN vtiger_currency_info
ON vtiger_quotes.currency_id = vtiger_currency_info.id
LEFT OUTER JOIN vtiger_account
ON vtiger_account.accountid = vtiger_quotes.accountid
LEFT OUTER JOIN vtiger_potential
ON vtiger_potential.potentialid = vtiger_quotes.potentialid
LEFT JOIN vtiger_contactdetails
ON vtiger_contactdetails.contactid = vtiger_quotes.contactid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users as vtiger_usersQuotes
ON vtiger_usersQuotes.id = vtiger_quotes.inventorymanager";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "PurchaseOrder":
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.*,
vtiger_purchaseorder.*,
vtiger_pobillads.*,
vtiger_poshipads.*,
vtiger_vendor.vendorname,
vtiger_currency_info.currency_name
FROM vtiger_purchaseorder
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_purchaseorder.purchaseorderid
LEFT OUTER JOIN vtiger_vendor
ON vtiger_purchaseorder.vendorid = vtiger_vendor.vendorid
LEFT JOIN vtiger_contactdetails
ON vtiger_purchaseorder.contactid = vtiger_contactdetails.contactid
INNER JOIN vtiger_pobillads
ON vtiger_purchaseorder.purchaseorderid = vtiger_pobillads.pobilladdressid
INNER JOIN vtiger_poshipads
ON vtiger_purchaseorder.purchaseorderid = vtiger_poshipads.poshipaddressid
LEFT JOIN vtiger_purchaseordercf
ON vtiger_purchaseordercf.purchaseorderid = vtiger_purchaseorder.purchaseorderid
LEFT JOIN vtiger_currency_info
ON vtiger_purchaseorder.currency_id = vtiger_currency_info.id
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "SalesOrder":
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.*,
vtiger_salesorder.*,
vtiger_sobillads.*,
vtiger_soshipads.*,
vtiger_quotes.subject AS quotename,
vtiger_account.accountname,
vtiger_currency_info.currency_name
FROM vtiger_salesorder
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_salesorder.salesorderid
INNER JOIN vtiger_sobillads
ON vtiger_salesorder.salesorderid = vtiger_sobillads.sobilladdressid
INNER JOIN vtiger_soshipads
ON vtiger_salesorder.salesorderid = vtiger_soshipads.soshipaddressid
LEFT JOIN vtiger_salesordercf
ON vtiger_salesordercf.salesorderid = vtiger_salesorder.salesorderid
LEFT JOIN vtiger_currency_info
ON vtiger_salesorder.currency_id = vtiger_currency_info.id
LEFT OUTER JOIN vtiger_quotes
ON vtiger_quotes.quoteid = vtiger_salesorder.quoteid
LEFT OUTER JOIN vtiger_account
ON vtiger_account.accountid = vtiger_salesorder.accountid
LEFT JOIN vtiger_contactdetails
ON vtiger_salesorder.contactid = vtiger_contactdetails.contactid
LEFT JOIN vtiger_potential
ON vtiger_potential.potentialid = vtiger_salesorder.potentialid
LEFT JOIN vtiger_invoice_recurring_info
ON vtiger_invoice_recurring_info.salesorderid = vtiger_salesorder.salesorderid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Invoice":
//Query modified to sort by assigned to
//query modified -Code contribute by Geoff(http://forums.vtiger.com/viewtopic.php?t=3376)
$query = "SELECT vtiger_crmentity.*,
vtiger_invoice.*,
vtiger_invoicebillads.*,
vtiger_invoiceshipads.*,
vtiger_salesorder.subject AS salessubject,
vtiger_account.accountname,
vtiger_currency_info.currency_name
FROM vtiger_invoice
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_invoice.invoiceid
INNER JOIN vtiger_invoicebillads
ON vtiger_invoice.invoiceid = vtiger_invoicebillads.invoicebilladdressid
INNER JOIN vtiger_invoiceshipads
ON vtiger_invoice.invoiceid = vtiger_invoiceshipads.invoiceshipaddressid
LEFT JOIN vtiger_currency_info
ON vtiger_invoice.currency_id = vtiger_currency_info.id
LEFT OUTER JOIN vtiger_salesorder
ON vtiger_salesorder.salesorderid = vtiger_invoice.salesorderid
LEFT OUTER JOIN vtiger_account
ON vtiger_account.accountid = vtiger_invoice.accountid
LEFT JOIN vtiger_contactdetails
ON vtiger_contactdetails.contactid = vtiger_invoice.contactid
INNER JOIN vtiger_invoicecf
ON vtiger_invoice.invoiceid = vtiger_invoicecf.invoiceid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Campaigns":
//Query modified to sort by assigned to
//query modified -Code contribute by Geoff(http://forums.vtiger.com/viewtopic.php?t=3376)
$query = "SELECT vtiger_crmentity.*,
vtiger_campaign.*
FROM vtiger_campaign
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_campaign.campaignid
INNER JOIN vtiger_campaignscf
ON vtiger_campaign.campaignid = vtiger_campaignscf.campaignid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
LEFT JOIN vtiger_users
ON vtiger_users.id = vtiger_crmentity.smownerid
LEFT JOIN vtiger_products
ON vtiger_products.productid = vtiger_campaign.product_id";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ".$where;
break;
Case "Users":
$query = "SELECT id,user_name,first_name,last_name,email1,phone_mobile,phone_work,is_admin,status,
vtiger_user2role.roleid as roleid,vtiger_role.depth as depth
FROM vtiger_users
INNER JOIN vtiger_user2role ON vtiger_users.id = vtiger_user2role.userid
INNER JOIN vtiger_role ON vtiger_user2role.roleid = vtiger_role.roleid
WHERE deleted=0 ".$where ;
break;
default:
// vtlib customization: Include the module file
$focus = CRMEntity::getInstance($module);
$query = $focus->getListQuery($module, $where);
// END
}
if($module != 'Users') {
$query = listQueryNonAdminChange($query, $module);
}
$log->debug("Exiting getListQuery method ...");
return $query;
}
/**Function returns the list of records which an user is entiled to view
*Param $module - module name
*Returns a database query - type string
*/
function getReadEntityIds($module)
{
global $log;
$log->debug("Entering getReadEntityIds(".$module.") method ...");
global $current_user;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
$tab_id = getTabid($module);
if($module == "Leads") {
$query = "SELECT vtiger_crmentity.crmid
FROM vtiger_leaddetails
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0
AND vtiger_leaddetails.converted = 0 ";
}elseif($module == "Accounts") {
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.crmid
FROM vtiger_account
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_account.accountid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ";
}elseif ($module == "Potentials") {
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.crmid
FROM vtiger_potential
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_potential.potentialid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ";
}elseif($module == "Contacts") {
//Query modified to sort by assigned to
$query="SELECT vtiger_crmentity.crmid
FROM vtiger_contactdetails
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ";
}elseif($module == "Products") {
$query = "SELECT DISTINCT vtiger_crmentity.crmid
FROM vtiger_products
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_products.productid
LEFT JOIN vtiger_seproductsrel
ON vtiger_seproductsrel.productid = vtiger_products.productid
WHERE vtiger_crmentity.deleted = 0
AND (vtiger_seproductsrel.crmid IS NULL
OR vtiger_seproductsrel.crmid IN (".getReadEntityIds('Leads').")
OR vtiger_seproductsrel.crmid IN (".getReadEntityIds('Accounts').")
OR vtiger_seproductsrel.crmid IN (".getReadEntityIds('Potentials').")
OR vtiger_seproductsrel.crmid IN (".getReadEntityIds('Contacts').")) ";
}elseif($module == "PurchaseOrder") {
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.crmid
FROM vtiger_purchaseorder
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_purchaseorder.purchaseorderid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ";
}elseif($module == "SalesOrder") {
//Query modified to sort by assigned to
$query = "SELECT vtiger_crmentity.crmid
FROM vtiger_salesorder
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_salesorder.salesorderid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ";
}elseif($module == "Invoice") {
$query = "SELECT vtiger_crmentity.crmid
FROM vtiger_invoice
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_invoice.invoiceid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ";
}elseif($module == "Quotes") {
$query = "SELECT vtiger_crmentity.crmid
FROM vtiger_quotes
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_quotes.quoteid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ";
}elseif($module == "HelpDesk") {
$query = "SELECT vtiger_crmentity.crmid
FROM vtiger_troubletickets
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= getNonAdminAccessControlQuery($module,$current_user);
$query .= "WHERE vtiger_crmentity.deleted = 0 ";
}
$log->debug("Exiting getReadEntityIds method ...");
return $query;
}
/** Function to get alphabetical search links
*Param $module - module name
*Param $action - action
*Param $fieldname - vtiger_field name
*Param $query - query
*Param $type - search type
*Param $popuptype - popup type
*Param $recordid - record id
*Param $return_module - return module
*Param $append_url - url string to be appended
*Param $viewid - custom view id
*Param $groupid - group id
*Returns an string value
*/
function AlphabeticalSearch($module,$action,$fieldname,$query,$type,$popuptype='',$recordid='',$return_module='',$append_url='',$viewid='',$groupid='')
{
global $log;
$log->debug("Entering AlphabeticalSearch(".$module.",".$action.",".$fieldname.",".$query.",".$type.",".$popuptype.",".$recordid.",".$return_module.",".$append_url.",".$viewid.",".$groupid.") method ...");
if($type=='advanced')
$flag='&advanced=true';
if($popuptype != '')
$popuptypevalue = "&popuptype=".$popuptype;
if($recordid != '')
$returnvalue = '&recordid='.$recordid;
if($return_module != '')
$returnvalue .= '&return_module='.$return_module;
// vtlib Customization : For uitype 10 popup during paging
if($_REQUEST['form'] == 'vtlibPopupView') {
$returnvalue .= '&form=vtlibPopupView&forfield='.vtlib_purify($_REQUEST['forfield']).'&srcmodule='.vtlib_purify($_REQUEST['srcmodule']).'&forrecord='.vtlib_purify($_REQUEST['forrecord']);
}
// END
for($var='A',$i =1;$i<=26;$i++,$var++)
// Mike Crowe Mod --------------------------------------------------------added groupid to url
$list .= ' '.$var.' ';
$log->debug("Exiting AlphabeticalSearch method ...");
return $list;
}
/**Function to get parent name for a given parent id
*Param $module - module name
*Param $list_result- result set
*Param $rset - result set index
*Returns an string value
*/
function getRelatedToEntity($module,$list_result,$rset)
{
global $log;
$log->debug("Entering getRelatedToEntity(".$module.",".$list_result.",".$rset.") method ...");
global $adb;
$seid = $adb->query_result($list_result,$rset,"relatedto");
$action = "DetailView";
if(isset($seid) && $seid != '')
{
$parent_module = $parent_module = getSalesEntityType($seid);
if($parent_module == 'Accounts')
{
$numrows= $adb->num_rows($evt_result);
$parent_module = $adb->query_result($evt_result,0,'setype');
$parent_id = $adb->query_result($evt_result,0,'crmid');
if ($numrows>1){
$parent_module ='Multiple';
$parent_name=$app_strings['LBL_MULTIPLE'];
}
//Raju -- Ends
$parent_query = "SELECT accountname FROM vtiger_account WHERE accountid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result,0,"accountname");
}
if($parent_module == 'Leads')
{
$parent_query = "SELECT firstname,lastname FROM vtiger_leaddetails WHERE leadid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = getFullNameFromQResult($parent_result,0,"Leads");
}
if($parent_module == 'Potentials')
{
$parent_query = "SELECT potentialname FROM vtiger_potential WHERE potentialid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result,0,"potentialname");
}
if($parent_module == 'Products')
{
$parent_query = "SELECT productname FROM vtiger_products WHERE productid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result,0,"productname");
}
if($parent_module == 'PurchaseOrder')
{
$parent_query = "SELECT subject FROM vtiger_purchaseorder WHERE purchaseorderid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result,0,"subject");
}
if($parent_module == 'SalesOrder')
{
$parent_query = "SELECT subject FROM vtiger_salesorder WHERE salesorderid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result,0,"subject");
}
if($parent_module == 'Invoice')
{
$parent_query = "SELECT subject FROM vtiger_invoice WHERE invoiceid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result,0,"subject");
}
$parent_value = "".$parent_name." ";
}
else
{
$parent_value = '';
}
$log->debug("Exiting getRelatedToEntity method ...");
return $parent_value;
}
/**Function to get parent name for a given parent id
*Param $module - module name
*Param $list_result- result set
*Param $rset - result set index
*Returns an string value
*/
//used in home page listTop vtiger_files
function getRelatedTo($module,$list_result,$rset)
{
global $adb,$log,$app_strings;
$tabname = getParentTab();
if($module == "Documents")
{
$notesid = $adb->query_result($list_result,$rset,"notesid");
$action = "DetailView";
$evt_query="SELECT vtiger_senotesrel.crmid, vtiger_crmentity.setype
FROM vtiger_senotesrel
INNER JOIN vtiger_crmentity
ON vtiger_senotesrel.crmid = vtiger_crmentity.crmid
WHERE vtiger_senotesrel.notesid = ?";
$params = array($notesid);
}else if($module == "Products")
{
$productid = $adb->query_result($list_result,$rset,"productid");
$action = "DetailView";
$evt_query="SELECT vtiger_seproductsrel.crmid, vtiger_crmentity.setype
FROM vtiger_seproductsrel
INNER JOIN vtiger_crmentity
ON vtiger_seproductsrel.crmid = vtiger_crmentity.crmid
WHERE vtiger_seproductsrel.productid =?";
$params = array($productid);
}else
{
$activity_id = $adb->query_result($list_result,$rset,"activityid");
$action = "DetailView";
$evt_query="SELECT vtiger_seactivityrel.crmid, vtiger_crmentity.setype
FROM vtiger_seactivityrel
INNER JOIN vtiger_crmentity
ON vtiger_seactivityrel.crmid = vtiger_crmentity.crmid
WHERE vtiger_seactivityrel.activityid=?";
$params = array($activity_id);
if($module == 'HelpDesk')
{
$activity_id = $adb->query_result($list_result,$rset,"parent_id");
if($activity_id != '') {
$evt_query = "SELECT crmid, setype FROM vtiger_crmentity WHERE crmid=?";
$params = array($activity_id);
}
}
}
//added by raju to change the related to in emails inot multiple if email is for more than one contact
$evt_result = $adb->pquery($evt_query, $params);
$numrows= $adb->num_rows($evt_result);
$parent_module = $adb->query_result($evt_result,0,'setype');
$parent_id = $adb->query_result($evt_result,0,'crmid');
if ($numrows>1){
$parent_module ='Multiple';
$parent_name=$app_strings['LBL_MULTIPLE'];
}
//Raju -- Ends
if($module == 'HelpDesk' && ($parent_module == 'Accounts' || $parent_module == 'Contacts'))
{
global $theme;
$module_icon = ' ';
}
$action = "DetailView";
if($parent_module == 'Accounts')
{
$parent_query = "SELECT accountname FROM vtiger_account WHERE accountid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = textlength_check($adb->query_result($parent_result,0,"accountname"));
}
if($parent_module == 'Leads')
{
$parent_query = "SELECT firstname,lastname FROM vtiger_leaddetails WHERE leadid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = getFullNameFromQResult($parent_result,0,"Leads");
}
if($parent_module == 'Potentials')
{
$parent_query = "SELECT potentialname FROM vtiger_potential WHERE potentialid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = textlength_check($adb->query_result($parent_result,0,"potentialname"));
}
if($parent_module == 'Products')
{
$parent_query = "SELECT productname FROM vtiger_products WHERE productid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = $adb->query_result($parent_result,0,"productname");
}
if($parent_module == 'Quotes')
{
$parent_query = "SELECT subject FROM vtiger_quotes WHERE quoteid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = $adb->query_result($parent_result,0,"subject");
}
if($parent_module == 'PurchaseOrder')
{
$parent_query = "SELECT subject FROM vtiger_purchaseorder WHERE purchaseorderid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = $adb->query_result($parent_result,0,"subject");
}
if($parent_module == 'Invoice')
{
$parent_query = "SELECT subject FROM vtiger_invoice WHERE invoiceid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = $adb->query_result($parent_result,0,"subject");
}
if($parent_module == 'SalesOrder')
{
$parent_query = "SELECT subject FROM vtiger_salesorder WHERE salesorderid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = $adb->query_result($parent_result,0,"subject");
}
if($parent_module == 'Contacts' && ($module == 'Emails' || $module == 'HelpDesk'))
{
$parent_query = "SELECT firstname,lastname FROM vtiger_contactdetails WHERE contactid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = getFullNameFromQResult($parent_result,0,"Contacts");
}
if($parent_module == 'Vendors' && ($module == 'Emails'))
{
$parent_query = "SELECT vendorname FROM vtiger_vendor WHERE vendorid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = $adb->query_result($parent_result,0,"vendorname");
}
if($parent_module == 'HelpDesk')
{
$parent_query = "SELECT title FROM vtiger_troubletickets WHERE ticketid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = $adb->query_result($parent_result,0,"title");
//if(strlen($parent_name) > 25)
//{
$parent_name = textlength_check($parent_name);
//}
}
if($parent_module == 'Campaigns')
{
$parent_query = "SELECT campaignname FROM vtiger_campaign WHERE campaignid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = $adb->query_result($parent_result,0,"campaignname");
//if(strlen($parent_name) > 25)
//{
$parent_name = textlength_check($parent_name);
//}
}
//added by rdhital for better emails - Raju
if ($parent_module == 'Multiple')
{
$parent_value = $parent_name;
}
else
{
$parent_value = $module_icon."".textlength_check($parent_name)." ";
}
//code added by raju ends
$log->debug("Exiting getRelatedTo method ...");
return $parent_value;
}
/**Function to get the table headers for a listview
*Param $navigation_arrray - navigation values in array
*Param $url_qry - url string
*Param $module - module name
*Param $action- action file name
*Param $viewid - view id
*Returns an string value
*/
function getTableHeaderNavigation($navigation_array, $url_qry,$module='',$action_val='index',$viewid='')
{
global $log,$app_strings;
$log->debug("Entering getTableHeaderNavigation(".$navigation_array.",". $url_qry.",".$module.",".$action_val.",".$viewid.") method ...");
global $theme,$current_user;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
if($module == 'Documents') {
$output = '';
}
$tabname = getParentTab();
$url_string = '';
// vtlib Customization : For uitype 10 popup during paging
if($_REQUEST['form'] == 'vtlibPopupView') {
$url_string .= '&form=vtlibPopupView&forfield='.vtlib_purify($_REQUEST['forfield']).'&srcmodule='.vtlib_purify($_REQUEST['srcmodule']).'&forrecord='.vtlib_purify($_REQUEST['forrecord']);
}
// END
if($module == 'Calendar' && $action_val == 'index')
{
if($_REQUEST['view'] == ''){
if($current_user->activity_view == "This Year"){
$mysel = 'year';
}else if($current_user->activity_view == "This Month"){
$mysel = 'month';
}else if($current_user->activity_view == "This Week"){
$mysel = 'week';
}else{
$mysel = 'day';
}
}
$data_value=date('Y-m-d H:i:s');
preg_match('/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/',$data_value,$value);
$date_data = Array(
'day'=>$value[3],
'month'=>$value[2],
'year'=>$value[1],
'hour'=>$value[4],
'min'=>$value[5],
);
$tab_type = ($_REQUEST['subtab'] == '')?'event':vtlib_purify($_REQUEST['subtab']);
$url_string .= isset($_REQUEST['view'])?"&view=".vtlib_purify($_REQUEST['view']):"&view=".$mysel;
$url_string .= isset($_REQUEST['subtab'])?"&subtab=".vtlib_purify($_REQUEST['subtab']):'';
$url_string .= isset($_REQUEST['viewOption'])?"&viewOption=".vtlib_purify($_REQUEST['viewOption']):'&viewOption=listview';
$url_string .= isset($_REQUEST['day'])?"&day=".vtlib_purify($_REQUEST['day']):'&day='.$date_data['day'];
$url_string .= isset($_REQUEST['week'])?"&week=".vtlib_purify($_REQUEST['week']):'';
$url_string .= isset($_REQUEST['month'])?"&month=".vtlib_purify($_REQUEST['month']):'&month='.$date_data['month'];
$url_string .= isset($_REQUEST['year'])?"&year=".vtlib_purify($_REQUEST['year']):"&year=".$date_data['year'];
$url_string .= isset($_REQUEST['n_type'])?"&n_type=".vtlib_purify($_REQUEST['n_type']):'';
$url_string .= isset($_REQUEST['search_option'])?"&search_option=".vtlib_purify($_REQUEST['search_option']):'';
}
if($module == 'Calendar' && $action_val != 'index') //added for the All link from the homepage -- ticket 5211
$url_string .= isset($_REQUEST['from_homepage'])?"&from_homepage=".vtlib_purify($_REQUEST['from_homepage']):'';
if(($navigation_array['prev']) != 0)
{
if($module == 'Calendar' && $action_val == 'index')
{
//$output .= ' ';
$output .= ' ';
//$output .= ' ';
$output .= ' ';
}
else if($action_val == "FindDuplicate")
{
$output .= ' ';
$output .= ' ';
}elseif($action_val == 'UnifiedSearch'){
$output .= ' ';
$output .= ' ';
}
elseif($module == 'Documents')
{
$output .= ' ';
$output .= ' ';
}
else{
$output .= ' ';
$output .= ' ';
}
}
else
{
$output .= ' ';
$output .= ' ';
}
if($module == 'Calendar' && $action_val == 'index'){
$jsNavigate = "cal_navigation('$tab_type','$url_string','&start='+this.value);";
}else if($action_val == "FindDuplicate"){
$jsNavigate = "getDuplicateListViewEntries_js('$module','parenttab=$tabname&start='+this.value+'$url_string');";
}elseif($action_val == 'UnifiedSearch'){
$jsNavigate = "getUnifiedSearchEntries_js('$module','parenttab=$tabname&start='+this.value+'$url_string');";
}elseif($module == 'Documents'){
$jsNavigate = "getListViewEntries_js('$module','parenttab=$tabname&start='+this.value+'$url_string&folderid=$action_val');";
}else{
$jsNavigate = "getListViewEntries_js('$module','parenttab=$tabname&start='+this.value+'$url_string');";
}
if($module == 'Documents'){
$url = '&folderid='.$action_val;
}else{
$url = '';
}
$jsHandler = "return VT_disableFormSubmit(event);";
$output .= " ";
$output .= "";
$output .= $app_strings['LBL_LIST_OF'].' '.$navigation_array['verylast'].' ';
if(($navigation_array['next']) !=0)
{
if($module == 'Calendar' && $action_val == 'index')
{
//$output .= ' ';
$output .= ' ';
//$output .= ' ';
$output .= ' ';
}
else if($action_val == "FindDuplicate")
{
$output .= ' ';
$output .= ' ';
}elseif($action_val == 'UnifiedSearch'){
$output .= ' ';
$output .= ' ';
}
elseif($module == 'Documents')
{
$output .= ' ';
$output .= ' ';
}
else
{
$output .= ' ';
$output .= ' ';
}
}
else
{
$output .= ' ';
$output .= ' ';
}
$output .= ' ';
$log->debug("Exiting getTableHeaderNavigation method ...");
if($navigation_array['first']=='')
return;
else
return $output;
}
function getPopupCheckquery($current_module,$relmodule,$relmod_recordid)
{
global $log,$adb;
$log->debug("Entering getPopupCheckquery(".$current_module.",".$relmodule.",".$relmod_recordid.") method ...");
if($current_module == "Contacts")
{
if($relmodule == "Accounts" && $relmod_recordid != '')
$condition = "and vtiger_account.accountid= ".$relmod_recordid;
elseif($relmodule == "Potentials")
{
$query = "select contactid from vtiger_contpotentialrel where potentialid=?";
$result = $adb->pquery($query, array($relmod_recordid));
$contact_id = $adb->query_result($result,0,"contactid");
if($contact_id != '' && $contact_id != 0)
$condition = "and vtiger_contactdetails.contactid= ".$contact_id;
else
{
$query = "select related_to from vtiger_potential where potentialid=?";
$result = $adb->pquery($query, array($relmod_recordid));
$acc_id = $adb->query_result($result,0,"related_to");
if($acc_id != ''){
$condition = "and vtiger_contactdetails.accountid= ".$acc_id;
}
}
}
elseif($relmodule == "Quotes")
{
$query = "select accountid,contactid from vtiger_quotes where quoteid=?";
$result = $adb->pquery($query, array($relmod_recordid));
$contactid = $adb->query_result($result,0,"contactid");
if($contactid != '' && $contactid != 0)
$condition = "and vtiger_contactdetails.contactid= ".$contactid;
else
{
$account_id = $adb->query_result($result,0,"accountid");
if($account_id != '')
$condition = "and vtiger_contactdetails.accountid= ".$account_id;
}
}
elseif($relmodule == "PurchaseOrder")
{
$query = "select contactid from vtiger_purchaseorder where purchaseorderid=?";
$result = $adb->pquery($query, array($relmod_recordid));
$contact_id = $adb->query_result($result,0,"contactid");
if($contact_id != '')
$condition = "and vtiger_contactdetails.contactid= ".$contact_id;
else
$condition = "and vtiger_contactdetails.contactid= 0";
}
elseif($relmodule == "SalesOrder")
{
$query = "select accountid,contactid from vtiger_salesorder where salesorderid=?";
$result = $adb->pquery($query, array($relmod_recordid));
$contact_id = $adb->query_result($result,0,"contactid");
if($contact_id != 0 && $contact_id != '')
$condition = "and vtiger_contactdetails.contactid=".$contact_id;
else
{
$account_id = $adb->query_result($result,0,"accountid");
if($account_id != '')
$condition = "and vtiger_contactdetails.accountid= ".$account_id;
}
}
elseif($relmodule == "Invoice")
{
$query = "select accountid,contactid from vtiger_invoice where invoiceid=?";
$result = $adb->pquery($query, array($relmod_recordid));
$contact_id = $adb->query_result($result,0,"contactid");
if($contact_id != '' && $contact_id != 0)
$condition = " and vtiger_contactdetails.contactid=".$contact_id;
else
{
$account_id = $adb->query_result($result,0,"accountid");
if($account_id != '')
$condition = " and vtiger_contactdetails.accountid=".$account_id;
}
}
elseif($relmodule == "Campaigns")
{
$query = "select contactid from vtiger_campaigncontrel where campaignid =?";
$result = $adb->pquery($query, array($relmod_recordid));
$rows = $adb->num_rows($result);
if($rows != 0)
{
$j = 0;
$contactid_comma = "(";
for($k=0; $k < $rows; $k++)
{
$contactid = $adb->query_result($result,$k,'contactid');
$contactid_comma.=$contactid;
if($k < ($rows-1))
$contactid_comma.=', ';
}
$contactid_comma.= ")";
}
else
$contactid_comma = "(0)";
$condition = "and vtiger_contactdetails.contactid in ".$contactid_comma;
}
elseif($relmodule == "Products")
{
$query = "select crmid from vtiger_seproductsrel where productid=? and setype=?";
$result = $adb->pquery($query, array($relmod_recordid,"Contacts"));
$rows = $adb->num_rows($result);
if($rows != 0)
{
$j = 0;
$contactid_comma = "(";
for($k=0; $k < $rows; $k++)
{
$contactid = $adb->query_result($result,$k,'crmid');
$contactid_comma.=$contactid;
if($k < ($rows-1))
$contactid_comma.=', ';
}
$contactid_comma.= ")";
}
else
$contactid_comma = "(0)";
$condition = "and vtiger_contactdetails.contactid in ".$contactid_comma;
}
elseif($relmodule == "HelpDesk" || $relmodule == "Trouble Tickets")
{
$query = "select parent_id from vtiger_troubletickets where ticketid =?";
$result = $adb->pquery($query, array($relmod_recordid));
$parent_id = $adb->query_result($result,0,"parent_id");
if($parent_id != ""){
$crmquery = "select setype from vtiger_crmentity where crmid=?";
$parentmodule_id = $adb->pquery($crmquery, array($parent_id));
$parent_modname = $adb->query_result($parentmodule_id,0,"setype");
if($parent_modname == "Accounts")
$condition = "and vtiger_contactdetails.accountid= ".$parent_id;
if($parent_modname == "Contacts")
$condition = "and vtiger_contactdetails.contactid= ".$parent_id;
}
else
$condition = " and vtiger_contactdetails.contactid=0";
}
}
elseif($current_module == "Potentials")
{
if($relmodule == 'Accounts' || $relmodule == 'Contacts')
{
if($relmodule == 'Contacts') {
$pot_query = "select vtiger_crmentity.crmid,vtiger_contactdetails.contactid,vtiger_potential.potentialid from vtiger_potential inner join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_potential.related_to inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and vtiger_potential.related_to=?";
} else {
$pot_query = "select vtiger_crmentity.crmid,vtiger_account.accountid,vtiger_potential.potentialid from vtiger_potential inner join vtiger_account on vtiger_account.accountid=vtiger_potential.related_to inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid where vtiger_crmentity.deleted=0 and vtiger_potential.related_to=?";
}
$pot_result = $result = $adb->pquery($pot_query, array($relmod_recordid));
$rows = $adb->num_rows($pot_result);
$potids_comma = "";
if($rows != 0)
{
$j = 0;
$potids_comma .= "(";
for($k=0; $k < $rows; $k++)
{
$potential_ids = $adb->query_result($pot_result,$k,'potentialid');
$potids_comma.=$potential_ids;
if($k < ($rows-1))
$potids_comma.=',';
}
$potids_comma.= ")";
}
else
$potids_comma = "(0)";
$condition ="and vtiger_potential.potentialid in ".$potids_comma;
}
}
else if($current_module == "Products")
{
if($relmodule == 'Accounts')
{
$pro_query = "select productid from vtiger_seproductsrel where setype='Accounts' and crmid=?";
$pro_result = $result = $adb->pquery($pro_query, array($relmod_recordid));
$rows = $adb->num_rows($pro_result);
if($rows != 0)
{
$proids_comma = "(";
for($k=0; $k < $rows; $k++)
{
$product_ids = $adb->query_result($pro_result,$k,'productid');
$proids_comma .= $product_ids;
if($k < ($rows-1))
$proids_comma.=',';
}
$proids_comma.= ")";
}
else
$proids_comma = "(0)";
$condition ="and vtiger_products.productid in ".$proids_comma;
}
}
else if($current_module == 'Quotes')
{
if($relmodule == 'Accounts')
{
$quote_query = "select quoteid from vtiger_quotes where accountid=?";
$quote_result = $result = $adb->pquery($quote_query, array($relmod_recordid));
$rows = $adb->num_rows($quote_result);
if($rows != 0)
{
$j = 0;
$qtids_comma = "(";
for($k=0; $k < $rows; $k++)
{
$quote_ids = $adb->query_result($quote_result,$k,'quoteid');
$qtids_comma.=$quote_ids;
if($k < ($rows-1))
$qtids_comma.=',';
}
$qtids_comma.= ")";
}
else
$qtids_comma = "(0)";
$condition ="and vtiger_quotes.quoteid in ".$qtids_comma;
}
}
else if($current_module == 'SalesOrder')
{
if($relmodule == 'Accounts')
{
$SO_query = "select salesorderid from vtiger_salesorder where accountid=?";
$SO_result = $result = $adb->pquery($SO_query, array($relmod_recordid));
$rows = $adb->num_rows($SO_result);
if($rows != 0)
{
$SOids_comma = "(";
for($k=0; $k < $rows; $k++)
{
$SO_ids = $adb->query_result($SO_result,$k,'salesorderid');
$SOids_comma.=$SO_ids;
if($k < ($rows-1))
$SOids_comma.=',';
}
$SOids_comma.= ")";
}
else
$SOids_comma = "(0)";
$condition ="and vtiger_salesorder.salesorderid in ".$SOids_comma;
}
}
else
$condition = '';
$where = $condition;
$log->debug("Exiting getPopupCheckquery method ...");
return $where;
}
/**This function return the entity ids that need to be excluded in popup listview for a given record
Param $currentmodule - modulename of the entity to be selected
Param $returnmodule - modulename for which the entity is assingned
Param $recordid - the record id for which the entity is assigned
Return type string.
*/
function getRelCheckquery($currentmodule,$returnmodule,$recordid)
{
global $log,$adb;
$log->debug("Entering getRelCheckquery(".$currentmodule.",".$returnmodule.",".$recordid.") method ...");
$skip_id = Array();
$where_relquery = "";
$params = array();
if($currentmodule=="Contacts" && $returnmodule == "Potentials")
{
$reltable = 'vtiger_contpotentialrel';
$condition = 'WHERE potentialid = ?';
array_push($params, $recordid);
$field = $selectfield = 'contactid';
$table = 'vtiger_contactdetails';
}
elseif($currentmodule=="Contacts" && $returnmodule == "Vendors")
{
$reltable = 'vtiger_vendorcontactrel';
$condition = 'WHERE vendorid = ?';
array_push($params, $recordid);
$field = $selectfield = 'contactid';
$table = 'vtiger_contactdetails';
}
elseif($currentmodule=="Contacts" && $returnmodule == "Campaigns")
{
$reltable = 'vtiger_campaigncontrel';
$condition = 'WHERE campaignid = ?';
array_push($params, $recordid);
$field = $selectfield = 'contactid';
$table = 'vtiger_contactdetails';
}
elseif($currentmodule=="Contacts" && $returnmodule == "Calendar")
{
$reltable = 'vtiger_cntactivityrel';
$condition = 'WHERE activityid = ?';
array_push($params, $recordid);
$field = $selectfield = 'contactid';
$table = 'vtiger_contactdetails';
}
elseif($currentmodule=="Leads" && $returnmodule == "Campaigns")
{
$reltable = 'vtiger_campaignleadrel';
$condition = 'WHERE campaignid = ?';
array_push($params, $recordid);
$field = $selectfield = 'leadid';
$table = 'vtiger_leaddetails';
}
elseif($currentmodule=="Users" && $returnmodule == "Calendar")
{
$reltable = 'vtiger_salesmanactivityrel';
$condition = 'WHERE activityid = ?';
array_push($params, $recordid);
$selectfield = 'smid';
$field = 'id';
$table = 'vtiger_users';
}
elseif($currentmodule=="Campaigns" && $returnmodule == "Leads")
{
$reltable = 'vtiger_campaignleadrel';
$condition = 'WHERE leadid = ?';
array_push($params, $recordid);
$field = $selectfield = 'campaignid';
$table = 'vtiger_campaign';
}
elseif($currentmodule=="Campaigns" && $returnmodule == "Contacts")
{
$reltable = 'vtiger_campaigncontrel';
$condition = 'WHERE contactid = ?';
array_push($params, $recordid);
$field = $selectfield = 'campaignid';
$table = 'vtiger_campaign';
}
elseif($currentmodule == "Products" && ($returnmodule == "Potentials" || $returnmodule == "Accounts" || $returnmodule == "Contacts" || $returnmodule == "Leads"))
{
$reltable = 'vtiger_seproductsrel';
$condition = 'WHERE crmid = ? and setype = ?';
array_push($params, $recordid, $returnmodule);
$field = $selectfield ='productid';
$table = 'vtiger_products';
}
elseif(($currentmodule == "Leads" || $currentmodule == "Accounts" || $currentmodule == "Potentials" || $currentmodule == "Contacts") && $returnmodule == "Products")//added to fix the issues(ticket 4001,4002 and 4003)
{
$reltable = 'vtiger_seproductsrel';
$condition = 'WHERE productid = ? and setype = ?';
array_push($params, $recordid, $currentmodule);
$selectfield ='crmid';
if($currentmodule == "Leads")
{
$field = 'leadid';
$table = 'vtiger_leaddetails';
}
elseif($currentmodule == "Accounts")
{
$field = 'accountid';
$table = 'vtiger_account';
}
elseif($currentmodule == "Contacts")
{
$field = 'contactid';
$table = 'vtiger_contactdetails';
}
elseif($currentmodule == "Potentials")
{
$field = 'potentialid';
$table = 'vtiger_potential';
}
}
elseif($currentmodule == "Products" && $returnmodule =="Vendors")
{
$reltable = 'vtiger_products';
$condition = 'WHERE vendor_id = ?';
array_push($params, $recordid);
$field = $selectfield ='productid';
$table = 'vtiger_products';
}
elseif($currentmodule == "Documents")
{
$reltable = "vtiger_senotesrel";
$selectfield = "notesid";
$condition = "where crmid = ?";
array_push($params, $recordid);
$table = "vtiger_notes";
$field = "notesid";
}
//end
if($reltable != null) {
$query = "SELECT ".$selectfield." FROM ".$reltable." ".$condition;
} elseif($currentmodule != $returnmodule && $returnmodule!="") { // If none of the above relation matches, then the relation is assumed to be stored in vtiger_crmentityrel
$query = "SELECT relcrmid AS relatedid FROM vtiger_crmentityrel WHERE crmid = ? and module = ? and relmodule = ?
UNION SELECT crmid AS relatedid FROM vtiger_crmentityrel WHERE relcrmid = ? and relmodule = ? and module = ?";
array_push($params, $recordid, $returnmodule, $currentmodule, $recordid, $returnmodule, $currentmodule);
$focus_obj = CRMEntity::getInstance($currentmodule);
$field = $focus_obj->table_index;
$table = $focus_obj->table_name;
$selectfield = 'relatedid';
}
if($query !='')
{
$result = $adb->pquery($query, $params);
if($adb->num_rows($result)!=0)
{
for($k=0;$k < $adb->num_rows($result);$k++)
{
$skip_id[]=$adb->query_result($result,$k,$selectfield);
}
$skipids = implode(",", constructList($skip_id,'INTEGER'));
if (count($skipids) > 0) {
$where_relquery = "and ".$table.".".$field." not in (". $skipids .")";
}
}
}
$log->debug("Exiting getRelCheckquery method ...");
return $where_relquery;
}
/**This function stores the variables in session sent in list view url string.
*Param $lv_array - list view session array
*Param $noofrows - no of rows
*Param $max_ent - maximum entires
*Param $module - module name
*Param $related - related module
*Return type void.
*/
function setSessionVar($lv_array,$noofrows,$max_ent,$module='',$related='')
{
$start = '';
if($noofrows>=1)
{
$lv_array['start']=1;
$start = 1;
}
elseif($related!='' && $noofrows == 0)
{
$lv_array['start']=1;
$start = 1;
}
else
{
$lv_array['start']=0;
$start = 0;
}
if(isset($_REQUEST['start']) && $_REQUEST['start'] !='')
{
$lv_array['start']=ListViewSession::getRequestStartPage();
$start = ListViewSession::getRequestStartPage();
}elseif($_SESSION['rlvs'][$module][$related]['start'] != '')
{
if($related!='')
{
$lv_array['start']=$_SESSION['rlvs'][$module][$related]['start'];
$start = $_SESSION['rlvs'][$module][$related]['start'];
}
}
if(isset($_REQUEST['viewname']) && $_REQUEST['viewname'] !='')
$lv_array['viewname']=vtlib_purify($_REQUEST['viewname']);
if($related=='')
$_SESSION['lvs'][$_REQUEST['module']]=$lv_array;
else
$_SESSION['rlvs'][$module][$related] = $lv_array;
if ($start < ceil ($noofrows / $max_ent) && $start !='')
{
$start = ceil ($noofrows / $max_ent);
if($related=='')
$_SESSION['lvs'][$currentModule]['start'] = $start;
}
}
/**Function to get the table headers for related listview
*Param $navigation_arrray - navigation values in array
*Param $url_qry - url string
*Param $module - module name
*Param $action- action file name
*Param $viewid - view id
*Returns an string value
*/
function getRelatedTableHeaderNavigation($navigation_array, $url_qry,$module,$related_module,
$recordid) {
global $log, $app_strings, $adb;
$log->debug("Entering getTableHeaderNavigation(".$navigation_array.",". $url_qry.",".$module.",".$action_val.",".$viewid.") method ...");
global $theme;
$relatedTabId = getTabid($related_module);
$tabid = getTabid($module);
$relatedListResult = $adb->pquery('SELECT * FROM vtiger_relatedlists WHERE tabid=? AND
related_tabid=?', array($tabid,$relatedTabId));
if(empty($relatedListResult)) return;
$relatedListRow = $adb->fetch_row($relatedListResult);
$header = $relatedListRow['label'];
$actions = $relatedListRow['actions'];
$functionName = $relatedListRow['name'];
$urldata = "module=$module&action={$module}Ajax&file=DetailViewAjax&record={$recordid}&".
"ajxaction=LOADRELATEDLIST&header={$header}&relation_id={$relatedListRow['relation_id']}".
"&actions={$actions}&{$url_qry}";
$formattedHeader = str_replace(' ','',$header);
$target = 'tbl_'.$module.'_'.$formattedHeader;
$imagesuffix = $module.'_'.$formattedHeader;
$output = '';
if(($navigation_array['prev']) != 0) {
$output .= ' ';
$output .= ' ';
} else {
$output .= ' ';
$output .= ' ';
}
$jsHandler = "return VT_disableFormSubmit(event);";
$output .= " ";
$output .= "";
$computeCount = $_REQUEST['withCount'];
if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true
|| ((boolean) $computeCount) == true){
$output .= $app_strings['LBL_LIST_OF'].' '.$navigation_array['verylast'];
}else{
$output .= "
";
}
$output .= ' ';
if(($navigation_array['next']) !=0) {
$output .= ' ';
$output .= ' ';
} else {
$output .= ' ';
$output .= ' ';
}
$output .= ' ';
$log->debug("Exiting getTableHeaderNavigation method ...");
if($navigation_array['first']=='')
return;
else
return $output;
}
/** Function to get the Edit link details for ListView and RelatedListView
* @param string $module - module name
* @param int $entity_id - record id
* @param string $relatedlist - string "relatedlist" or may be empty. if empty means ListView else relatedlist
* @param string $returnset - may be empty in case of ListView. For relatedlists, return_module, return_action and return_id values will be passed like &return_module=Accounts&return_action=CallRelatedList&return_id=10
* return string $edit_link - url string which cotains the editlink details (module, action, record, etc.,) like index.php?module=Accounts&action=EditView&record=10
*/
function getListViewEditLink($module,$entity_id,$relatedlist,$returnset,$result,$count)
{
global $adb;
$return_action = "index";
$edit_link = "index.php?module=$module&action=EditView&record=$entity_id";
$tabname = getParentTab();
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
//This is relatedlist listview
if($relatedlist == 'relatedlist')
{
$edit_link .= $returnset;
}
else
{
if($module == 'Calendar')
{
$return_action = "ListView";
$actvity_type = $adb->query_result($result,$count,'type');
if($actvity_type == 'Task')
$edit_link .= '&activity_mode=Task';
else
$edit_link .= '&activity_mode=Events';
}
$edit_link .= "&return_module=$module&return_action=$return_action";
}
$edit_link .= "&parenttab=".$tabname.$url;
//Appending view name while editing from ListView
$edit_link .= "&return_viewname=".$_SESSION['lvs'][$module]["viewname"];
if($module == 'Emails')
$edit_link = 'javascript:;" onclick="OpenCompose(\''.$entity_id.'\',\'edit\');';
return $edit_link;
}
/** Function to get the Del link details for ListView and RelatedListView
* @param string $module - module name
* @param int $entity_id - record id
* @param string $relatedlist - string "relatedlist" or may be empty. if empty means ListView else relatedlist
* @param string $returnset - may be empty in case of ListView. For relatedlists, return_module, return_action and return_id values will be passed like &return_module=Accounts&return_action=CallRelatedList&return_id=10
* return string $del_link - url string which cotains the editlink details (module, action, record, etc.,) like index.php?module=Accounts&action=Delete&record=10
*/
function getListViewDeleteLink($module,$entity_id,$relatedlist,$returnset)
{
$tabname = getParentTab();
$current_module = vtlib_purify($_REQUEST['module']);
$viewname = $_SESSION['lvs'][$current_module]['viewname'];
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
if($module == "Calendar")
$return_action = "ListView";
else
$return_action = "index";
//This is added to avoid the del link in Product related list for the following modules
$avoid_del_links = Array("PurchaseOrder","SalesOrder","Quotes","Invoice");
if(($current_module == 'Products' || $current_module == 'Services') && in_array($module,$avoid_del_links))
{
return '';
}
$del_link = "index.php?module=$module&action=Delete&record=$entity_id";
//This is added for relatedlist listview
if($relatedlist == 'relatedlist')
{
$del_link .= $returnset;
}
else
{
$del_link .= "&return_module=$module&return_action=$return_action";
}
$del_link .= "&parenttab=".$tabname."&return_viewname=".$viewname.$url;
// vtlib customization: override default delete link for custom modules
$requestModule = vtlib_purify($_REQUEST['module']);
$requestRecord = vtlib_purify($_REQUEST['record']);
$requestAction = vtlib_purify($_REQUEST['action']);
$parenttab = vtlib_purify($_REQUEST['parenttab']);
$isCustomModule = vtlib_isCustomModule($requestModule);
if($requestAction==$requestModule."Ajax"){
$requestAction=vtlib_purify($_REQUEST['file']);
}
if($isCustomModule && !in_array($requestAction, Array('index','ListView'))) {
$del_link = "index.php?module=$requestModule&action=updateRelations&parentid=$requestRecord";
$del_link .= "&destination_module=$module&idlist=$entity_id&mode=delete&parenttab=$parenttab";
}
// END
return $del_link;
}
/* Function to get the Entity Id of a given Entity Name */
function getEntityId($module, $entityName) {
global $log, $adb;
$log->info("in getEntityId ".$entityName);
$query = "select fieldname,tablename,entityidfield from vtiger_entityname where modulename = ?";
$result = $adb->pquery($query, array($module));
$fieldsname = $adb->query_result($result,0,'fieldname');
$tablename = $adb->query_result($result,0,'tablename');
$entityidfield = $adb->query_result($result,0,'entityidfield');
if(!(strpos($fieldsname,',') === false)) {
$fieldlists = explode(',',$fieldsname);
$fieldsname = "concat(";
$fieldsname = $fieldsname.implode(",' ',",$fieldlists);
$fieldsname = $fieldsname.")";
}
if($entityName != '') {
$sql = "select $entityidfield from $tablename INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = $tablename.$entityidfield " .
" WHERE vtiger_crmentity.deleted = 0 and $fieldsname=?";
$result = $adb->pquery($sql, array($entityName));
if($adb->num_rows($result) > 0) {
$entityId = $adb->query_result($result,0,$entityidfield);
}
}
if(!empty($entityId))
return $entityId;
else
return 0;
}
/** function used to get the parent id for the given input parent name --Pavani **/
function getParentId($parent_name)
{
global $adb;
if($parent_name == '' || $parent_name == NULL)
$parent_id = 0;
//For now it have conditions only for accounts and contacts, if needed can add more
$relatedTo = explode(':',$parent_name);
$parent_module = $relatedTo[0]; $parent_module = trim($parent_module," ");
$parent_name = $relatedTo[3]; $parent_name = trim($parent_name," ");
$num_rows = 0;
if($parent_module == 'Contacts')
{
$query ="select crmid from vtiger_contactdetails, vtiger_crmentity WHERE concat(lastname,' ',firstname)=? and vtiger_crmentity.crmid =vtiger_contactdetails.contactid and vtiger_crmentity.deleted=0";
$result = $adb->pquery($query, array($parent_name));
$num_rows=$adb->num_rows($result);
}
else if($parent_module == 'Accounts')
{
$query = "select crmid from vtiger_account, vtiger_crmentity WHERE accountname=? and vtiger_crmentity.crmid =vtiger_account.accountid and vtiger_crmentity.deleted=0";
$result = $adb->pquery($query, array($parent_name));
$num_rows = $adb->num_rows($result);
}
else $num_rows=0;
if($num_rows == 0) $parent_id = 0;
else $parent_id = $adb->query_result($result,0,"crmid");
return $parent_id;
}
function decode_html($str)
{
global $default_charset;
// Direct Popup action or Ajax Popup action should be treated the same.
if($_REQUEST['action'] == 'Popup' || $_REQUEST['file'] == 'Popup')
return html_entity_decode($str);
else
return html_entity_decode($str,ENT_QUOTES,$default_charset);
}
/**
* Alternative decoding function which coverts irrespective of $_REQUEST values.
* Useful incase of Popup (Listview etc...) where if decode_html will not work as expected
*/
function decode_html_force($str) {
global $default_charset;
return html_entity_decode($str,ENT_QUOTES,$default_charset);
}
function popup_decode_html($str)
{
global $default_charset;
$slashes_str = popup_from_html($str);
$slashes_str = htmlspecialchars($slashes_str,ENT_QUOTES,$default_charset);
return decode_html(br2nl($slashes_str));
}
//function added to check the text length in the listview.
function textlength_check($field_val)
{
global $listview_max_textlength, $default_charset;
if($listview_max_textlength) {
$temp_val = preg_replace("/(<\/?)(\w+)([^>]*>)/i","",$field_val);
if(function_exists('mb_strlen')){
if(mb_strlen($default_charset) > $listview_max_textlength) {
$temp_val = mb_substr(preg_replace("/(<\/?)(\w+)([^>]*>)/i","",$field_val),0,
$listview_max_textlength,$default_charset).'...';
}
}elseif(strlen($field_val) > $listview_max_textlength) {
$temp_val = substr(preg_replace("/(<\/?)(\w+)([^>]*>)/i","",$field_val),0,$listview_max_textlength).'...';
}
} else {
$temp_val = $field_val;
}
return $temp_val;
}
/** Function to get permitted fields of current user of a particular module to find duplicate records --Pavani*/
function getMergeFields($module,$str){
global $adb,$current_user;
$tabid = getTabid($module);
if($str == "available_fields"){
$result = getFieldsResultForMerge($tabid);
}
else { //if($str == fileds_to_merge)
$sql="select * from vtiger_user2mergefields where tabid=? and userid=? and visible=1";
$result = $adb->pquery($sql, array($tabid,$current_user->id));
}
$num_rows=$adb->num_rows($result);
$user_profileid = fetchUserProfileId($current_user->id);
$permitted_list = getProfile2FieldPermissionList($module, $user_profileid);
$sql_def_org="select fieldid from vtiger_def_org_field where tabid=? and visible=0";
$result_def_org=$adb->pquery($sql_def_org,array($tabid));
$num_rows_org=$adb->num_rows($result_def_org);
$permitted_org_list = Array();
for($i=0; $i<$num_rows_org; $i++)
$permitted_org_list[$i] = $adb->query_result($result_def_org,$i,"fieldid");
require('user_privileges/user_privileges_'.$current_user->id.'.php');
for($i=0; $i<$num_rows;$i++)
{
$field_id = $adb->query_result($result,$i,"fieldid");
foreach($permitted_list as $field=>$data)
if($data[4] == $field_id and $data[1] == 0)
{
if($is_admin == 'true' || (in_array($field_id,$permitted_org_list)))
{
$field="".getTranslatedString($data[0],$module)." ";
$fields.=$field;
break;
}
}
}
return $fields;
}
/**
* this function accepts a modulename and a fieldname and returns the first related module for it
* it expects the uitype of the field to be 10
* @param string $module - the modulename
* @param string $fieldname - the field name
* @return string $data - the first related module
*/
function getFirstModule($module, $fieldname){
global $adb;
$sql = "select fieldid, uitype from vtiger_field where tabid=? and fieldname=?";
$result = $adb->pquery($sql, array(getTabid($module), $fieldname));
if($adb->num_rows($result)>0){
$uitype = $adb->query_result($result, 0, "uitype");
if($uitype == 10){
$fieldid = $adb->query_result($result, 0, "fieldid");
$sql = "select * from vtiger_fieldmodulerel where fieldid=?";
$result = $adb->pquery($sql, array($fieldid));
$count = $adb->num_rows($result);
if($count > 0){
$data = $adb->query_result($result, 0, "relmodule");
}
}
}
return $data;
}
function VT_getSimpleNavigationValues($start,$size,$total){
$prev = $start -1;
if($prev < 0){
$prev = 0;
}
if($total === null){
return array('start'=>$start,'first'=>$start,'current'=>$start,'end'=>$start,'end_val'=>$size,'allflag'=>'All',
'prev'=>$prev,'next'=>$start+1,'verylast'=>'last');
}
if(empty($total)){
$lastPage = 1;
}else{
$lastPage = ceil($total/$size);
}
$next = $start+1;
if($next > $lastPage){
$next = 0;
}
return array('start'=>$start,'first'=>$start,'current'=>$start,'end'=>$start,'end_val'=>$size,'allflag'=>'All',
'prev'=>$prev,'next'=>$next,'verylast'=>$lastPage);
}
/**Function to get the simplified table headers for a listview
*Param $navigation_arrray - navigation values in array
*Param $url_qry - url string
*Param $module - module name
*Param $action- action file name
*Param $viewid - view id
*Returns an string value
*/
function getTableHeaderSimpleNavigation($navigation_array, $url_qry,$module='',$action_val='index',$viewid=''){
global $log,$app_strings;
global $theme,$current_user;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
if($module == 'Documents') {
$output = '';
}
$tabname = getParentTab();
$url_string = '';
// vtlib Customization : For uitype 10 popup during paging
if($_REQUEST['form'] == 'vtlibPopupView') {
$url_string .= '&form=vtlibPopupView&forfield='.vtlib_purify($_REQUEST['forfield']).'&srcmodule='.vtlib_purify($_REQUEST['srcmodule']).'&forrecord='.vtlib_purify($_REQUEST['forrecord']);
}
// END
if($module == 'Calendar' && $action_val == 'index')
{
if($_REQUEST['view'] == ''){
if($current_user->activity_view == "This Year"){
$mysel = 'year';
}else if($current_user->activity_view == "This Month"){
$mysel = 'month';
}else if($current_user->activity_view == "This Week"){
$mysel = 'week';
}else{
$mysel = 'day';
}
}
$data_value=date('Y-m-d H:i:s');
preg_match('/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/',$data_value,$value);
$date_data = Array(
'day'=>$value[3],
'month'=>$value[2],
'year'=>$value[1],
'hour'=>$value[4],
'min'=>$value[5],
);
$tab_type = ($_REQUEST['subtab'] == '')?'event':vtlib_purify($_REQUEST['subtab']);
$url_string .= isset($_REQUEST['view'])?"&view=".vtlib_purify($_REQUEST['view']):"&view=".$mysel;
$url_string .= isset($_REQUEST['subtab'])?"&subtab=".vtlib_purify($_REQUEST['subtab']):'';
$url_string .= isset($_REQUEST['viewOption'])?"&viewOption=".vtlib_purify($_REQUEST['viewOption']):'&viewOption=listview';
$url_string .= isset($_REQUEST['day'])?"&day=".vtlib_purify($_REQUEST['day']):'&day='.$date_data['day'];
$url_string .= isset($_REQUEST['week'])?"&week=".vtlib_purify($_REQUEST['week']):'';
$url_string .= isset($_REQUEST['month'])?"&month=".vtlib_purify($_REQUEST['month']):'&month='.$date_data['month'];
$url_string .= isset($_REQUEST['year'])?"&year=".vtlib_purify($_REQUEST['year']):"&year=".$date_data['year'];
$url_string .= isset($_REQUEST['n_type'])?"&n_type=".vtlib_purify($_REQUEST['n_type']):'';
$url_string .= isset($_REQUEST['search_option'])?"&search_option=".vtlib_purify($_REQUEST['search_option']):'';
}
if($module == 'Calendar' && $action_val != 'index') //added for the All link from the homepage -- ticket 5211
$url_string .= isset($_REQUEST['from_homepage'])?"&from_homepage=".vtlib_purify($_REQUEST['from_homepage']):'';
if(($navigation_array['prev']) != 0){
if($module == 'Calendar' && $action_val == 'index'){
$output .= ' ';
$output .= ' ';
}else if($action_val == "FindDuplicate"){
$output .= ' ';
$output .= ' ';
}elseif($action_val == 'UnifiedSearch'){
$output .= ' ';
$output .= ' ';
}elseif($module == 'Documents'){
$output .= ' ';
$output .= ' ';
}else{
$output .= ' ';
$output .= ' ';
}
}else{
$output .= ' ';
$output .= ' ';
}
if($module == 'Calendar' && $action_val == 'index'){
$jsNavigate = "cal_navigation('$tab_type','$url_string','&start='+this.value);";
}else if($action_val == "FindDuplicate"){
$jsNavigate = "getDuplicateListViewEntries_js('$module','parenttab=$tabname&start='+this.value+'$url_string');";
}elseif($action_val == 'UnifiedSearch'){
$jsNavigate = "getUnifiedSearchEntries_js('$module','parenttab=$tabname&start='+this.value+'$url_string');";
}elseif($module == 'Documents'){
$jsNavigate = "getListViewEntries_js('$module','parenttab=$tabname&start='+this.value+'$url_string&folderid=$action_val');";
}else{
$jsNavigate = "getListViewEntries_js('$module','parenttab=$tabname&start='+this.value+'$url_string');";
}
if($module == 'Documents' && $action_val != 'UnifiedSearch'){
$url = '&folderid='.$action_val;
}else{
$url = '';
}
$jsHandler = "return VT_disableFormSubmit(event);";
$output .= " ";
$output .= "";
if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){
$output .= $app_strings['LBL_LIST_OF'].' '.$navigation_array['verylast'];
}else{
$output .= "
";
}
$output .=' ';
if(($navigation_array['next']) !=0){
if($module == 'Calendar' && $action_val == 'index'){
$output .= ' ';
$output .= ' ';
}else if($action_val == "FindDuplicate"){
$output .= ' ';
$output .= ' ';
}elseif($action_val == 'UnifiedSearch'){
$output .= ' ';
$output .= ' ';
}elseif($module == 'Documents'){
$output .= ' ';
$output .= ' ';
}else{
$output .= ' ';
$output .= ' ';
}
}else{
$output .= ' ';
$output .= ' ';
}
$output .= ' ';
if($navigation_array['first']=='')
return;
else
return $output;
}
function getRecordRangeMessage($listResult, $limitStartRecord,$totalRows='') {
global $adb, $app_strings;
$numRows = $adb->num_rows($listResult);
$recordListRangeMsg = '';
if ($numRows > 0) {
$recordListRangeMsg = $app_strings['LBL_SHOWING'].' '.$app_strings['LBL_RECORDS'].
' '.($limitStartRecord+1).' - '.($limitStartRecord+$numRows);
if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){
$recordListRangeMsg .= ' '.$app_strings['LBL_LIST_OF']." $totalRows";
}
}
return $recordListRangeMsg;
}
function listQueryNonAdminChange($query, $module, $scope='') {
$instance = CRMEntity::getInstance($module);
return $instance->listQueryNonAdminChange($query, $scope);
}
?>