SMC FEEDBACKS
This commit is contained in:
parent
9885e01ffa
commit
3bfdff19ad
@ -35,7 +35,7 @@ $config['api_user_auth_info'] = array(
|
||||
//'triggerNewPD' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
|
||||
//'updatePDMaster' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
|
||||
'updatePDDocs' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
|
||||
'updatePDApplicants' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
|
||||
//'updatePDApplicants' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
|
||||
'allocatePD' => array(2,3,4,5,10,21,22,25,26,20,27),
|
||||
'schdulePD' => array(2,3,4,5,21,10,22,21),
|
||||
'generatePDReport' => array(3,6,7,10),
|
||||
|
||||
@ -585,30 +585,12 @@ class PD_Controller extends REST_Controller {
|
||||
//End of Generate Random string
|
||||
|
||||
|
||||
|
||||
//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
|
||||
|
||||
// $pd_details['fk_lender_id'] = 35;
|
||||
// $addresses[0]['fk_city'] = 3374;
|
||||
$mwise_lender_id = (ENVIRONMENT == 'production' ? 7 : 35);
|
||||
|
||||
$is_mwise_lender = ( $pd_details['fk_lender_id'] == $mwise_lender_id ? true : false);
|
||||
// echo !$is_mwise_lender;
|
||||
if($is_mwise_lender)
|
||||
{
|
||||
$regional_credit_manager = $this->PD_Model->getRCM($addresses[0]['fk_city']);//pass pd address city as param
|
||||
if(count($regional_credit_manager))
|
||||
{
|
||||
$pd_details['fk_pd_allocated_to'] = $regional_credit_manager[0]['userid'];
|
||||
$pd_details['pd_status'] = ALLOCATED;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR',('### Couldnot find RCM users - '.$addresses[0]['fk_city']));
|
||||
}
|
||||
}
|
||||
//implement SMC related stuffs
|
||||
|
||||
if($pd_details['pd_status'] == TRIGGERED)
|
||||
{
|
||||
$pd_details = $this->smcStuffs($pd_details);
|
||||
}
|
||||
// echo 'final';
|
||||
// die();
|
||||
$pd_details['parent_pd_id'] = isset($pd_details['parent_pd_id']) ? $pd_details['parent_pd_id'] : NULL;
|
||||
@ -1040,6 +1022,8 @@ class PD_Controller extends REST_Controller {
|
||||
/***********************CHOOSE PD TEMPALATE*********************/
|
||||
$pd_details['fk_pd_template_id'] = $this->assignPDTempalate($pd_details['pd_id']);
|
||||
//echo $pd_details['fk_pd_template_id'];
|
||||
$pd_details = $this->smcStuffs($pd_details);
|
||||
|
||||
}
|
||||
|
||||
/*********************** vendor status if it is allocated to partner*********************/
|
||||
@ -1098,6 +1082,13 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
|
||||
if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == BOUNCED)
|
||||
{
|
||||
//implement smc related stuffs
|
||||
$pd_details = $this->smcStuffs($pd_details,$exist_pd_details);
|
||||
}
|
||||
|
||||
|
||||
if($pd_id_modified != null || $pd_id_modified != '' && $count != 0)
|
||||
{
|
||||
|
||||
@ -2073,7 +2064,7 @@ public function assignPDTempalate($data)
|
||||
{
|
||||
$lenderid = $this->get('lenderid');
|
||||
$smc_lender_id = ENVIRONMENT == 'production' ? 7 : 35; //pk id of SMC in live and demo
|
||||
if($lenderid = $smc_lender_id)
|
||||
if($lenderid == $smc_lender_id)
|
||||
{
|
||||
|
||||
$this->load->model('User_Management_Model');
|
||||
@ -11078,6 +11069,82 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$this->response($data,REST_Controller::HTTP_OK,true);
|
||||
// echo 'Hi';
|
||||
}
|
||||
|
||||
|
||||
public function smcStuffs($pd_details,$existing_pd_details = array())
|
||||
{
|
||||
//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
|
||||
|
||||
// $pd_details['fk_lender_id'] = 35;
|
||||
// $addresses[0]['fk_city'] = 3374;
|
||||
$mwise_lender_id = (ENVIRONMENT == 'production' ? 7 : 35);
|
||||
|
||||
$is_mwise_lender = ( $pd_details['fk_lender_id'] == $mwise_lender_id ? true : false);
|
||||
// echo !$is_mwise_lender;
|
||||
if($is_mwise_lender && $pd_details['pd_status'] == TRIGGERED)
|
||||
{
|
||||
$regional_credit_manager = $this->PD_Model->getRCM($pd_details['fk_city']);//pass pd address city as param
|
||||
if(count($regional_credit_manager))
|
||||
{
|
||||
$pd_details['fk_pd_allocated_to'] = $regional_credit_manager[0]['userid'];
|
||||
$pd_details['pd_status'] = ALLOCATED;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR',('### Couldnot find RCM users - '.$pd_details['fk_city']));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if($is_mwise_lender && $pd_details['pd_status'] == BOUNCED)
|
||||
{
|
||||
//find current user role
|
||||
$this->load->model('User_Management_Model');
|
||||
$this->load->model('SMC_Credit_PD_Model');
|
||||
$user_details = $this->User_Management_Model->getUserDetails($createdby);
|
||||
if($user_details['data'][0]['user_role'] == 26)//Credit Manager
|
||||
{
|
||||
//get RCM and allocate to RCM
|
||||
$rcm = $this->SMC_Credit_PD_Model->getSMCFlowUsers($existing_pd_details[0]['fk_city'],27);
|
||||
if(count($rcm))
|
||||
{
|
||||
$pd_details['fk_pd_allocated_to'] = $rcm[0]['userid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR',('### Couldnot find RCM users in BOUNCED status - '.$existing_pd_details[0]['fk_city']));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if($user_details['data'][0]['user_role'] == 27)//Reg Credit Manager
|
||||
{
|
||||
|
||||
// //get CPA and allocate to CPA
|
||||
// $cpa = $this->SMC_Credit_PD_Model->getSMCFlowUsers($existing_pd_details[0]['fk_city'],25);
|
||||
// if(count($cpa))
|
||||
// {
|
||||
// $pd_details['fk_pd_allocated_to'] = $rcm[0]['userid'];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// log_message('ERROR',('### Couldnot find RCPACM users in BOUNCED status - '.$existing_pd_details[0]['fk_city']));
|
||||
// }
|
||||
|
||||
|
||||
//now allocated to pd triggered to user
|
||||
$pd_details['fk_pd_allocated_to'] = $existing_pd_details[0]['fk_createdby'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $pd_details;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1592,15 +1592,10 @@ public function filterSalesPDList_post() {
|
||||
public function getCMUsers_get()
|
||||
{
|
||||
$city = $this->get('city_id');
|
||||
$fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
||||
$table = USERPROFILE.' as USERPROFILE';
|
||||
$where_condition_array = array('USERPROFILE.fk_city' => $city);
|
||||
$joins = array(
|
||||
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>'USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = 26 and USERPROFILEROLES.isactive = 1' ,'jointype'=>'INNER JOIN')
|
||||
);
|
||||
|
||||
|
||||
$users = $this->SMC_Credit_PD_Model->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
||||
$usertype = $this->get('usertype');
|
||||
$role = '';
|
||||
if($usertype == 'RCM') { $role = 27; } else if($usertype == 'CM') { $role = 26; }
|
||||
$users = $this->SMC_Credit_PD_Model->getSMCFlowUsers($city,$role);
|
||||
if(count($users))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
|
||||
@ -60,7 +60,7 @@ class SMC_Credit_PD_Model extends SPARQ_Model {
|
||||
// print_r($master_forms);
|
||||
$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','SMC_CREDIT_PD_SECTION_DATA.is_reupload_data_fetched');
|
||||
$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','SMC_CREDIT_PD_SECTION_DATA.is_reupload_data_fetched','SMC_CREDIT_PD_FORMS.complete_check_enabled');
|
||||
$joins = array(
|
||||
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')
|
||||
@ -72,6 +72,21 @@ class SMC_Credit_PD_Model extends SPARQ_Model {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getSMCFlowUsers($city,$role)
|
||||
{
|
||||
$fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
||||
$table = USERPROFILE.' as USERPROFILE';
|
||||
$where_condition_array = array('USERPROFILE.fk_city' => $city);
|
||||
$joins = array(
|
||||
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>"USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = $role and USERPROFILEROLES.isactive = 1" ,'jointype'=>'INNER JOIN')
|
||||
);
|
||||
|
||||
|
||||
$users = $this->SMC_Credit_PD_Model->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
||||
// print_r($this->db->last_query());
|
||||
return $users;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user