[Vtigercrm-commits] [vtiger development] #6197: uitype 10 reports linked by fieldname instead of columnname
vtiger development
vtiger-tickets at trac.vtiger.com
Fri Jul 24 14:29:08 EDT 2009
#6197: uitype 10 reports linked by fieldname instead of columnname
------------------------+---------------------------------------------------
Reporter: R.Cohen | Owner: developer
Type: defect | Status: new
Priority: unassigned | Milestone: 5.1.1
Component: vtigercrm | Version: 5.1.0
Keywords: |
------------------------+---------------------------------------------------
CRMEntity.php line 1882
{{{
$query.= " left join vtiger_crmentity as vtiger_crmentityRel$module on
vtiger_crmentityRel$module.crmid = $tab_name.$field_name and
vtiger_crmentityRel$module.deleted=0";
}}}
Notice the condition uses tab_name.'''$field_name'''
Should be using the column name. Code segment should look like:
{{{
$fields_query = $adb->pquery("SELECT
vtiger_field.columnname,vtiger_field.fieldname,vtiger_field.tablename,vtiger_field.fieldid
from vtiger_field INNER JOIN vtiger_tab on vtiger_tab.name = ? WHERE
vtiger_tab.tabid=vtiger_field.tabid AND vtiger_field.uitype IN (10) and
vtiger_field.presence in (0,2)",array($module));
if($adb->num_rows($fields_query)>0){
for($i=0;$i<$adb->num_rows($fields_query);$i++){
$field_name =
$adb->query_result($fields_query,$i,'fieldname');
$column_name =
$adb->query_result($fields_query,$i,'columnname');
$field_id =
$adb->query_result($fields_query,$i,'fieldid');
$tab_name =
$adb->query_result($fields_query,$i,'tablename');
$ui10_modules_query = $adb->pquery("SELECT
relmodule FROM vtiger_fieldmodulerel WHERE fieldid=?",array($field_id));
if($adb->num_rows($ui10_modules_query)>0){
$query.= " left join vtiger_crmentity as
vtiger_crmentityRel$module$i on vtiger_crmentityRel$module$i.crmid =
$tab_name.$column_name and vtiger_crmentityRel$module$i.deleted=0";
}}}
Adding the columnname to the query and then using it in the join instead
of fieldname.
--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/6197>
vtiger development <http://trac.vtiger.com/>
vtigerCRM
More information about the vtigercrm-commits
mailing list