diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index fce933d6..9e190c97 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -950,33 +950,40 @@ 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(); $fk_createdby = ''; + $default_product = null; + $default_customer_segment = null; + $default_pd_type = null; if($entity_id) { $preferences = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $entity_id),ENTITYPREFERENCE); - //print_r($preferences); + // / print_r($preferences);die(); foreach($preferences as $preference_key => $preference_value) { if($preference_value['preference_type'] == 1) { $products = explode(",",$preference_value['values']); + $default_product = $preference_value['default_value']; } if($preference_value['preference_type'] == 2) { $customer_segments = explode(",",$preference_value['values']); + $default_customer_segment = $preference_value['default_value']; } if($preference_value['preference_type'] == 3) { $pd_types = explode(",",$preference_value['values']); + $default_pd_type = $preference_value['default_value']; } $fk_createdby = $preference_value['fk_createdby']; } $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = array('products' => $products,'customer_segments' => $customer_segments,'pd_types' => $pd_types,'fk_createdby' => $fk_createdby); + $data['records'] = array('products' => $products,'customer_segments' => $customer_segments,'pd_types' => $pd_types,'fk_createdby' => $fk_createdby,'default_product' => $default_product,'default_customer_segment' => $default_customer_segment,'default_pd_type' => $default_pd_type); $this->response($data,REST_Controller::HTTP_OK); } @@ -1003,9 +1010,10 @@ class Entity_Management_Controller extends REST_Controller { 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); + $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,'default_value' => isset($records['products_default']) && $records['products_default'] != '' ?$records['products_default'] : null ); $existing_data = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $records['fk_entity_id'],'preference_type' => 1),ENTITYPREFERENCE); $id = null; + //print_r($data);die(); if(count($existing_data)) { $existing_data_id = 0; @@ -1033,7 +1041,7 @@ class Entity_Management_Controller extends REST_Controller { 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); + $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,'default_value' => isset($records['customer_segments_default']) && $records['customer_segments_default'] != '' ?$records['customer_segments_default'] : 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)) @@ -1062,7 +1070,7 @@ class Entity_Management_Controller extends REST_Controller { 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); + $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,'default_value' => isset($records['pd_types_default']) && $records['pd_types_default'] != '' ?$records['pd_types_default'] : 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)) @@ -1108,6 +1116,7 @@ class Entity_Management_Controller extends REST_Controller { $customer_segments = array(); $pd_types = array(); $financial_institutions = array(); + //echo $entity_id; $existing_preferences = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $entity_id),ENTITYPREFERENCE); $financial_institutions = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $entity_id,'isactive' => 1),ENTITYFININSTITUTION); diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index c5d3fdfa..75faea7a 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4682,7 +4682,7 @@ public function getPDFormDetailsJSON_post() $data['pd_master_details'][0]['pd_report_generated_date'] = date('d/m/Y g:i:s A'); - if($data['pd_master_details'][0]['lender_short_name'] == 'CLIXH' && ($data['pd_master_details'][0]['product_abbr'] == 'LAP' || $data['pd_master_details'][0]['product_abbr'] == 'NRPL')) + if($data['pd_master_details'][0]['lender_short_name'] == 'CHFPL' && ($data['pd_master_details'][0]['product_abbr'] == 'LAP' || $data['pd_master_details'][0]['product_abbr'] == 'NRPL')) { $clix_lender_id = ENVIRONMENT == 'production' ? 5 : 16; //clix lender id based on env @@ -5968,7 +5968,7 @@ public function getPDFormDetailsJSON_post() //$data['satellite_path'] = $this->external_path.'/pd_reports/'. $pdid .'/satellite.png'; // $data['pd_master_details'][0]['lender_short_name'] = 'CLIXH'; // $data['pd_master_details'][0]['product_abbr'] = 'HL'; - if($data['pd_master_details'][0]['lender_short_name'] == 'CLIXH' && ($data['pd_master_details'][0]['product_abbr'] == 'LAP' || $data['pd_master_details'][0]['product_abbr'] == 'NRPL')) + if($data['pd_master_details'][0]['lender_short_name'] == 'CHFPL' && ($data['pd_master_details'][0]['product_abbr'] == 'LAP' || $data['pd_master_details'][0]['product_abbr'] == 'NRPL')) { // echo 'XXX'; $clix_lender_id = ENVIRONMENT == 'production' ? 5 : 16; //clix lender id based on env