diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e68be4c7..fc8a0682 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -1629,11 +1629,17 @@ public function assignPDTempalate($data) //if($records['fk_pd_allocated_to'] != "" || $records['fk_pd_allocated_to'] != null) //{ // $records['pd_agency_id'] =isset($records['pd_agency_id']) ? $records['pd_agency_id'] : null; - + + $fields = array('fk_lender_id','pd_agency_id'); + $where_condition_array = array('pd_id'=>$records['pd_id']); + $lender_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER); + $smc_lender_id = ENVIRONMENT == 'production' ? 7 : 35; //SMC lender id MWISE in live and demo + $records['pd_status'] = isset($records['pd_status']) ? $records['pd_status'] : ALLOCATED; - if(isset($records['pd_agency_id']) && $records['pd_agency_id'] != null){ - $records['vendor_status'] = $records['pd_status']; + // IF Condition - using PDID get the lender and mapped with SMC_lender_id macthed means Vendor status dynamically assigned + if($smc_lender_id == $lender_id[0]['fk_lender_id'] && isset($records['pd_agency_id']) && $records['pd_agency_id'] != null){ + $records['vendor_status'] = $records['pd_status']; //Here vendor_status is dynamic (ALLOCATED,SCHEDULED,COMPLETED like that) } else if(isset($records['pd_status']) && ($records['pd_status'] == ALLOCATED_TO_FIA )) { @@ -1641,7 +1647,7 @@ public function assignPDTempalate($data) $records['vendor_status'] = TRIGGERED; } //} - $where_condition_array = array('pd_id' => $records['pd_id']); + // $where_condition_array = array('pd_id' => $records['pd_id']); $pd_id_modified = $this->PD_Model->updateRecords($records,PDTRIGGER,$where_condition_array); // $where_condition_array = array('fk_user_id' => $records['fk_pd_allocated_to']); @@ -10670,6 +10676,19 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $fields_to_update['pd_visit_date'] = date('Y-m-d H:i:s'); } + + + + $smc_lender_id = ENVIRONMENT == 'production' ? 7 : 35; //SMC lender id MWISE in live and demo + $current_lender_id = $exist_pd_details[0]['fk_lender_id']; + $agency_id = $exist_pd_details[0]['pd_agency_id']; + // IF Condition - using PDID get the lender and mapped with SMC_lender_id macthed means Vendor status dynamically assigned + if($smc_lender_id == $current_lender_id && isset($agency_id) && $agency_id != null){ + if(isset($records['vendor_status']) && ($records['vendor_status'] == QC_COMPLETED)){ + $records['pd_status'] = $records['vendor_status']; //Here vendor_status is (QC_COMPLETED) means i have to update the Normal Status also. + } + // else{ $records['vendor_status'] = $records['pd_status']; } + } } // die(); // print_r($fields_to_update);die();