Supplier question filter done : ps

This commit is contained in:
sanjeev 2022-01-10 10:59:22 +05:30
parent 7c804047e4
commit c7e1d506f0

View File

@ -1314,6 +1314,8 @@ class Template_Management_Controller extends REST_Controller {
}else{ }else{
$map_id = $_GET['map_id']; $map_id = $_GET['map_id'];
$form_id = $_GET['form_id']; $form_id = $_GET['form_id'];
// Using global keyword
// global $global_form_id;
$fields = array('json'); $fields = array('json');
$where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"isactive"=>1); $where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"isactive"=>1);
$json_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATE_JSON_V2); $json_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATE_JSON_V2);
@ -1329,8 +1331,8 @@ class Template_Management_Controller extends REST_Controller {
$filter_arr = array(); $filter_arr = array();
//try 4 //try 4
if(!empty($quest)){ if(!empty($quest)){
$arr1 = $this->call_arr1($quest); $arr1 = $this->call_arr1($quest,$_GET['form_id']);
$arr2 = $this->call_arr2($quest); $arr2 = $this->call_arr2($quest,$_GET['form_id']);
$filter_arr = $this->merged_arr($arr1,$arr2); $filter_arr = $this->merged_arr($arr1,$arr2);
} }
@ -1358,7 +1360,7 @@ class Template_Management_Controller extends REST_Controller {
} }
//Step 1 : Question Filter Only //Step 1 : Question Filter Only
public function call_arr1($quest){ public function call_arr1($quest,$fid){
$return_arr = array(); $return_arr = array();
$i = 0 ; $i = 0 ;
if((!empty($quest)) && (is_array($quest) || is_object($quest)) ) if((!empty($quest)) && (is_array($quest) || is_object($quest)) )
@ -1375,7 +1377,7 @@ class Template_Management_Controller extends REST_Controller {
} }
//Step 2 : Onchange fns - Question Filter //Step 2 : Onchange fns - Question Filter
public function call_arr2($quest){ public function call_arr2($quest,$fid){
$return_arr = array(); $return_arr = array();
$i = 0 ; $i = 0 ;
if(!empty($quest) && is_array($quest) || is_object($quest)){ if(!empty($quest) && is_array($quest) || is_object($quest)){
@ -1386,17 +1388,25 @@ class Template_Management_Controller extends REST_Controller {
if($count>0 && !empty($onchange_properties)){ if($count>0 && !empty($onchange_properties)){
foreach ($onchange_properties as $key1 => $value1) { foreach ($onchange_properties as $key1 => $value1) {
if($value1['insert_index'] == $value['question_key']){ if($value1['insert_index'] == $value['question_key']){
if(count($value1['questions']) > 1 && ($fid == 1 || $fid == 2)){
for($j = 0 ;$j < count($value1['questions']);$j++){
$temp[$i] = $this->call_arr1($value1['questions'][$j]['question'],$fid);
$arr2 = $this->call_arr2($value1['questions'][$j]['question'],$fid);
$return_arr[$i] = $this->merged_arr($temp[$i],$arr2);
}
}else{
if(isset($value1['questions'][0]['question_key'])){ if(isset($value1['questions'][0]['question_key'])){
$temp[$i] = $this->call_arr1($value1['questions']); $temp[$i] = $this->call_arr1($value1['questions'],$fid);
$arr2 = $this->call_arr2($value1['questions']); $arr2 = $this->call_arr2($value1['questions'],$fid);
// $arr1 = $this->call_arr1($value1['questions']); // $arr1 = $this->call_arr1($value1['questions']);
// $arr2[$i]['child'] = $this->call_arr2($temp[$i],$arr2); // $arr2[$i]['child'] = $this->call_arr2($temp[$i],$arr2);
$return_arr[$i] = $this->merged_arr($temp[$i],$arr2); $return_arr[$i] = $this->merged_arr($temp[$i],$arr2);
}else{ }else{
$temp[$i] = $this->call_arr1($value1['questions'][0]['question']); $temp[$i] = $this->call_arr1($value1['questions'][0]['question'],$fid);
$arr2 = $this->call_arr2($value1['questions'][0]['question']); $arr2 = $this->call_arr2($value1['questions'][0]['question'],$fid);
$return_arr[$i] = $this->merged_arr($temp[$i],$arr2); $return_arr[$i] = $this->merged_arr($temp[$i],$arr2);
} }
}
// foreach($value1['question'] as $key2 => $value2){ // foreach($value1['question'] as $key2 => $value2){
// $temp2[$i] = $this->call_arr1($value2['question']); // $temp2[$i] = $this->call_arr1($value2['question']);
// $arr3 = $this->call_arr2($value2['question']); // $arr3 = $this->call_arr2($value2['question']);