diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index ab174f4b..6931a4da 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -139,9 +139,17 @@ class Entity_Management_Controller extends REST_Controller { { foreach($entity_child as $child) { - $entity_child_array = array('contact_person'=>$child['contact_person'],'contact_email'=>$child['contact_email'],'contact_mobile_no'=>$child['contact_mobile_no'],'fk_entity_id'=>$entity_id,'updatedon'=>$records['updatedon'],'fk_updatedby'=>$records['fk_updatedby'],'isactive'=>$child['isactive']); - $where_condition_array = array('entity_child_id'=>$child['entity_child_id']); - $this->Entity_Management_Model->updateRecords($entity_child_array,ENTITYCHILD,$where_condition_array); + if($child['entity_child_id'] != "" ||$child['entity_child_id'] != null) + { + $entity_child_array = array('contact_person'=>$child['contact_person'],'contact_email'=>$child['contact_email'],'contact_mobile_no'=>$child['contact_mobile_no'],'fk_entity_id'=>$entity_id,'updatedon'=>$records['updatedon'],'fk_updatedby'=>$records['fk_updatedby'],'isactive'=>$child['isactive']); + $where_condition_array = array('entity_child_id'=>$child['entity_child_id']); + $this->Entity_Management_Model->updateRecords($entity_child_array,ENTITYCHILD,$where_condition_array); + ) + else + { + $entity_child_array = array('contact_person'=>$child['contact_person'],'contact_email'=>$child['contact_email'],'contact_mobile_no'=>$child['contact_mobile_no'],'fk_entity_id'=>$entity_id,'createdon'=>$records['createdon'],'fk_createdby'=>$records['fk_createdby']); + $this->Entity_Management_Model->saveRecords($entity_child_array,ENTITYCHILD); + } } } diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index a776682a..5bbdfe0c 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -181,6 +181,7 @@ class PD_Controller extends REST_Controller { public function triggerNewPD_post() { $pd_details = json_decode($this->post('pd_details'),true); + $pd_applicant_details = json_decode($this->post('pd_applicant_details'),true); $pd_document_titles = json_decode($this->post('pd_document_titles'),true); $pd_documents = array(); @@ -200,13 +201,13 @@ class PD_Controller extends REST_Controller { if(count($choosed_template_id)) { - $pd_details['fk_template_id'] = $choosed_template_id[0]['fk_template_id']; + $pd_details['fk_pd_template_id'] = $choosed_template_id[0]['fk_template_id']; } /***********************PD ALLOCATION TYPE PROCESS **********/ - + $pd_details['fk_pd_allocated_to'] = null; $where_condition_array = array('fk_city_id' => $pd_details['fk_city'],'fk_lender_id' => $pd_details['fk_lender_id']); $temp_city_id = $this->PD_Model->selectRecords(PDTEAMMAP,$where_condition_array,$limit=0,$offset=0); if(count($temp_city_id)) @@ -265,7 +266,7 @@ class PD_Controller extends REST_Controller { /***********************END OF PD ALLOCATION TYPE AND PROCESS***********/ $pd_details['pd_date_of_initiation'] = date("Y-m-d H:i:s"); - $pd_id = $this->PD_Model->saveRecords(PDTRIGGER,$pd_details); + $pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER); /***********************PD DOCUMENTS UPLOAD SECTION ***********/ @@ -301,7 +302,7 @@ class PD_Controller extends REST_Controller { foreach($pd_applicant_details as $pd_applicant_detail) { $pd_applicant_detail['fk_pd_id'] = $pd_id; - $co_applicant_id = $this->PD_Model->saveRecords(PDAPPLICANTSDETAILS,$pd_applicant_detail); + $co_applicant_id = $this->PD_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); if($co_applicant_id != null || $co_applicant_id != '') { $count = $count + 1; @@ -321,7 +322,7 @@ class PD_Controller extends REST_Controller { $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = $template_id; + $data['records'] = $pd_id; $this->response($data,REST_Controller::HTTP_OK); } else diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index 0a993c32..9007298a 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -34,8 +34,8 @@ class PDALERTS //1.Get Current Status and createdby , lenders info by pdid $CI->db->SELECT("PDTRIGGER.fk_lender_id,PDTRIGGER.lender_applicant_id,PDTRIGGER.fk_pd_status,PDSTATUS.pd_status_name,PDTRIGGER.fk_createdby,USERPROFILE.fk_entity_id as created_entity_type,USERPROFILE.email as created_mail,USERPROFILE.mobile_no as created_mobile_no,PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,ALLOCATED.mobile_no as allocated_mobile_no,ALLOCATED.fk_entity_id as allocated_entity_type,PDTRIGGER.pd_agency_id"); $CI->db->FROM(PDTRIGGER." as PDTRIGGER"); - $CI->db->JOIN(USERPROFILE." as USERPROFILE","PDTRIGGER.fk_createdby = USERPROFILE.user_id"); - $CI->db->JOIN(USERPROFILE." as ALLOCATED","PDTRIGGER.fk_pd_allocated_to = ALLOCATED.user_id"); + $CI->db->JOIN(USERPROFILE." as USERPROFILE","PDTRIGGER.fk_createdby = USERPROFILE.userid"); + $CI->db->JOIN(USERPROFILE." as ALLOCATED","PDTRIGGER.fk_pd_allocated_to = ALLOCATED.userid"); $CI->db->JOIN(PDSTATUS." as PDSTATUS","PDTRIGGER.fk_pd_status = PDSTATUS.pd_status_id"); $CI->db->WHERE("PDTRIGGER.pd_id",$pdid); $core_details = $CI->db->GET()->result_array();