diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 566ff7be..26721ef6 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -1108,12 +1108,24 @@ class PD_Controller extends REST_Controller { $mwise_lender_id = (ENVIRONMENT == 'production' ? 7 : 35); $current_lender_id = (isset($pd_details['fk_lender_id']) && $pd_details['fk_lender_id'] != '' ? $pd_details['fk_lender_id'] : $temp_data[0]['fk_lender_id']); $is_mwise_lender = ( $current_lender_id == $mwise_lender_id ? true : false); - + $this->load->model('User_Management_Model'); + $user_details = $this->User_Management_Model->getUserDetails($pd_details['fk_updatedby']); + $role = $user_details['data'][0]['user_role']; + if($is_mwise_lender && (!empty($agency_id)) && ($agency_id != null) && ((int)$agency_id != 0) && ($pd_details['pd_status'] != "TRIGGERED" || $pd_details['pd_status'] != "QC_COMPLETED")) { + //newly implemented + if(($pd_details['pd_status'] == "CANCELLED") && $role == 27){ + $pd_details['vendor_status'] = null; + $pd_details['pd_agency_id'] = null; + $pd_details['pd_status'] = $pd_details['pd_status']; + } + else{ $pd_details['vendor_status'] = $pd_details['pd_status']; - $pd_details['pd_status'] = ALLOCATED_TO_FIA; + $pd_details['pd_status'] = ALLOCATED_TO_FIA;} } + + $where_condition_array = array('pd_id' => $pd_details['pd_id'],'random_string' => $pd_details['random_string']); $pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array); @@ -11296,7 +11308,8 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() public function smcStuffs($pd_details,$existing_pd_details = array()) { - // echo "i am here";exit(); + // echo "i am here"; + // echo $pd_details['pd_status']; //if is this MWISE (SMC Credit PD) lender then auto allocate to RCM users and make pd status as allocated //get RCM user for auto allocation based on pd address @@ -11308,6 +11321,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $current_lender_id = (isset($pd_details['fk_lender_id']) && $pd_details['fk_lender_id'] != '' ? $pd_details['fk_lender_id'] : $existing_pd_details[0]['fk_lender_id']) ; $is_mwise_lender = ( $current_lender_id == $mwise_lender_id ? true : false); // echo !$is_mwise_lender; + // echo "curr".$current_lender_id;die(); if($is_mwise_lender && (($pd_details['pd_status'] == TRIGGERED) || ($pd_details['pd_status'] == ALLOCATED))) { $regional_credit_manager = $this->PD_Model->getRCM($pd_details['fk_state']);//pass pd address city as param