renamingExistingPDinfo : ps
This commit is contained in:
parent
ec371ee5e2
commit
df8c0354be
@ -95,6 +95,7 @@ defined('ROUTE_LOGIN_W') OR define('ROUTE_LOGIN_W', 'saveSalesPDImage');
|
||||
defined('ROUTE_LOGIN_V') OR define('ROUTE_LOGIN_V', 'generateSatelliteImg'); // no errors
|
||||
defined('ROUTE_LOGIN_U') OR define('ROUTE_LOGIN_U', 'generateOTP');
|
||||
defined('ROUTE_LOGIN_T') OR define('ROUTE_LOGIN_T', 'verifyOTP');
|
||||
defined('ROUTE_LOGIN_S') OR define('ROUTE_LOGIN_S', 'renamingExistingPDinfo');
|
||||
defined('ROUTE_LOGIN_F') OR define('ROUTE_LOGIN_F', 'previewDigiLockerDocs');
|
||||
// defined('ROUTE_LOGIN_F') OR define('ROUTE_LOGIN_F', 'downloadDigiLockerDocs');
|
||||
defined('ROUTE_LOGIN_E') OR define('ROUTE_LOGIN_E', 'getDigiLockerDocs');
|
||||
|
||||
@ -399,4 +399,4 @@ $route['smcPhotoPDFDownload'] = 'SMC_Credit_PD_Controller/imgPDFDownload';
|
||||
$route['myFunction']='Flyhi_Controller/myFunction';
|
||||
$route['previewDigiLockerDocs']='Flyhi_Controller/previewDigiLockerDocs';
|
||||
|
||||
$route['renamingExistingPDinfo']='Data_Dump_Controller/renamingExistingPDinfo';
|
||||
$route['purgePDdata']='Data_Dump_Controller/renamingExistingPDinfo';
|
||||
@ -581,47 +581,59 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
public function renamingExistingPDinfo_get(){
|
||||
log_message('ERROR',"renamingExistingPDinfo Called");
|
||||
log_message('ERROR',"renamingExistingPDinfo Fns Called");
|
||||
$_90th_date = date("Y/m/d",strtotime('-90 days'));
|
||||
log_message('ERROR',"90th date => ".$_90th_date);
|
||||
$pdsno = $this->get('pdsno');
|
||||
|
||||
$pdid_arr = array();// testing purpose
|
||||
$columns = array('PDTRIGGER.pd_id','PDTRIGGER.addressline1','PDTRIGGER.addressline2','PDTRIGGER.addressline3','PDTRIGGER.pd_contact_mobileno','PDTRIGGER.pd_contact_landline','PDTRIGGER.pd_sno','DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") as createdon','PDAPPLICANTSDETAILS.pd_co_applicant_id','PDTRIGGER.pd_contact_person_mail','PDTRIGGER.fk_lender_id');
|
||||
$table = PDTRIGGER.' as PDTRIGGER';
|
||||
$joins = array(array('table' => PDAPPLICANTSDETAILS. ' as PDAPPLICANTSDETAILS',
|
||||
'condition' =>'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1',
|
||||
'jointype' => 'LEFT'));
|
||||
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED ,'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") <=' => $_90th_date);
|
||||
// 'PDTRIGGER.fk_customer_segment'=> 11 // 1 4 5 8 9 10 11
|
||||
log_message('ERROR',"trigger details count ".count($tgr_cond_arr));
|
||||
if(!empty($pdsno)){
|
||||
log_message('ERROR',"PD Serial No => ".$pdsno);
|
||||
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED ,'PDTRIGGER.pd_sno' => $pdsno );
|
||||
}else{
|
||||
log_message('ERROR',"90th date => ".$_90th_date);
|
||||
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED ,'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") <=' => $_90th_date);
|
||||
}
|
||||
|
||||
// 'PDTRIGGER.fk_customer_segment'=> 11 // 1 4 5 8 9 10 11
|
||||
log_message('ERROR',"trigger details Total count ".count($tgr_cond_arr));
|
||||
$tgr_dtls = $this->PD_Model->getJoinRecords($columns,$table,$joins,$tgr_cond_arr);
|
||||
// $i = 0; // testing Purpose only
|
||||
// for($i = 0 ;$i < 3;$i++){ // testing purpose only.
|
||||
for($i = 0 ;$i < count($tgr_dtls);$i++){
|
||||
$pdid = $tgr_dtls[$i]['pd_id'];
|
||||
log_message('ERROR',"trigger details for Loop inx = ".$i." PDID = ".$pdid);
|
||||
$earliest['trigger_details'] = $tgr_dtls[$i] ;
|
||||
if(!empty($pdid)){
|
||||
$apcnt_fields = array('pd_co_applicant_id', 'mobile_no', 'additional_mobile_no', 'landline', 'email', 'addressline1', 'addressline2', 'addressline3', 'company_name','applicant_name');
|
||||
$apcnt_cond_arr = array('isactive' => 1,'fk_pd_id'=>$pdid);
|
||||
$apcnt_dtls = $this->PD_Model->selectCustomRecords($apcnt_fields,$apcnt_cond_arr,PDAPPLICANTSDETAILS);
|
||||
log_message('ERROR',"Total Applicant Details for ".$pdid." = ".count($apcnt_dtls));
|
||||
if(!empty($apcnt_dtls)){
|
||||
$earliest['applicant_details'] = $apcnt_dtls;
|
||||
}
|
||||
$addr_fields = array('pd_address_id', 'addressline1');
|
||||
$addr_cond_arr = array('isactive' => 1,'fk_pd_id'=>$pdid);
|
||||
$addr_dtls = $this->PD_Model->selectCustomRecords($addr_fields,$addr_cond_arr,PDADDRESS);
|
||||
log_message('ERROR',"Total Address Details for ".$pdid." = ".count($addr_dtls));
|
||||
if(!empty($addr_dtls)){
|
||||
$earliest['address_details'] = $addr_dtls;
|
||||
}
|
||||
$json_fields = array('pd_form_detail_json_id','json','processed_json','fk_pd_id', 'fk_form_id');
|
||||
$json_cond_arr = array('isactive' => 1,'fk_pd_id'=>$pdid);
|
||||
$json_dtls = $this->PD_Model->selectCustomRecords($json_fields,$json_cond_arr,PDFORMDETAILSJSON);
|
||||
log_message('ERROR',"Total JSON Details for ".$pdid." = ".count($json_dtls));
|
||||
if(!empty($json_dtls)){
|
||||
$earliest['json_details'] = $json_dtls;
|
||||
}
|
||||
$previous_json_fields = array('pd_form_detail_json_id');
|
||||
$previous_json_cond_arr = array('isactive' => 0,'fk_pd_id'=>$pdid);
|
||||
$previous_json_dtls = $this->PD_Model->selectCustomRecords($previous_json_fields,$previous_json_cond_arr,PDFORMDETAILSJSON);
|
||||
log_message('ERROR',"Total IN-Active JSON Details for ".$pdid." = ".count($previous_json_dtls));
|
||||
if(!empty($previous_json_dtls)){
|
||||
foreach($previous_json_dtls as $val) {
|
||||
$result[] = $val['pd_form_detail_json_id'];
|
||||
@ -633,6 +645,7 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
$docs_fields = array('pd_document_id', 'pd_document_title', 'pd_document_name');
|
||||
$docs_cond_arr = array('isactive' => 1,'fk_pd_id'=>$pdid);
|
||||
$docs_dtls = $this->PD_Model->selectCustomRecords($docs_fields,$docs_cond_arr,PDDOCUMENTS);
|
||||
log_message('ERROR',"Total Document Details for ".$pdid." = ".count($docs_dtls));
|
||||
if(!empty($docs_dtls)){
|
||||
$earliest['docs_details'] = $docs_dtls;
|
||||
}
|
||||
@ -641,12 +654,13 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
$return = $this->renamingProcess($earliest);
|
||||
array_push($pdid_arr['updated pdid'],$return);
|
||||
array_push($pdid_arr['data'],$earliest);
|
||||
} // undo the command
|
||||
|
||||
// if(!empty($return)){
|
||||
// array_push($pdid_arr['updated pdid'],$return);
|
||||
// array_push($pdid_arr['data'],$earliest);}
|
||||
}
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['arr'] = $pdid_arr;
|
||||
// $data['earliest'] = $earliest;
|
||||
// $data['totalDetailsInCount'] =count($tgr_dtls);
|
||||
// $data['before 90 days data'] = $tgr_dtls;
|
||||
@ -654,15 +668,15 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
public function renamingProcess($details){
|
||||
|
||||
log_message('ERROR',"renamingProcess Fns Called");
|
||||
$have_to_replace = array();
|
||||
|
||||
$tgr_dtls = $details['trigger_details'] ;
|
||||
$apcnt_dtls = $details['applicant_details'];
|
||||
$tgr_dtls = isset($details['trigger_details']) ? $details['trigger_details'] : array(); ;
|
||||
$apcnt_dtls = isset($details['applicant_details']) ? $details['applicant_details'] : array();
|
||||
//print_r($apcnt_dtls);die();
|
||||
$addr_dtls = $details['address_details'];
|
||||
$json_dtls = $details['json_details'];
|
||||
$docs_dtls = $details['docs_details'];
|
||||
$addr_dtls = isset($details['address_details']) ? $details['address_details'] : array();
|
||||
$json_dtls = isset($details['json_details']) ? $details['json_details'] : array();
|
||||
$docs_dtls = isset($details['docs_details']) ? $details['docs_details'] : array();
|
||||
|
||||
$pdid = $tgr_dtls['pd_id'];
|
||||
$pdsno = $tgr_dtls['pd_sno'];
|
||||
@ -670,7 +684,7 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
|
||||
$pdappcntid = $tgr_dtls['pd_co_applicant_id'];
|
||||
$general_format = $pdsno."-".$pdid."-".$pdappcntid;
|
||||
|
||||
log_message('ERROR',"Format generated => ".$general_format);
|
||||
|
||||
if(!empty($tgr_dtls)){
|
||||
if($tgr_dtls['addressline1']){
|
||||
@ -749,7 +763,9 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
$have_to_replace[$apcnt_dtls[$j]['company_name']] = $appcnt_id.'-company_name';
|
||||
}else{ $updt_apcnt_dtls['company_name'] = null ; }
|
||||
|
||||
$this->PD_Model->updateRecords($updt_apcnt_dtls,PDAPPLICANTSDETAILS,array('pd_co_applicant_id' => $apcnt_dtls[$j]['pd_co_applicant_id']));
|
||||
$apcnt_result = $this->PD_Model->updateRecords($updt_apcnt_dtls,PDAPPLICANTSDETAILS,array('pd_co_applicant_id' => $apcnt_dtls[$j]['pd_co_applicant_id']));
|
||||
if($apcnt_result){ log_message('ERROR',"applicant updated => ".$apcnt_dtls[$j]['pd_co_applicant_id']." Updated successfully ( ".($j+1)." )");}
|
||||
else{ log_message('ERROR',"Check here Applicant Not updated ( ".($j+1)." ) pkid = ".$apcnt_dtls[$j]['pd_co_applicant_id']); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -762,7 +778,9 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
}else{
|
||||
$updt_addr_dtls['addressline1'] = null ;
|
||||
}
|
||||
$this->PD_Model->updateRecords($updt_addr_dtls,PDADDRESS,array('pd_address_id' => $addr_dtls[$k]['pd_address_id']));
|
||||
$addr_result = $this->PD_Model->updateRecords($updt_addr_dtls,PDADDRESS,array('pd_address_id' => $addr_dtls[$k]['pd_address_id']));
|
||||
if($addr_result){ log_message('ERROR',"address updated => ".$addr_dtls[$k]['pd_address_id']." Updated successfully ( ".($k+1)." )");}
|
||||
else{ log_message('ERROR',"Check here Adress table Not updated ( ".($k+1)." ) pkid = ".$addr_dtls[$k]['pd_address_id']); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -770,6 +788,10 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
|
||||
for($l = 0 ;$l < count($json_dtls);$l++){
|
||||
$fid = $json_dtls[$l]['fk_form_id'];
|
||||
$fields = array('pd_form_name');
|
||||
$where_condition_array = array("pd_form_id"=>$fid);
|
||||
$form_table = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMS);
|
||||
$form_name = count($form_table)>0 ? $form_table[0]['pd_form_name'] : '';
|
||||
// echo count($json_dtls);
|
||||
// pd_form_detail_json_id, fk_pd_id, fk_form_id, company_id, isactive, json, processed_json,
|
||||
$original_j_arr = json_decode($json_dtls[$l]['json'],true);
|
||||
@ -863,7 +885,9 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
// traverseArray(&$array, $keys)
|
||||
$update_json_arr['json'] = json_encode($replaced_j_arr);
|
||||
$update_json_arr['processed_json'] = json_encode($replaced_pj_arr);
|
||||
$this->PD_Model->updateRecords($update_json_arr,PDFORMDETAILSJSON,array('pd_form_detail_json_id' => $json_dtls[$l]['pd_form_detail_json_id'] ));
|
||||
$json_result =$this->PD_Model->updateRecords($update_json_arr,PDFORMDETAILSJSON,array('pd_form_detail_json_id' => $json_dtls[$l]['pd_form_detail_json_id'] ));
|
||||
if($json_result){ log_message('ERROR',"JSON updated => ".$form_name." Updated successfully ( ".($l+1)." ) json table id = ".$json_dtls[$l]['pd_form_detail_json_id']);}
|
||||
else{ log_message('ERROR',"Check here JSON Not updated ".$form_name." ( ".($l+1)." ) json table id = ".$json_dtls[$l]['pd_form_detail_json_id']); }
|
||||
// $data['have_to_replace_this'] = $have_to_replace;
|
||||
// $data['replaced_pj_array'] = $replaced_pj_arr;
|
||||
// $data['original_pj_array'] = $original_pj_arr;
|
||||
@ -874,19 +898,26 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
// $earliest['docs_details'] = $docs_dtls;
|
||||
if(!empty($doc_dtls)){
|
||||
for($m = 0 ;$m < count($doc_dtls);$m++){
|
||||
log_message('ERROR',"Document ".$doc_dtls[$m]['pd_document_name'] );
|
||||
$docname = $doc_dtls[$m]['pd_document_name'];
|
||||
$destination_path = $this->external_path."/pd_reports/". $pdid ."/".$docname;
|
||||
// unlink($destination_path);
|
||||
unlink($destination_path);
|
||||
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pdlenid;
|
||||
$key = 'pd'.$pdid.'/'.$docname;
|
||||
// $s3result= $this->aws_s3->deleteSingleObjFromBucket($bucketname,$key);
|
||||
// if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
// {}
|
||||
$s3result= $this->aws_s3->deleteSingleObjFromBucket($bucketname,$key);
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
log_message('ERROR',"s3result ".$s3result['@metadata']['statusCode'] );
|
||||
}
|
||||
else{ log_message('ERROR',"Check here Not updated on S3 result ".$s3result['@metadata']['statusCode'] ); }
|
||||
|
||||
}
|
||||
}
|
||||
$updt_tgr_where = array('pd_id' => $pdid,'pd_status' => QC_COMPLETED);
|
||||
$this->PD_Model->updateRecords($updt_on_tgr,PDTRIGGER,$updt_tgr_where);
|
||||
$trg_result = $this->PD_Model->updateRecords($updt_on_tgr,PDTRIGGER,$updt_tgr_where);
|
||||
if($trg_result){ log_message('ERROR',"Trigger table updated pdid => ".$pdid." Updated successfully ");}
|
||||
else{ log_message('ERROR',"Check here Trigger table Not updated pdid = ".$pdid); }
|
||||
return $pdid;
|
||||
// $data['pdid'] = $pdid ;
|
||||
// $this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
@ -72,7 +72,7 @@ class AUTHORIZATION
|
||||
}
|
||||
|
||||
|
||||
if( $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y || $routingName == ROUTE_LOGIN_Z || $routingName == ROUTE_LOGIN_W || $routingName == ROUTE_LOGIN_V || $routingName == ROUTE_LOGIN_A || $routingName == TURN_SERVER_API || $routingName == VIDEO_CHAT_ACCESS_KEY_API || $routingName ==SAVEROOMINFO_API || $routingName ==SAVESMCCREDITPDIMAGE_API || $routingName ==GETSMCPDIMGSECTIONDATA_API || $routingName == ROUTE_LOGIN_T || $routingName == ROUTE_LOGIN_U || $routingName == ROUTE_LOGIN_B || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F)
|
||||
if( $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y || $routingName == ROUTE_LOGIN_Z || $routingName == ROUTE_LOGIN_W || $routingName == ROUTE_LOGIN_V || $routingName == ROUTE_LOGIN_A || $routingName == TURN_SERVER_API || $routingName == VIDEO_CHAT_ACCESS_KEY_API || $routingName ==SAVEROOMINFO_API || $routingName ==SAVESMCCREDITPDIMAGE_API || $routingName ==GETSMCPDIMGSECTIONDATA_API || $routingName == ROUTE_LOGIN_T || $routingName == ROUTE_LOGIN_U || $routingName == ROUTE_LOGIN_B || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F || $routingName == ROUTE_LOGIN_S)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user