PD QUES CHANGED

This commit is contained in:
velz 2018-09-25 14:46:40 +05:30
parent 2090086975
commit 2f2416d8ea
12 changed files with 480 additions and 75 deletions

View File

@ -89,7 +89,7 @@ $autoload['drivers'] = array();
| |
| $autoload['helper'] = array('url', 'file'); | $autoload['helper'] = array('url', 'file');
*/ */
$autoload['helper'] = array('url', 'form', 'jwt', "authorization", "date","mylog","myocr","mydb"); $autoload['helper'] = array('url', 'form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts');
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------

View File

@ -86,11 +86,31 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
// define login route name for token verification // define login route name for token verification
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfUsers'); // no errors defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'triggerNewPD'); // no errors
/*********************AWS resources Constants*************************************************/ /*********************AWS resources Constants*************************************************/
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');
/*********************AWS resources Constants*************************************************/ /*********************END of AWS resources Constants*************************************************/
/*******************Constants PD status*********************************/
defined('TRIGGERED') OR define('TRIGGERED','1'); //First time PD Trigger.
defined('ALLOCATED') OR define('ALLOCATED','2'); //PD Allocated to PD officer
defined('ACCEPTED') OR define('ACCEPTED','3'); // PD Accepted PD officer after Allocation
defined('BOUNCED') OR define('BOUNCED','4'); // PD Not accepted by PD Officer
defined('SCHEDULED') OR define('SCHEDULED','5'); //PD Scheduled by PD Officer
defined('INITIATED') OR define('INITIATED','6'); // PD Initiated or Ready to go a PD
defined('STARTED') OR define('STARTED','7'); // PD started by PD officer
defined('INPROGRESS') OR define('INPROGRESS','8'); // PD inprogress
defined('COMPLETED') OR define('COMPLETED','9'); // PD Completed
defined('QC_INPROGRESS') OR define('QC_INPROGRESS','10'); // QC_INPROGRESS
defined('QC_COMPLETED') OR define('QC_COMPLETED','11'); // QC_COMPLETED
defined('PD_REPORT_ACCEPTED') OR define('PD_REPORT_ACCEPTED','12'); //PD_REPORT_ACCEPTED by Lender
defined('PD_CHNAGE_REQUEST') OR define('PD_CHNAGE_REQUEST','13'); // From Lender side requesting change of PD report
defined('ALLOCATED_TO_PARTNER') OR define('ALLOCATED_TO_PARTNER','14'); // PD Allocated to PD agency not for PD officer
defined('ARCHIVED') OR define('ARCHIVED','15');
defined('CANCELLED') OR define('CANCELLED','16');
/*******************End Of Constants PD status**************************/
/*******************Define Constants for Table Names and Primarykeys**************************/ /*******************Define Constants for Table Names and Primarykeys**************************/
@ -141,7 +161,7 @@ defined('CITYID') OR define('CITYID','city_id');
defined('BRANCH') OR define('BRANCH','m_branch'); defined('BRANCH') OR define('BRANCH','m_branch');
defined('BRANCHID') OR define('BRANCHID','branch_id'); defined('BRANCHID') OR define('BRANCHID','branch_id');
defined('PDALLOCATIONTYPE') OR define('PDALLOCATIONTYPE','m_pd_allocation_type'); defined('PDALLOCATIONTYPE') OR define('PDALLOCATIONTYPE','c_pd_allocation_type');
defined('PDALLOCATIONTYPEID') OR define('PDALLOCATIONTYPEID','pd_allocation_type_id'); defined('PDALLOCATIONTYPEID') OR define('PDALLOCATIONTYPEID','pd_allocation_type_id');
defined('PDLOCATIONAPPROACH') OR define('PDLOCATIONAPPROACH','m_pd_location_approach'); defined('PDLOCATIONAPPROACH') OR define('PDLOCATIONAPPROACH','m_pd_location_approach');
@ -219,9 +239,23 @@ defined('PDTRIGGERID') OR define('PDTRIGGERID','pd_id');
defined('PDAPPLICANTSDETAILS') OR define('PDAPPLICANTSDETAILS','t_pd_co_applicants_details'); defined('PDAPPLICANTSDETAILS') OR define('PDAPPLICANTSDETAILS','t_pd_co_applicants_details');
defined('PDAPPLICANTSDETAILSID') OR define('PDAPPLICANTSDETAILSID','pd_co_applicant_id'); defined('PDAPPLICANTSDETAILSID') OR define('PDAPPLICANTSDETAILSID','pd_co_applicant_id');
defined('PDSTATUS') OR define('PDSTATUS','m_pd_status'); defined('PDSTATUS') OR define('PDSTATUS','c_pd_status');
defined('PDSTATUSID') OR define('PDSTATUSID','pd_status_id'); defined('PDSTATUSID') OR define('PDSTATUSID','pd_status_id');
defined('PDTEAM') OR define('PDTEAM','m_pdteam');
defined('PDTEAMID') OR define('PDTEAMID','pdteam_id');
defined('PDTEAMCITYMAP') OR define('PDTEAMCITYMAP','m_pdteam_city_mapping');
defined('PDTEAMCITYMAPID') OR define('PDTEAMCITYMAPID','pdteam_city_mapping_id');
defined('PDOFFICIERSDETAILS') OR define('PDOFFICIERSDETAILS','m_pd_officiers_details');
defined('PDOFFICIERSDETAILSID') OR define('PDOFFICIERSDETAILSID','pd_officier_id');
defined('PDNOTIFICATION') OR define('PDNOTIFICATION','m_pdnotification');
defined('PDNOTIFICATIONID') OR define('PDNOTIFICATIONID','pdnotification_id');
defined('PDDOCUMENTS') OR define('PDDOCUMENTS','t_pd_documents');
defined('PDDOCUMENTSID') OR define('PDDOCUMENTSID','pd_document_id');

View File

@ -87,7 +87,7 @@ $route['saveTemplateLenderDetails'] = 'Template_Management_Controller/saveTempla
$route['saveTemplateCategoryDetails'] = 'Template_Management_Controller/saveTemplateCategoryDetails'; $route['saveTemplateCategoryDetails'] = 'Template_Management_Controller/saveTemplateCategoryDetails';
//QUESTION MANAGEMENT //QUESTION MANAGEMENT
$route['listAllQuestions'] = 'Question_Management_Controller/listAllQuestions'; $route['(listAllQuestions/:any)'] = 'Question_Management_Controller/listAllQuestions/';
$route['saveNewQuestion'] = 'Question_Management_Controller/saveNewQuestion'; $route['saveNewQuestion'] = 'Question_Management_Controller/saveNewQuestion';
$route['saveExistQuestion'] = 'Question_Management_Controller/saveExistQuestion'; $route['saveExistQuestion'] = 'Question_Management_Controller/saveExistQuestion';

View File

@ -999,12 +999,9 @@ class Common_Masters_Controller extends REST_Controller {
public function saveMaster_post() public function saveMaster_post()
{ {
echo 'dfsf';
$records = $this->post('records'); $records = $this->post('records');
$table_name = $this->post('master_name'); $table_name = $this->post('master_name');
print_r($records);
//die();
if(false !== array_key_exists(constant($table_name.'ID'),$records)) //Update Record if(false !== array_key_exists(constant($table_name.'ID'),$records)) //Update Record
{ {
@ -1057,7 +1054,7 @@ class Common_Masters_Controller extends REST_Controller {
/* For Branch Listing */ /* For Branch Listing */
public function getListOfBranches_get(){ public function getListOfBranches_get(){
$columns = array('m_city.name as cityname','BRANCH.*'); $columns = array('m_city.name as city_name','BRANCH.*');
$table = BRANCH.' as BRANCH'; $table = BRANCH.' as BRANCH';
$joins = array( $joins = array(
array( array(

View File

@ -18,20 +18,297 @@ class PD_Controller extends REST_Controller {
// Construct the parent class // Construct the parent class
parent::__construct(); parent::__construct();
$this->load->model('PD_Model'); $this->load->model('PD_Model');
$this->load->library('AWS_S3');
} }
/***********************Get get List Of Lenders Details for PD Trigger Page************************/
public function getListOfLenders_get()
{
$fields = array('entity_id','full_name','short_name');
$where_condition_array = array('isactive' => 1,'fk_entity_type_id' => 2);
$result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENTITY);
if(count($result_data))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$this->response($data,REST_Controller::HTTP_OK);
}
}
/********************Get get List Of Products and SubProducts Name Details for PD Trigger Page*********/
public function getListOfProducts_get()
{
$fields = array('product_id','name as product_name','abbr as product_abbr');
$where_condition_array = array('isactive' => 1);
$result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PRODUCTS);
if(count($result_data))
{
foreach($result_data as $key => $product)
{
$fields = array('subproduct_id','name as subproduct_name','abbr as subproduct_abbr');
$where_condition_array = array('isactive' => 1,'fk_product_id' => $product['product_id']);
$subproducts = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,SUBPRODUCTS);
array_push($result_data[$key],$subproducts);
}
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$this->response($data,REST_Controller::HTTP_OK);
}
}
/********************Get get List Of CustomerSegments Details for PD Trigger Page*********/
public function getListOfCustomerSegments_get()
{
$fields = array('customer_segment_id','name as customer_segment','abbr');
$where_condition_array = array('isactive' => 1);
$result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,CUSTOMERSEGMENT);
if(count($result_data))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$this->response($data,REST_Controller::HTTP_OK);
}
}
/********************Get get List Of Both PD Allocation Types and PD Types Details for PD Trigger Page*********/
public function getListOfPDAllocationTypes_get()
{
$fields = array('pd_allocation_type_id','pd_allocation_type_name','pd_allocation_type_name','default');
$where_condition_array = array('isactive' => 1);
$result_data['pd_allocation_type'] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDALLOCATIONTYPE);
$fields1 = array('pd_type_id','type_name');
$where_condition_array1 = array('isactive' => 1);
$result_data['pd_type'] = $this->PD_Model->selectCustomRecords($fields1,$where_condition_array1,PDTYPE);
if(count($result_data))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$this->response($data,REST_Controller::HTTP_OK);
}
}
/********************Get get List Of States and Cities Name Details for PD Trigger Page*********/
public function getListOfStatesAndCities_get()
{
$fields = array('state_id','name as state_name','code');
$where_condition_array = array('isactive' => 1);
$result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,STATE);
if(count($result_data))
{
foreach($result_data as $key => $state)
{
$fields = array('city_id','name as city_name','abbr as subproduct_abbr');
$where_condition_array = array('isactive' => 1,'fk_state_id' => $state['fk_state_id']);
$cities = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,CITY);
array_push($result_data[$key],$cities);
}
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$this->response($data,REST_Controller::HTTP_OK);
}
}
/********For Save New PD while Trigger****/
public function triggerNewPD_post() public function triggerNewPD_post()
{ {
$pd_details = $this->post('pd_details');
$pd_applicant_details = $this->post('pd_applicant_details');
$count = 0;
$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();
if(!empty($_FILES['pddocuments']))
{
}
$count = 0;
/***********************CHOOSE PD TEMPALATE*********************/
$fields = array('fk_template_id');
$where_condition_array = array('fk_lender_id'=>1 ,'fk_product_id'=> 1,'fk_customer_segment'=> 1,'isactive' => 1);
$table = LENDERTEMPLATE;
$choosed_template_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table);
if(count($choosed_template_id))
{
$pd_details['fk_template_id'] = $choosed_template_id[0]['fk_template_id'];
}
/***********************PD ALLOCATION TYPE PROCESS **********/
$where_condition_array = array('fk_city_id' => $pd_details['fk_city']);
$temp_city_id = $this->PD_Model->selectRecords(PDTEAMCITYMAP,$where_condition_array,$limit=0,$offset=0);
if(count($temp_city_id))
{
if($temp_city_id[0]['type'] == 0) // Allocate to Vendor
{
$pd_details['pd_agency_id'] = $temp_city_id[0]['fk_team_id'];
$pd_details['fk_pd_allocated_to'] = ALLOCATED_TO_PARTNER;
}
else //Allocate to SineEdge Team with allocation logics
{
$local_pd_allocation_type = $pd_details['fk_pd_allocation_type'];
if($local_pd_allocation_type == 1)// AUTO - Load Balance Allocation
{
//1.select list pd officers from lender_pd offices map table and choose minimun allocated one
$fields = array('fk_user_id');
$where_condition_array = array('fk_lender_id'=>$pd_details['fk_lender_id'],'isactive' => 1);
$lender_specific_pdofficers_list = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS);
if(count($lender_specific_pdofficers_list))
{
//select currently allocated PD values from PDOFFICIERSDETAILS table to find min value
$lender_specific_pdofficer_list_and_allocated_values = $this->PD_Model->getLenderSpecificPDOfficersListAndAllocatedValues($lender_specific_pdofficers_list);
if(count($lender_specific_pdofficer_list_and_allocated_values))
{
$allocated_values = array_column($lender_specific_pdofficer_list_and_allocated_values,'allocated');
$min_allocated = min($allocated_values);
$key = array_search($min_allocated,$allocated_values);
$final_pd_officer_to_allocate = $lender_specific_pdofficer_list_and_allocated_values[$key]['fk_user_id'];
$pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate;
$pd_details['fk_pd_status'] = ALLOCATED;
}
}
else
{
//select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED
$fields = array('fk_user_id,allocated');
$where_condition_array = array('fk_pd_type_id' => $pd_details['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $pd_details['fk_customer_segment'],'fk_product_id' => $pd_details['fk_product_id'],'isactive' => 1);
$list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS);
$allocated_values = array_column($list_of_pd_officers,'allocated');
$min_allocated = min($allocated_values);
$key = array_search($min_allocated,$allocated_values);
$final_pd_officer_to_allocate = $list_of_pd_officers[$key]['fk_user_id'];
//For Random Allocaiton not in use
// $key = mt_rand(0, count($list_of_pd_officers) - 1);
// $final_pd_officer_to_allocate = isset($list_of_pd_officers[$key])? $list_of_pd_officers[$key]: null;
$pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate;
$pd_details['fk_pd_status'] = ALLOCATED;
}
}
else if($local_pd_allocation_type == 2) // AUTO - NEAREST Allocation
{
}
else // Manual Allocation
{
// Do nothing, cause fk_pd_allocated_to value comes from front end.
}
}
}
/***********************END OF PD ALLOCATION TYPE AND PROCESS***********/
$pd_id = $this->PD_Model->saveRecords(PDTRIGGER,$pd_details); $pd_id = $this->PD_Model->saveRecords(PDTRIGGER,$pd_details);
/***********************PD DOCUMENTS UPLOAD SECTION ***********/
if($pd_id != null || $pd_id != '') if($pd_id != null || $pd_id != '')
{ {
if(!empty($_FILES['pddocuments']))
{
foreach($_FILES['pddocuments'] as $key => $file)
{
$tempdoc = $file['pddocuments']['tmp_name'];
$tempdocname = $file['pddocuments']['name'];
$bucketname = $pd_details['fk_lender_id'].$pd_id;
$key = $pd_id ;
$sourcefile = $tempdoc;
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
$record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>$pd_document_titles[$key],'pd_document_name'=>$tempdocname);
$this->saveRecords($record_data,PDDOCUMENTS);
}
}
}
}
/***********************END OF PD DOCUMENTS UPLOAD SECTION ***********/
if($pd_id != null || $pd_id != '')
{
foreach($pd_applicant_details as $pd_applicant_detail) foreach($pd_applicant_details as $pd_applicant_detail)
{ {
$pd_applicant_detail['fk_pd_id'] = $pd_id; $pd_applicant_detail['fk_pd_id'] = $pd_id;
@ -43,8 +320,12 @@ class PD_Controller extends REST_Controller {
} }
} }
if($pd_id != null || $pd_id != '' && $count != 0) if($pd_id != null || $pd_id != '' && $count != 0)
{ {
// CALL pdnotification Helper function to send pd alerts @ params pdid,pdstatus
//PDALERTS::pdnotification($pd_id,$pd_details['fk_pd_status']);
$data['dataStatus'] = true; $data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK; $data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $template_id; $data['records'] = $template_id;

View File

@ -23,8 +23,13 @@ class Question_Management_Controller extends REST_Controller {
public function listAllQuestions_get() public function listAllQuestions_get()
{ {
$page = 0;$limit = 50;$sort = 'ASC';
$result = $this->User_Management_Model->$listAllQuestions(); if($this->get('page')) { $page = $this->get('page'); }
if($this->get('limit')){ $limit = $this->get('limit'); }
if($this->get('sort')) { $sort = $this->get('sort'); }
$result = $this->User_Management_Model->$listAllQuestions($page,$limit,$sort);
if($result['data_status']) if($result['data_status'])
{ {
$data['dataStatus'] = true; $data['dataStatus'] = true;
@ -40,47 +45,47 @@ class Question_Management_Controller extends REST_Controller {
} }
} }
public function saveNewQuestion_post()// Save Array of question and it's answers(Single too) public function saveNewQuestion_post()// Save single question and it's answers
{ {
$records = $this->post('records'); $records = $this->post('records');
$count = 0; $count = 0;
foreach($records as $record)
{
$answers = array(); $answers = array();
if(array_key_exists('answers',$record)) if(array_key_exists('answers',$records))
{ {
$answers = $record['answers']; $answers = $records['answers'];
unset($record['ansewrs']); unset($records['ansewrs']);
} }
$question_id = $this->db->saveRecords($record,QUESTIONS); $question_id = $this->db->saveRecords($records,QUESTIONS);
if($question_id != '' || $question_id != null) if($question_id != '' || $question_id != null)
{ {
$count++; //$count++;
foreach($answers as $answer) foreach($answers as $answer)
{ {
$temp_answers = array('fk_question_id' => $question_id, 'answer' =>$answer , 'createdon' =>$record['createdon'] , 'fk_createdby' =>$record['fk_createdby'] , 'updatedon' =>$record['updatedon'], 'fk_updatedby' =>$record['fk_updatedby']); $temp_answers = array('fk_question_id' => $question_id, 'answer' =>$answer , 'createdon' =>$records['createdon'] , 'fk_createdby' =>$records['fk_createdby']);
$this->db->saveRecords($temp_answers,QUESTIONANSWERS); $child_id = $this->db->saveRecords($temp_answers,QUESTIONANSWERS);
} }
} }
}
if($count != 0 && $count == count($records))
if($question_id != '' || $question_id != null)
{ {
$data['dataStatus'] = true; $data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK; $data['status'] = REST_Controller::HTTP_OK;
$data['record'] = $entity_id; $data['record'] = $question_id;
$this->response($data,REST_Controller::HTTP_OK); $this->response($data,REST_Controller::HTTP_OK);
} }
else else
{ {
$data['dataStatus'] = false; $data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED; $data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED); $this->response($data,REST_Controller::HTTP_OK);
} }
} }
@ -107,7 +112,7 @@ class Question_Management_Controller extends REST_Controller {
$affected_rows_child = $this->db->updateRecords($answer,QUESTIONANSWERS,$where_condtion_array); $affected_rows_child = $this->db->updateRecords($answer,QUESTIONANSWERS,$where_condtion_array);
} }
if($affected_rows == 1 && (count($answers) == $affected_rows_child)) if($affected_rows == 1) //&& (count($answers) == $affected_rows_child))
{ {
$data['dataStatus'] = true; $data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK; $data['status'] = REST_Controller::HTTP_OK;
@ -119,7 +124,7 @@ class Question_Management_Controller extends REST_Controller {
{ {
$data['dataStatus'] = false; $data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED; $data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED); $this->response($data,REST_Controller::HTTP_OK);
} }

View File

@ -18,7 +18,7 @@ class User_Management_Controller extends REST_Controller {
// Construct the parent class // Construct the parent class
parent::__construct(); parent::__construct();
$this->load->model('User_Management_Model'); $this->load->model('User_Management_Model');
$this->load->library('AWS_S3');
} }
public function listAllUsers_get() public function listAllUsers_get()
@ -44,13 +44,9 @@ class User_Management_Controller extends REST_Controller {
public function saveNewUser_post() public function saveNewUser_post()
{ {
$this->load->library('AWS_S3');
//print_r($this->post('roles'));die;
//print_r($this->post());die;
//print_r($_FILES['profilepic']['name']);die;
$roles = ""; $roles = "";
$lender_hierarchy = ""; $lender_hierarchy = "";
//print_r($this->post('roles'));die;
if($this->post('roles')){ $roles = $this->post('roles'); } if($this->post('roles')){ $roles = $this->post('roles'); }
if($this->post('lender_hierarchy')){ $lender_hierarchy = json_decode($this->post('lender_hierarchy'),true); } if($this->post('lender_hierarchy')){ $lender_hierarchy = json_decode($this->post('lender_hierarchy'),true); }
@ -191,7 +187,7 @@ class User_Management_Controller extends REST_Controller {
} }
} }
$bucketname = PROFILEPICTUREBUCKETNAME; $bucketname = PROFILE_PICTURE_BUCKET_NAME;
$key = $profilepics3path; $key = $profilepics3path;
$sourcefile = $profilepic; $sourcefile = $profilepic;
@ -276,4 +272,48 @@ class User_Management_Controller extends REST_Controller {
$this->response($data,REST_Controller::HTTP_NO_CONTENT); $this->response($data,REST_Controller::HTTP_NO_CONTENT);
} }
} }
/* Get Signed URL for profile picture
@params userid , entity id, profilepic name
URL expires 5 min
*/
public function getSingedProfilePicURL()
{
$userid = $this->post('userid');
$entityid = $this->post('entityid');
$profilepic = $this->post('profilepic');
$profilepics3path = '';
if($entityid == 1) //1 means sine_edge Profile
{
$profilepics3path = 'sineedge/'.$profilepic;
}
else if($entityid == 2)//1 means lender Profile
{
$profilepics3path = 'lender/'.$profilepic;
}
else // else or 3 means vendor Profile
{
$profilepics3path = 'vendor/'.$profilepic;
}
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI(PROFILE_PICTURE_BUCKET_NAME, $profilepics3path,'+5 minutes');
if($singed_uri != null || $singed_uri != '')
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $singed_uri;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'No Profile URL Available';
$this->response($data,REST_Controller::HTTP_OK);
}
}
} }

View File

@ -0,0 +1,39 @@
<?php
class PDALERTS
{
public static function pdnotification($pdid,$pdstatus)
{
if($pdid != "" || $pdid != null || $pdstatus != "" || $pdstatus != null)
{
$CI =&get_instance();
$mobile_nos_to_send_notification = array();
$email_ids_to_send_notification = array();
//$CI->db->insert($table_name,$record_data);
echo "FROM HELPER-PD_ID -" . $pdid;
//1.Get Notification Configuration by using pd staus idate
//$pd_notification_configs =
$CI->db->SELECT("PDNOTIFICATION.pdnotification_id, PDNOTIFICATION.fk_pd_status_id, PDSTATUS.pd_status_name,PDNOTIFICATION.sms_lender, PDNOTIFICATION.sms_pdofficer, PDNOTIFICATION.sms_pdincharge, PDNOTIFICATION.mail_lender, PDNOTIFICATION.mail_pdincharge, PDNOTIFICATION.mail_pdofficer");
$CI->db->FROM(PDNOTIFICATION." as PDNOTIFICATION");
$CI->db->JOIN(PDSTATUS." as PDSTATUS","PDNOTIFICATION.fk_pd_status_id = PDSTATUS.pd_status_id AND PDSTATUS.isactive = 1");
$CI->db->WHERE("PDNOTIFICATION.fk_pd_status_id = $pdstatus");
$pd_notification_configs = $CI->db->get()->result_array();
print_r($pd_notification_configs);
}
}
}
?>

View File

@ -25,12 +25,10 @@ class SPARQ_Model extends CI_Model {
} }
public function selectRecords($table_name,$where_condition_array = array(),$print_query = '',$limit = 50,$offset = 0,$order = 'ASC',$order_by_colum_name = '') public function selectRecords($table_name,$where_condition_array = array(),$limit = 50,$offset = 0,$order = 'ASC',$order_by_colum_name = '',$print_query = '')
{ {
$data = $this->db->order_by($order_by_colum_name,$order)->get_where($table_name,$where_condition_array,$limit,$offset)->result_array();//only AND condition $data = $this->db->order_by($order_by_colum_name,$order)->get_where($table_name,$where_condition_array,$limit,$offset)->result_array();//only AND condition
if($print_query == '1')
if($print_query == 1)
{ {
print_r($this->db->last_query()); print_r($this->db->last_query());
} }
@ -48,17 +46,15 @@ class SPARQ_Model extends CI_Model {
return $data; return $data;
} }
public function selectCustomRecords($fields = '', $where = array(), $or_where_total = array(),$table = '', $limit = '', $order_by_colum_name = '', $order_by = 'ASC', $group_by = '',$print_query = '') { public function selectCustomRecords($fields = '', $where_condition_array = array(),$table = '', $or_where_total = array(), $limit = '', $order_by_colum_name = '', $order_by = 'ASC', $group_by = '',$print_query = '') {
//$data = array();
if ($fields != '') { if ($fields != '') {
$this->db->select($fields); $this->db->select($fields);
} }
if (count($where)) { if (count($where_condition_array)) {
$this->db->where($where); $this->db->where($where_condition_array);
} }
if (count($or_where_total)) { if (count($or_where_total)) {

View File

@ -63,4 +63,13 @@ class PD_Model extends SPARQ_Model {
} }
} }
// get Lender Specific PDOfficers List And Currently Allocated PD Values form PDOFFICIERSDETAILS table
public function getLenderSpecificPDOfficersListAndAllocatedValues($lender_specific_pdofficers_list)
{
$this->db->SELECT('fk_user_id,allocated');
$this->db->FROM(PDOFFICIERSDETAILS);
$this->db->WHERE_IN('fk_user_id',$lender_specific_pdofficers_list);
$result = $this->db->get()->result_array();
}
} }

View File

@ -10,7 +10,7 @@ class Question_Management_Model extends SPARQ_Model {
} }
public function listAllQuestions() public function listAllQuestions($page,$limit,$sort)
{ {
@ -20,8 +20,10 @@ class Question_Management_Model extends SPARQ_Model {
$this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','QUESTIONS.fk_question_catagory = QUESTIONCATEGORY.question_categroy_id AND QUESTIONCATEGORY.isactive = 1'); $this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','QUESTIONS.fk_question_catagory = QUESTIONCATEGORY.question_categroy_id AND QUESTIONCATEGORY.isactive = 1');
$this->db->JOIN(USERPROFILE.' as USERPROFILE','QUESTIONS.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1'); $this->db->JOIN(USERPROFILE.' as USERPROFILE','QUESTIONS.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONS.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1'); $this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONS.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1');
$this->db->ORDER_BY('QUESTIONS.question_id',$sort);
$this->db->LIMIT($page,$limit);
$result = $this->db->get()->result_array(); $result = $this->db->GET()->result_array();
foreach($result as $key => $r) foreach($result as $key => $r)
{ {

View File

@ -33,29 +33,29 @@ class User_Management_Model extends SPARQ_Model {
$result = $this->db->get()->result_array(); $result = $this->db->get()->result_array();
foreach($result as $key => $pics) // foreach($result as $key => $pics)
{ // {
if($pics['profilepic'] != '' || $pics['profilepic'] != null) // if($pics['profilepic'] != '' || $pics['profilepic'] != null)
{ // {
$profilepics3path = ''; // $profilepics3path = '';
if($pics['fk_entity_id'] == 1) //1 means sine_edge Profile // if($pics['fk_entity_id'] == 1) //1 means sine_edge Profile
{ // {
$profilepics3path = 'sineedge/'.$pics['profilepic']; // $profilepics3path = 'sineedge/'.$pics['profilepic'];
} // }
else if($pics['fk_entity_id'] == 2)//1 means lender Profile // else if($pics['fk_entity_id'] == 2)//1 means lender Profile
{ // {
$profilepics3path = 'lender/'.$pics['profilepic']; // $profilepics3path = 'lender/'.$pics['profilepic'];
} // }
else // else or 3 means vendor Profile // else // else or 3 means vendor Profile
{ // {
$profilepics3path = 'vendor/'.$pics['profilepic']; // $profilepics3path = 'vendor/'.$pics['profilepic'];
} // }
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI(PROFILE_PICTURE_BUCKET_NAME, $profilepics3path,'+5 minutes'); // $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI(PROFILE_PICTURE_BUCKET_NAME, $profilepics3path,'+5 minutes');
$result[$key]['profilepic_singed_url'] = $singed_uri; // $result[$key]['profilepic_singed_url'] = $singed_uri;
} // }
} // }
if($result != '' ){ if($result != '' ){
@ -82,6 +82,8 @@ class User_Management_Model extends SPARQ_Model {
} }
public function getUserDetails($userid){ public function getUserDetails($userid){
$this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, concat(USERPROFILE.first_name," ", USERPROFILE.last_name) as user_full_name, USERPROFILE.email, USERPROFILE.alt_email, USERPROFILE.mobile_no, USERPROFILE.alt_mobile_no, USERPROFILE.addressline1, USERPROFILE.addressline2, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_designation,DESIGNATION.name, USERPROFILE.addressline3, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, USERPROFILE.pincode,USERPROFILEROLES.user_role_id,USERPROFILEROLES.user_role'); $this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, concat(USERPROFILE.first_name," ", USERPROFILE.last_name) as user_full_name, USERPROFILE.email, USERPROFILE.alt_email, USERPROFILE.mobile_no, USERPROFILE.alt_mobile_no, USERPROFILE.addressline1, USERPROFILE.addressline2, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_designation,DESIGNATION.name, USERPROFILE.addressline3, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, USERPROFILE.pincode,USERPROFILEROLES.user_role_id,USERPROFILEROLES.user_role');