SMC REQ & ROLE CUSTOM FILTERS

This commit is contained in:
Velz2020 2021-02-02 15:38:58 +05:30
parent 9ef45a0bfd
commit a3a32676af
6 changed files with 45 additions and 21 deletions

View File

@ -36,7 +36,7 @@ $config['api_user_auth_info'] = array(
//'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),
'allocatePD' => array(2,3,4,5,10,21,22,25,26,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),
'savePDPhotos' => array(3,4,5,6,7,10,21,22),

View File

@ -1337,13 +1337,13 @@ class Common_Masters_Controller extends REST_Controller {
if(isset($records['fk_pd_id']) && $records['fk_pd_id'] != '')
{
//update fk_pd_id in excel file list table
$fields_to_insert['fk_pd_id'] = $records['fk_pd_id'],
$fields_to_insert['fk_pd_id'] = $records['fk_pd_id'];
}
$is_bucket_upload_sucess = 1;
$id = $this->Common_Masters_Model->saveRecords($fields_to_insert,SMC_EXCEL_FILELIST);
if( !isset($records['fk_pd_id']))
if(!isset($records['fk_pd_id']))
{
//read excel file get trigger data
$result_data = readexceldata::getExcelSectionData($sourcefile);
@ -1360,7 +1360,7 @@ class Common_Masters_Controller extends REST_Controller {
$data['status'] = REST_Controller::HTTP_OK;
$data['msg'] = 'File Uploaded Successfully';
$data['excel_file_id'] = $id;
$data['records'] = $result_data;
$data['records'] = isset($result_data) ? $result_data : array();
$this->response($data,REST_Controller::HTTP_OK);
}
else

View File

@ -2060,18 +2060,41 @@ public function assignPDTempalate($data)
if($this->get('pdofficerid')) { $pdofficerid = $this->get('pdofficerid'); }
if($this->get('pdagencyid')) { $pdagencyid = $this->get('pdagencyid'); }
if($this->get('vendor_pdofficer')) { $vendor_pdofficer = $this->get('vendor_pdofficer'); }
if($this->get('createdby')) { $createdby = $this->get('createdby'); }
if($this->get('lenderid'))
{
$lenderid = $this->get('lenderid');
// $lender_details = $this->getLenderHierarchyForPDListing($lenderid);
$lender_details = array();
}
if($this->get('datetype')) { $datetype = $this->get('datetype'); }
if($this->get('fdate')) { $fdate = $this->get('fdate'); }
if($this->get('tdate')) { $tdate = $this->get('tdate'); }
if($this->get('status')) { $status = $this->get('status'); }
if($this->get('user_type')) { $user_type = $this->get('user_type'); }
//if lender id exists, then make custom filter for only SMC usage
if($this->get('createdby')) { $createdby = $this->get('createdby'); }
if($this->get('lenderid'))
{
$lenderid = $this->get('lenderid');
$smc_lender_id = ENVIRONMENT == 'production' ? 7 : 35; //pk id of SMC in live and demo
if($lenderid = $smc_lender_id)
{
$this->load->model('User_Management_Model');
$user_details = $this->User_Management_Model->getUserDetails($createdby);
if($user_details['data'][0]['user_role'] == 26)//Credit Manager
{
$pdofficerid = $createdby;
$createdby = '';
}
else if($user_details['data'][0]['user_role'] == 27)//Reg Credit Manager
{
$lender_details = array('city' => $user_details['data'][0]['fk_city']);
$createdby = '';
}
}
// $lender_details = $this->getLenderHierarchyForPDListing($lenderid);
}
// die();
$result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid,$vendor_pdofficer,$user_type,$createdby);
if($result_data['data_status'] == true)

View File

@ -1308,17 +1308,18 @@ public function filterSalesPDList_post() {
$records = $this->post('records');
$pd_master_data = $this->PD_Model->getPDMasterDetails($records['pd_id'],$records['random_string']);
$cur_section_data = array();
// print_r($pd_master_data);die();
// print_r( $pd_master_data);die();
// echo $records['form_id'];die();
//check excel file in local, otherwise get it from s3 and store locallly
$filename = XLPATH.'/tmp/'.$pd_master_data[0]['modified_fname'];
$filename = (!$pd_master_data[0]['re_uploaded'] ? XLPATH.'/tmp/'.$pd_master_data[0]['re_uploaded_file_name'] : XLPATH.'/tmp/'.$pd_master_data[0]['modified_fname']);
// $filename = XLPATH.'/tmp/mySMCPD_client_working.xlsx';
// $filename = 'C:\Users\Venba\Downloads\Kathir Info Pvt.xlsx';
// echo $filename;//die();
//echo $filename;die();
if(!file_exists($filename))
{
//echo 'getting it from s3';
// echo 'getting it from s3';
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_data[0]['fk_lender_id'];
$key = 'tmp/'. $pd_master_data[0]['modified_fname'];
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'+5 minutes');

File diff suppressed because one or more lines are too long

View File

@ -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');
$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');
$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')