From ef40e04306f4010ba69c3b9b0bbe0ef98b4b5fb1 Mon Sep 17 00:00:00 2001 From: velz Date: Tue, 19 Feb 2019 19:55:59 +0530 Subject: [PATCH] GET FAMILY DETAILS MODIFIED --- api/application/config/constants.php | 1 + api/application/controllers/PD_Controller.php | 24 ++++++++++++++++++- .../helpers/myhttpclient_helper.php | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index bb6c02f7..1805f452 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -98,6 +98,7 @@ defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','lend defined('LOGTOBOT') OR define('LOGTOBOT',1); defined('LOGTOSYS') OR define('LOGTOSYS',1); defined('PROCESSJSON') OR define('PROCESSJSON',0); +defined('BOTURL') OR define('BOTURL','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=467975ee8e33abf1549803925eaace0f'); /*******************Constants PD status*********************************/ defined('TRIGGERED') OR define('TRIGGERED','TRIGGERED'); //First time PD Trigger. diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 5a55e9c9..14dcd44d 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4514,13 +4514,14 @@ class PD_Controller extends REST_Controller { $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);die(); + $temp_array = array(); if(count($general_data)) { $json = json_decode($general_data[0]['json'],true); //print_r($json); if(array_key_exists('persons_with_relationships',$json)) { - $temp_array = array(); + foreach($json['persons_with_relationships'] as $key => $relation) { foreach($json['individuals'] as $ind) @@ -4553,6 +4554,27 @@ class PD_Controller extends REST_Controller { //print_r($json); if(array_key_exists('persons_with_relationships',$json)) { + + + foreach($json['persons_with_relationships'] as $person => $value) + { + + if(count($general_data)) + { + $genjson = json_decode($general_data[0]['json'],true); + foreach($genjson['companies'] as $company_key =>$company) + { + //print_r($compan); + if($value['relationship_with_company_id'] == $company['company_order_id']) + { + $json['persons_with_relationships'][$person]['company_name'] = $company['company_name']; + $json['persons_with_relationships'][$person]['business_years'] = $company['business_years']; + $json['persons_with_relationships'][$person]['business_month'] = $company['business_month']; + $json['persons_with_relationships'][$person]['business_date_formation'] = $company['business_date_object']; + } + } + } + } $temp_array = array_merge($temp_array,$json['persons_with_relationships']); } } diff --git a/api/application/helpers/myhttpclient_helper.php b/api/application/helpers/myhttpclient_helper.php index d02a23a9..64aecf42 100644 --- a/api/application/helpers/myhttpclient_helper.php +++ b/api/application/helpers/myhttpclient_helper.php @@ -13,7 +13,7 @@ class MYHTTPCLIENT if(LOGTOBOT == true) { $client = new \GuzzleHttp\Client(); - $response = $client->post( 'https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=467975ee8e33abf1549803925eaace0f', [ + $response = $client->post( BOTURL, [ 'headers' => ['Content-Type' => 'application/json'], 'body' => json_encode($dataToBot) ]);