vtiger: Reports on Custom Modules do not work

1824 ワード

レポートをクリックしてエラー
Report generation failed! Not unique table/alias: 'vtiger_crmentityRelmodulename'
CRMEntity.phpのコードセグメント
if($adb->num_rows($ui10_modules_query)>0){
	$query.= " left join vtiger_crmentity as vtiger_crmentityRel$module on vtiger_crmentityRel$module.crmid = $tab_name.$field_name and vtiger_crmentityRel$module.deleted=0";
	for($j=0;$j<$adb->num_rows($ui10_modules_query);$j++){
		$rel_mod = $adb->query_result($ui10_modules_query,$j,'relmodule');
		$rel_obj = CRMEntity::getInstance($rel_mod);
		vtlib_setup_modulevars($rel_mod, $rel_obj);
		
		$rel_tab_name = $rel_obj->table_name;
		$rel_tab_index = $rel_obj->table_index;
		$query.= " left join $rel_tab_name as ".$rel_tab_name."Rel$module on ".$rel_tab_name."Rel$module.$rel_tab_index = vtiger_crmentityRel$module.crmid";
	}
} 

次のように変更
if($adb->num_rows($ui10_modules_query)>0){ 
   $query.= " left join vtiger_crmentity as vtiger_crmentityRel$secmodule$i on vtiger_crmentityRel$secmodule$i.crmid = $tab_name.$field_name and vtiger_crmentityRel$secmodule$i.deleted=0"; 
   for($j=0;$j<$adb->num_rows($ui10_modules_query);$j++){ 
	  $rel_mod = $adb->query_result($ui10_modules_query,$j,'relmodule'); 
	  $rel_obj = CRMEntity::getInstance($rel_mod); 
	  vtlib_setup_modulevars($rel_mod, $rel_obj); 
	  $rel_tab_name = $rel_obj->table_name; 
	  $rel_tab_index = $rel_obj->table_index; 
	  $query.= " left join $rel_tab_name as ".$rel_tab_name."Rel$secmodule on ".$rel_tab_name."Rel$secmodule.$rel_tab_index = vtiger_crmentityRel$secmodule$i.crmid"; 
   } 
}