0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.133.153.224


Current Path : /proc/thread-self/root/var/www/html/rcub/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/rcub/src/getAutoCompleteFromFrameWork.php

<?php

function getAutoCompleteFromFrameWork($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
 
$value=trim($aobj_context->mobj_data["value"]);
$ref_search_value=$aobj_context->mobj_data["ref_search_value"];
$base_module_id=$aobj_context->mobj_data["base_module_id"];
$system_name=$aobj_context->mobj_data["system_name"];
$search_ref_module_db_field=$aobj_context->mobj_data["search_ref_module_db_field"];
$ref_search_value=str_ireplace("~"," ",$ref_search_value);
$module_id=$aobj_context->mobj_data["module_id"];
$ref_mofule_code_active_field=$aobj_context->mobj_data["ref_mofule_code_active_field"];
$filter_cond="";
$active_cond="";
if($search_ref_module_db_field!='0' )
{
$filter_cond=" and {$search_ref_module_db_field} = '{$ref_search_value}' ";
}
if(!empty($ref_mofule_code_active_field))
{
$active_cond=" and {$ref_mofule_code_active_field}='yes'";
} 
 
$select_meta_data="select * from module_meta_columns where module_id={$module_id}";
 $lobj_select_meta_data = $aobj_context->mobj_db->GetRow($select_meta_data); 
 $table_name=$lobj_select_meta_data[table_name];
 $field_id1=$lobj_select_meta_data[field_id1];
 $field_id2=$lobj_select_meta_data[field_id2];
 
	$field_id1_val=$field_id1;
	if(!empty($field_id2))
	$field_id1_val=" concat({$field_id1},' - ',{$field_id2})";
	
	$field_id2_val=$field_id2;
	if(!empty($field_id1))
	$field_id2_val=" concat({$field_id2},' - ', {$field_id1})";
	
	
	$qry="select internal_code,{$field_id1_val} as name from 
				 {$table_name} where 
				 {$field_id1} like '{$value}%'
				  {$filter_cond} {$active_cond} ";
	if(!empty($base_module_id) && !empty($system_name))
	{
		$root_file_name=$aobj_context->main_src."/validation_files/validate_".$base_module_id.".php";
		$function_name=$system_name;
			if (file_exists($root_file_name)) 
				{
					require_once($root_file_name);
					$data_arr=call_user_func($function_name,$aobj_context,$qry,$qry,'Auto Complete');
					$qry=(!empty($data_arr['qry']))?$data_arr['qry']:$qry;
				 
				}
	} 			  
	$order_by="  order by {$field_id1} limit 50 ";
	$qry.=" {$order_by} ";
    $lobj_get_data = $aobj_context->mobj_db->GetAll($qry);
	if(empty($lobj_get_data))	
	{
			$qry="select internal_code,{$field_id2_val} as name from 
						 {$table_name} where 
						 {$field_id2} like '{$value}%'
						 {$filter_cond}  {$active_cond} ";
				if(!empty($base_module_id) && !empty($system_name))
					{
						$root_file_name=$aobj_context->main_src."/validation_files/validate_".$base_module_id.".php";
						$function_name=$system_name;
							if (file_exists($root_file_name)) {
								require_once($root_file_name);
								$data_arr=call_user_func($function_name,$aobj_context,$qry,$qry,'Auto Complete');
								$qry=(!empty($data_arr['qry']))?$data_arr['qry']:$qry;								 
								}
					} 			 
			$order_by="  order by {$field_id1} limit 50 ";
			$qry.=" {$order_by} ";			 
		    $lobj_get_data = $aobj_context->mobj_db->GetAll($qry);
   }
    echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"Success");
}
?>