diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 895cc7aa..7c2ce5e6 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -588,5 +588,8 @@ defined('ENTITYDISCLAIMERID') OR define('ENTITYDISCLAIMERID','entity_disclaimer_ defined('ENTITYFININSTITUTION') OR define('ENTITYFININSTITUTION','m_entity_fin_institutions'); defined('ENTITYFININSTITUTIONID') OR define('ENTITYFININSTITUTIONID','entity_fin_institution_id'); +defined('ENTITYPREFERENCS') OR define('ENTITYPREFERENCE','m_entity_preferences'); +defined('ENTITYPREFERENCEID') OR define('ENTITYPREFERENCEID','entity_preference_id'); + diff --git a/api/application/config/routes.php b/api/application/config/routes.php index be90f673..452c4786 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -150,7 +150,7 @@ $route['getEntityDisclaimer'] = 'Entity_Management_Controller/getEntityDisclaime $route['saveEntityFinInstitutions'] = 'Entity_Management_Controller/saveEntityFinInstitutions'; $route['(getEntityFinInstitutions/:any)'] = 'Entity_Management_Controller/getEntityFinInstitutions'; $route['saveEntityOtherPreferences'] = 'Entity_Management_Controller/saveEntityOtherPreferences'; -$route['getEntityOtherPreferences'] = 'Entity_Management_Controller/getEntityOtherPreferences'; +$route['(getEntityOtherPreferences/:any)'] = 'Entity_Management_Controller/getEntityOtherPreferences'; //PD RELATED $route['triggerNewPD'] = 'PD_Controller/triggerNewPD'; diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index 3b9ff57c..fe53e8c1 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -949,11 +949,151 @@ class Entity_Management_Controller extends REST_Controller { public function getEntityOtherPreferences_get() { + $entity_id = $this->uri->segment(2); + $products = array(); + $customer_segments = array(); + $pd_types = array(); + if($entity_id) + { + $preferences = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $entity_id),ENTITYPREFERENCE); + //print_r($preferences); + foreach($preferences as $preference_key => $preference_value) + { + if($preference_value['preference_type'] == 1) + { + $products = explode(",",$preference_value['values']); + } + if($preference_value['preference_type'] == 2) + { + $customer_segments = explode(",",$preference_value['values']); + } + if($preference_value['preference_type'] == 3) + { + $pd_types = explode(",",$preference_value['values']); + } + } + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = array('products' => $products,'customer_segments' => $customer_segments,'pd_types' => $pd_types); + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_BAD_REQUEST; + $this->response($data,REST_Controller::HTTP_OK); + } } public function saveEntityOtherPreferences_post() { + $records = $this->post('records'); + $over_all_count = 0; + + if(count($records['products'])) + { + $products = ''; + foreach($records['products'] as $p_key => $p_value) + { + $products .= $p_value.','; + } + if($products != '') + { + $products = substr_replace($products,'',-1,1); + $data = array('fk_entity_id' => $records['fk_entity_id'], 'preference_type' => 1, 'values' => $products,'fk_createdby' => $records['fk_createdby'],'fk_updatedby' => isset($records['fk_updatedby']) ? $records['fk_updatedby'] : null); + $existing_data = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $records['fk_entity_id'],'preference_type' => 1),ENTITYPREFERENCE); + $id = null; + if(count($existing_data)) + { + $existing_data_id = 0; + if(isset($existing_data[0]['preference_type']) && $existing_data[0]['preference_type'] == 1) { $existing_data_id = $existing_data[0]['entity_preference_id']; } + + $id = $this->Entity_Management_Model->updateRecords($data,ENTITYPREFERENCE,array('entity_preference_id' => $existing_data_id)); + } + else + { + $id = $this->Entity_Management_Model->saveRecords($data,ENTITYPREFERENCE); + } + if($id != null) { $over_all_count++; } + + } + + } + + if(count($records['customer_segments'])) + { + $customer_segments = ''; + foreach($records['customer_segments'] as $cs_key => $cs_value) + { + $customer_segments .= $cs_value.','; + } + if($customer_segments != '') + { + $customer_segments = substr_replace($customer_segments,'',-1,1); + $data = array('fk_entity_id' => $records['fk_entity_id'], 'preference_type' => 2, 'values' => $customer_segments,'fk_createdby' => $records['fk_createdby'],'fk_updatedby' => isset($records['fk_updatedby']) ? $records['fk_updatedby'] : null); + $existing_data = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $records['fk_entity_id'],'preference_type' => 2),ENTITYPREFERENCE); + $id = null; + if(count($existing_data)) + { + $existing_data_id = 0; + if(isset($existing_data[0]['preference_type']) && $existing_data[0]['preference_type'] == 2) { $existing_data_id = $existing_data[0]['entity_preference_id']; } + $id = $this->Entity_Management_Model->updateRecords($data,ENTITYPREFERENCE,array('entity_preference_id' => $existing_data_id)); + } + else + { + $id = $this->Entity_Management_Model->saveRecords($data,ENTITYPREFERENCE); + } + if($id != null) { $over_all_count++; } + + } + + } + + if(count($records['pd_types'])) + { + $pd_types = ''; + foreach($records['pd_types'] as $pt_key => $pt_value) + { + $pd_types .= $pt_value.','; + } + if($pd_types != '') + { + $pd_types = substr_replace($pd_types,'',-1,1); + $data = array('fk_entity_id' => $records['fk_entity_id'], 'preference_type' => 3, 'values' => $pd_types,'fk_createdby' => $records['fk_createdby'],'fk_updatedby' => isset($records['fk_updatedby']) ? $records['fk_updatedby'] : null); + $existing_data = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $records['fk_entity_id'],'preference_type' => 3),ENTITYPREFERENCE); + $id = null; + if(count($existing_data)) + { + $existing_data_id = 0; + if(isset($existing_data[0]['preference_type']) && $existing_data[0]['preference_type'] == 3) { $existing_data_id = $existing_data[0]['entity_preference_id']; } + $id = $this->Entity_Management_Model->updateRecords($data,ENTITYPREFERENCE,array('entity_preference_id' => $existing_data_id)); + } + else + { + $id = $this->Entity_Management_Model->saveRecords($data,ENTITYPREFERENCE); + } + if($id != null) { $over_all_count++; } + + } + + } + + + if($over_all_count != 0) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $over_all_count; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'Somethings went wrong. Try Later!'; + $this->response($data,REST_Controller::HTTP_OK); + } } diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e9bf48c2..47c06562 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -5833,7 +5833,7 @@ public function getPDFormDetailsJSON_post() } //print_r(json_decode($data['pd_processed_forms'][18][0]['processed_json']));die(); $data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report'); - print_r($data['pd_images']);//die(); //print_r(json_decode($data['pd_processed_forms'][14][0]['processed_json'],true)); + //print_r($data['pd_images']);//die(); //print_r(json_decode($data['pd_processed_forms'][14][0]['processed_json'],true)); // die(); //echo "*******************************************"; if($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-RI') @@ -8115,7 +8115,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() if(isset($business_bank_form['banking_details']) && count($business_bank_form['banking_details'])) { foreach ($business_bank_form['banking_details'] as $business_acc_key => $business_acc_value) { - if(!strcasecmp($business_acc_value['is_main'],'Yes') && ($business_acc_value['vintage_year'] == '' || $business_acc_value['vintage_year'] == '')) + if(!strcasecmp($business_acc_value['is_main'],'Yes') && ( !is_numeric($business_acc_value['vintage_year']))) { $not_available_count++; } diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index dfac3ed3..c157d9f8 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -537,22 +537,25 @@ defined('BASEPATH') OR exit('No direct script access allowed');               --> $individual) { - + //print_r($individual);die(); if($individual['is_person_met'] == true) { //array_push($person_met_images); $temp_person_met = array(); - $applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "Not Available" ; + $applicant_name = $individual['applicant_name']; + //$applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "Not Available" ; //echo '
'.$individual['applicant_title_name_master'] .' '. $applicant_name.'
' ; $temp_person_met['name'] = $individual['applicant_title_name_master'] .' '. $applicant_name; $temp_person_met['photo'] = ''; $temp_person_met['id_proof'] = ''; foreach($pd_images[18] as $pm_Key => $pm_value) { + + //echo $applicant_name.'-'.$pm_value['pd_document_title']; if( !strcasecmp(trim($applicant_name),trim($pm_value['pd_document_title'])) ) { $temp_person_met['photo'] = $pm_value['doc_url'] ; @@ -608,7 +611,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } - print_r($person_met_data);die(); + //print_r($person_met_data);die(); echo '
'; echo '

Person(s) Met:

'; echo '
'; diff --git a/api/application/views/report_templates/JSONTOREPORT_RI.php b/api/application/views/report_templates/JSONTOREPORT_RI.php index 3c4a1f26..00f96261 100644 --- a/api/application/views/report_templates/JSONTOREPORT_RI.php +++ b/api/application/views/report_templates/JSONTOREPORT_RI.php @@ -546,7 +546,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { //array_push($person_met_images); $temp_person_met = array(); - $applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "Not Available" ; + $applicant_name = $individual['applicant_name']; //echo '
'.$individual['applicant_title_name_master'] .' '. $applicant_name.'
' ; $temp_person_met['name'] = $individual['applicant_title_name_master'] .' '. $applicant_name; $temp_person_met['photo'] = '';