diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 02d502c3..83152783 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4317,7 +4317,7 @@ class PD_Controller extends REST_Controller { $fields = array('json'); $where_condition_array = array('isactive' => 1,'fk_form_id' =>18,'fk_pd_id' => $pdid); $general_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); - //print_r($general_data); + //print_r($general_data);die(); if(count($general_data)) { $json = json_decode($general_data[0]['json'],true); @@ -4325,13 +4325,16 @@ class PD_Controller extends REST_Controller { if(array_key_exists('persons_with_relationships',$json)) { $temp_array = array(); - foreach($json['persons_with_relationships'] as $relation) + foreach($json['persons_with_relationships'] as $key => $relation) { - if($relation['relation_to'] != 0 || $relation['relation_to'] != "" ) - { - $temp_array = array_merge($temp_array,array($relation)); - } - //print_r($relation); + foreach($json['individuals'] as $ind) + { + if($relation['pd_co_applicant_id'] == $ind['pd_co_applicant_id']) + { + $relation['age'] = $ind['age']; + } + } + $temp_array = array_merge($temp_array,array($relation)); } } } @@ -4573,7 +4576,7 @@ class PD_Controller extends REST_Controller { } - //Get All Persons Name Invloved In a PD includes Applicants,Business Invloved and + //Get All Persons Name Invloved In a PD, includes Applicants,Invloved in Business public function getAllPersonsName_post() { $pdid = $this->post('pd_id'); @@ -4583,26 +4586,43 @@ class PD_Controller extends REST_Controller { $fields = array('json'); $where_condition_array = array('isactive' => 1,'fk_form_id' =>18,'fk_pd_id' => $pdid); $general_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); - //print_r($general_data); + //print_r($general_data);die(); if(count($general_data)) { $json = json_decode($general_data[0]['json'],true); //print_r($json); - if(array_key_exists('persons_with_relationships',$json)) + if(array_key_exists('individuals',$json)) { - foreach($json['persons_with_relationships'] as $key => $persons) + foreach($json['individuals'] as $key => $persons) { - $final_names[] = $persons['applicant_name']; + // if($persons['is_applicant'] == true || $persons['is_person_met'] == true) + // { + // $type = 1; + // } + $final_names[] = array('applicant_name' => $persons['applicant_name'],'applicant_type' => 1); + } + } + + if(array_key_exists('companies',$json)) + { + foreach($json['companies'] as $key => $persons) + { + // if($persons['is_applicant'] == true || $persons['is_person_met'] == true) + // { + // $type = 1; + // } + $final_names[] = array('applicant_name' => $persons['company_name'],'applicant_type' => 2); } } } + //print_r($final_names);die(); //Get Details from All Business Froms $fields = array('json','company_id'); $where_condition_array = array('isactive' => 1,'fk_form_id' =>13,'fk_pd_id' => $pdid); $business_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); - //print_r($business_data); + //print_r($business_data);die(); if(count($business_data)) { @@ -4614,7 +4634,7 @@ class PD_Controller extends REST_Controller { { foreach($json['persons_with_relationships'] as $key => $persons) { - $final_names[] = $persons['family_member_name']; + $final_names[] = array('applicant_name' => $persons['family_member_name'],'applicant_type' => 3); } } @@ -4642,7 +4662,7 @@ class PD_Controller extends REST_Controller { { foreach($family['family_members_details'] as $key => $persons) { - $final_names[] = $persons['family_member_name']; + $final_names[] = array('applicant_name' => $persons['applicant_name'],'applicant_type' => 3); } }