diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 3340a0e1..6e3db3cf 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -842,10 +842,11 @@ class SMC_Credit_PD_Controller extends REST_Controller { if($pd_id != "" || $pd_id != null) { - - $return_data['template_details'] = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($pd_id,$client,$random_string,$api); $return_data['pdmaster_details'] = $this->PD_Model->getPDMasterDetails($pd_id,$random_string); + $product_id = $return_data['pdmaster_details'][0]['fk_product_id']; + $return_data['template_details'] = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($pd_id,$product_id,$client,$random_string,$api); $return_data['pdapplicants_detials'] = $this->PD_Model->getApplicantsDetails($pd_id); + //print_r($return_data['template_details']);die(); if(count($return_data['template_details'])) { $data['dataStatus'] = true; diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index d021ced0..23d96d72 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -95,6 +95,10 @@ class PD_Model extends SPARQ_Model { } + else + { + $this->db->WHERE('PDTRIGGER.fk_lender_id != ',35); + } if($pdagencyid != "" || $pdagencyid != null) { diff --git a/api/application/models/SMC_Credit_PD_Model.php b/api/application/models/SMC_Credit_PD_Model.php index bdf87f3b..c5ba588a 100644 --- a/api/application/models/SMC_Credit_PD_Model.php +++ b/api/application/models/SMC_Credit_PD_Model.php @@ -53,18 +53,21 @@ class SMC_Credit_PD_Model extends SPARQ_Model { } - function getSMCTemplateForPD($pd_id,$client,$random_string,$api) + function getSMCTemplateForPD($pd_id,$product_id,$client,$random_string,$api) { + //echo $product_id;die(); // $master_forms = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1),SMC_CREDIT_PD_FORMS); // print_r($master_forms); - $table = SMC_CREDIT_PD_FORMS.' as SMC_CREDIT_PD_FORMS'; - $fields = array('SMC_CREDIT_PD_FORMS.form_name','SMC_CREDIT_PD_FORMS.form_id as fk_form_id','SMC_CREDIT_PD_SECTION_DATA.fk_pd_id','if(SMC_CREDIT_PD_SECTION_DATA.json is not null,true,false) as is_answered'); + $table = CREDITPDTEMPLATE.' as CREDITPDTEMPLATE'; + // $table = SMC_CREDIT_PD_FORMS.' as SMC_CREDIT_PD_FORMS'; + $fields = array('SMC_CREDIT_PD_FORMS.form_name','CREDITPDTEMPLATE.pd_form_id as fk_form_id','CREDITPDTEMPLATE.fk_product_id','SMC_CREDIT_PD_SECTION_DATA.fk_pd_id','if(SMC_CREDIT_PD_SECTION_DATA.json is not null,true,false) as is_answered'); $joins = array( - array('table'=>SMC_CREDIT_PD_SECTION_DATA." as SMC_CREDIT_PD_SECTION_DATA",'condition'=>"SMC_CREDIT_PD_SECTION_DATA.fk_form_id = SMC_CREDIT_PD_FORMS.form_id AND SMC_CREDIT_PD_SECTION_DATA.fk_pd_id = $pd_id and SMC_CREDIT_PD_SECTION_DATA.isactive = 1 " ,'jointype'=>'LEFT') + array('table'=>SMC_CREDIT_PD_SECTION_DATA." as SMC_CREDIT_PD_SECTION_DATA",'condition'=>"SMC_CREDIT_PD_SECTION_DATA.fk_form_id = CREDITPDTEMPLATE.pd_form_id AND CREDITPDTEMPLATE.fk_product_id = $product_id AND SMC_CREDIT_PD_SECTION_DATA.fk_pd_id = $pd_id and SMC_CREDIT_PD_SECTION_DATA.isactive = 1 " ,'jointype'=>'LEFT'), + array('table'=>SMC_CREDIT_PD_FORMS." as SMC_CREDIT_PD_FORMS",'condition'=>"CREDITPDTEMPLATE.pd_form_id = SMC_CREDIT_PD_FORMS.form_id" ,'jointype'=>'INNER JOIN') ); - $where_condition_array = array('SMC_CREDIT_PD_FORMS.isactive' => 1); + $where_condition_array = array('CREDITPDTEMPLATE.isactive' => 1,'CREDITPDTEMPLATE.fk_product_id' => $product_id); return - $master_forms = $this->getJoinRecords($fields,$table,$joins,$where_condition_array,'SMC_CREDIT_PD_FORMS.form_id','ASC'); + $master_forms = $this->getJoinRecords($fields,$table,$joins,$where_condition_array,'CREDITPDTEMPLATE.pd_form_id','ASC'); print_r($this->db->last_query());die();