From b35c0a6a1d703f103836e738701a43afc539d091 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Thu, 7 Nov 2019 16:13:52 +0530 Subject: [PATCH] OFAMILY TITLE IN APPNAME GRABBER CHANGED --- api/application/controllers/PD_Controller.php | 5 ++++- .../helpers/applicantname_grabber_helper.php | 16 +++++++++++++--- .../helpers/getprocessedjson_helper.php | 3 ++- .../helpers/otherfamilyform_helper.php | 3 ++- .../report_templates/JSONTOREPORT_DI_AI.php | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index eb4452c0..24a452d2 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -5807,6 +5807,9 @@ public function getPDFormDetailsJSON_post() //echo $this->assignPDTempalate(1325);die(); //$this->getSatelliteImage(342);die();//velmurugan.s@venbainfotech.com //PDALERTS::sendMail($this,'vitvelz@gmail.com','PDGENIE TEST',array());die(); + //$this->load->helper('applicantname_grabber'); + // print_r(APPLICANTNAME_GRABBER::getLatestApplicantsName(1390));die(); + $records = $this->post('records'); $pdid = $records['pd_id']; //$external_path = $this->config->item('external_data_path'); @@ -6027,7 +6030,7 @@ public function getPDFormDetailsJSON_post() //$t = $this->load->view('temp_html.html',null,true); echo $t; - die(); + //die(); $total_replaces = substr_count($t,''); for($i = 0 ;$i < $total_replaces;$i++) diff --git a/api/application/helpers/applicantname_grabber_helper.php b/api/application/helpers/applicantname_grabber_helper.php index b4236491..61968def 100644 --- a/api/application/helpers/applicantname_grabber_helper.php +++ b/api/application/helpers/applicantname_grabber_helper.php @@ -7,16 +7,26 @@ class applicantname_grabber { $CI =&get_instance(); $CI->load->model('PD_Model'); - return ( $CI->PD_Model->selectCustomRecords(array('pd_co_applicant_id','applicant_name'),array('fk_pd_id' => $pd_id),PDAPPLICANTSDETAILS)); + //return ( $CI->PD_Model->selectCustomRecords(array('pd_co_applicant_id','applicant_name'),array('fk_pd_id' => $pd_id),PDAPPLICANTSDETAILS)); + + $columns = array('pd_co_applicant_id','applicant_name','TITLES.name as title'); + $table = array(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS'); + $joins = array( + array('table' => TITLES. ' as TITLES', + 'condition' =>"PDAPPLICANTSDETAILS.applicant_title_name = TITLES.title_id AND PDAPPLICANTSDETAILS.fk_pd_id = $pd_id", + 'jointype' => 'INNER') + ); + + return ( $CI->PD_Model->getJoinRecords($columns,$table,$joins)); } - public static function getApplicantsNameById($id,$latest_applicants_names) + public static function getApplicantsNameById($id,$latest_applicants_names,$type = 1) //$type i for return name only, 2 for return title only, and 3 for return both { foreach ($latest_applicants_names as $key => $value) { if($id == $value['pd_co_applicant_id']) { - return $value['applicant_name']; + return $type == 1 ? $value['applicant_name'] : ($type == 2 ? $value['title'] : ($value['title'].' '.$value['applicant_name'])); } } } diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index 494bed3f..e09329ea 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -826,7 +826,7 @@ class GETPROCESSEDJSON if(array_key_exists('selected_person',$family_details)) { - $CI->db->SELECT( 'PDAPPLICANTSDETAILS.applicant_name,TITLES.name' ); + $CI->db->SELECT( 'PDAPPLICANTSDETAILS.applicant_name,TITLES.name,TITLES.title_id' ); $CI->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS'); $CI->db->JOIN(TITLES.' as TITLES','PDAPPLICANTSDETAILS.applicant_title_name = TITLES.title_id','LEFT'); $CI->db->WHERE( $master_tables_pkid['PDAPPLICANTSDETAILS'] ,$family_details['selected_person']); @@ -839,6 +839,7 @@ class GETPROCESSEDJSON $selected_person_title_master = $owner[0]['name']; $raw_json['family_details'][$family_details_key]['selected_person_master'] = $selected_person_master; $raw_json['family_details'][$family_details_key]['selected_person_title_master'] = $selected_person_title_master; + $raw_json['family_details'][$family_details_key]['selected_person_title_id'] = $$owner[0]['title_id']; } } diff --git a/api/application/helpers/otherfamilyform_helper.php b/api/application/helpers/otherfamilyform_helper.php index fb4e25ec..ef376e70 100644 --- a/api/application/helpers/otherfamilyform_helper.php +++ b/api/application/helpers/otherfamilyform_helper.php @@ -4,13 +4,14 @@ class Otherfamilyform { public static function getFamilyDetails($values,$pdid){ $mergeResult=array(); + // print_r($values);die(); $latest_applicants_names = APPLICANTNAME_GRABBER::getLatestApplicantsName($pdid); $male_gender_array = array('1','2','4','5','11','12','14','16','17','19','21','24'); // $gender = 'DEFAULT'; $rupee_symbol = ""; foreach($values as $fetchVal){ $storeValue=array(); - $storeValue['selected_person_title']= isset($fetchVal['selected_person_title_master']) ? $fetchVal['selected_person_title_master'] : ''; + $storeValue['selected_person_title']= isset($fetchVal['selected_person_title_id']) ? APPLICANTNAME_GRABBER::getApplicantsNameById($fetchVal['selected_person_title_id'],$latest_applicants_names,2) : $fetchVal['selected_person_title_master']; $storeValue['selected_person']= APPLICANTNAME_GRABBER::getApplicantsNameById($fetchVal['selected_person'],$latest_applicants_names); $storeValue['residency_address']=$fetchVal['residence_place'].', '.$fetchVal['residence_city_master'].', '.$fetchVal['residence_state_master'].'-'; diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php index cbdee0c0..7682373b 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php @@ -1337,7 +1337,7 @@ if($total_no_of_business > 0) { // if($temp_show == null) // { ?> -
+