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.141.25.100


Current Path : /var/www/oasis/src_old/
Upload File :
Current File : /var/www/oasis/src_old/update_defined_flag.php

<?php
 
$conditional_arr=array("po","exicize","inventoy","fdf");
$_SESSION['conditional_arr']   = $conditional_arr;
function UpdateDefinedFlag($aobj_context)
{  
		$conditional_arr=$_SESSION['conditional_arr'];
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		$schema_id =$aobj_context->mobj_data["schema_id"];
		$schema_cond='';
		if(!($schema_id==0 or $schema_id=='0'))
		{
		 $schema_cond=" and s.ref_s_user_schema_code={$schema_id} ";
			//$schema_cond=" and s.ref_s_user_schema_code=6 ";
		}		
				$get_schema_id="select  internal_code,is_defined,
									ref_s_user_schema_code,
									conditional_display
									from s_user_schema_elements s
								 	where conditional_display is not null
									and conditional_display<>'' 
									{$schema_cond}";
				$lobj_get_schema_id = $aobj_context->mobj_db->GetAll($get_schema_id);
			 
		foreach($lobj_get_schema_id as $key1=>$schema_value)
			{
			$schema_code=$schema_value[ref_s_user_schema_code];	
			$update_all_flag="update s_user_schema_elements set is_defined=0 
									where ref_s_user_schema_code={$schema_code}";
			$lobj_update_all_flag = $aobj_context->mobj_db->Execute($update_all_flag);	
			
			$update_defined_flag="update s_user_schema_elements set is_defined=1 
									where conditional_display is null
									or conditional_display=''
									and ref_s_user_schema_code={$schema_code}";
			$lobj_update_defined_flag = $aobj_context->mobj_db->Execute($update_defined_flag);	
			
			$select_undefined_flag="select  internal_code, 
									lower(conditional_display) as conditional_display
									from s_user_schema_elements s
								 	where conditional_display is not null
									and conditional_display<>'' and
									s.ref_s_user_schema_code={$schema_code} ";	
			$lobj_select_undefined_flag = $aobj_context->mobj_db->GetAll($select_undefined_flag); 	
			
				foreach($lobj_select_undefined_flag as $k=>$v)
						{
							$internal_code=$v[internal_code];
							$cond_flag=$v[conditional_display];
							$update_flag=0;
							$pipe_explode=explode("|",$cond_flag);
								for($pipe=0;$pipe<count($pipe_explode);$pipe++)
									{
										$update_flag=0;
										$pipe_explode_value=$pipe_explode[$pipe];
										if(in_array($pipe_explode_value,$conditional_arr))
										{
											$update_flag=1;
											updateDefineFlag($aobj_context,$internal_code);
											break;
										}
										else
										{						
										$comma_split=explode(",",$pipe_explode_value);
											for($c=0;$c<count($comma_split);$c++)
												{
													$comma_val=$comma_split[$c];
													if(in_array($comma_val,$conditional_arr))
														{
														$update_flag=1;
														}
													else
														{
														$update_flag=0;
														}
												}
										}
										if($update_flag)
										{
										updateDefineFlag($aobj_context,$internal_code);
										break;
										}
									}								
						}
			}
	   $data['details']=$lobj_details;
          
		if(($schema_id==0 or $schema_id=='0'))
		{
		$data="Define Flag  Updated Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 	
		return;	  
		}		  
}	  
function updateDefineFlag($aobj_context,$internal_code)
{
	$update_defined_flag="update s_user_schema_elements set is_defined=1 
									where internal_code={$internal_code}";
			$lobj_update_defined_flag = $aobj_context->mobj_db->Execute($update_defined_flag);	
} 
?>