INLINE TO S3 COGNITO PRIVATE AND REPORT TOO

This commit is contained in:
Velz2020 2019-09-03 13:37:48 +05:30
parent dff6a8073e
commit f0b21f0b04
7 changed files with 168 additions and 29 deletions

View File

@ -2610,21 +2610,21 @@ public function getPDFormDetailsJSON_post()
}
$logger = MYLOG::logFunction(null,$pd_id);
$log_info_array['pdid'] = $pdid;
$log_info_array['pdid'] = $pd_id;
$log_info_array['formid'] = $pd_form_id;
$logger->info("GET FORM JSON FUNCTION CALLED - ENV (".ENVIRONMENT.")",$log_info_array);
if($pd_form_id == 18)
{
$fields = array('*');
$fields = array('json');
$where_condition_array = array('fk_pd_id' => $pd_id,'fk_form_id' =>$pd_form_id , 'isactive' => 1);
$form_count = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON);
//print_r($form_count);
if(!count($form_count))
{
//echo "dsjsbsdj";
$fields = array('json','processed_json');
$fields = array('json');
$where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$parent_pd_id);
$rec = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON);
@ -2641,12 +2641,12 @@ public function getPDFormDetailsJSON_post()
}
}
if($is_addtional_pd == 1 && $pd_form_id == 5)//address form && ($parent_pd_id != $pd_id)
{
$fields = array('*');
$fields = array('json');
$where_condition_array = array('fk_pd_id' => $pd_id,'fk_form_id' =>$pd_form_id , 'isactive' => 1);
$form_count = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON);
@ -2685,7 +2685,7 @@ public function getPDFormDetailsJSON_post()
}
$fields = array('json','processed_json');
$fields = array('json');
$where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id);
if($company_id != null)
@ -2693,8 +2693,96 @@ public function getPDFormDetailsJSON_post()
$where_condition_array = array('fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id,'company_id' => $company_id,'isactive' => 1);
}
$rec = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON);
//print_r($this->db->last_query());
// print_r($rec);
$temp_rec = json_decode($rec[0]['json'],true);
if(count($temp_rec))
{
$pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id);
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
if($pd_form_id == 18) //General form
{
$result_data = $this->PD_Model->getSignedPDDocsURL($pd_id,18,null,null,null);
foreach($temp_rec['individuals'] as $g_key => $g_value)
{
if($g_value['is_person_met'] == true)
{
if(count($result_data))
{
foreach($result_data as $img_key => $img_value)
{
if($g_value['applicant_name'] == $img_value['pd_document_title'])
{
$temp_rec['individuals'][$g_key]['is_person_met_pic'] = $img_value['doc_url'];
}
if(($g_value['applicant_name'].'-id_proof') == $img_value['pd_document_title'])
{
$temp_rec['individuals'][$g_key]['is_person_met_id_proof'] = $img_value['doc_url'];
}
}
}
}
}
}
if($pd_form_id == 13 ) //ABout Business form
{
$result_data = $this->PD_Model->getSignedPDDocsURL($pd_id,13,$company_id,null,null);
foreach($result_data as $b_key => $b_value)
{
if($b_value['pd_document_title'] == 'shop_eat_act_cert_pic')
{
$temp_rec['shop_eat_act_cert_pic'] = $b_value['doc_url'];
}
if($b_value['pd_document_title'] == 'gst_Regn_cert_pic')
{
$temp_rec['gst_Regn_cert_pic'] = $b_value['doc_url'];
}
if($b_value['pd_document_title'] == 'pf_regn_pic')
{
$temp_rec['pf_regn_pic'] = $b_value['doc_url'];
}
if($b_value['pd_document_title'] == 'esic_regn_pic')
{
$temp_rec['esic_regn_pic'] = $b_value['doc_url'];
}
if($b_value['pd_document_title'] == 'export_import_cert_pic')
{
$temp_rec['export_import_cert_pic'] = $b_value['doc_url'];
}
if($b_value['pd_document_title'] == 'factory_cert_pic')
{
$temp_rec['factory_cert_pic'] = $b_value['doc_url'];
}
if($b_value['pd_document_title'] == 'practice_cert_pic')
{
$temp_rec['practice_cert_pic'] = $b_value['doc_url'];
}
if(isset($temp_rec['documents']) && count($temp_rec['documents']))
{
foreach ($temp_rec['documents'] as $key => $value) {
if($value['document'] == $b_value['pd_document_title'])
{
$temp_rec['documents'][$key]['document_pic'] = $b_value['doc_url'];
}
}
}
}
// print_r($result_data);
}
}
$rec[0]['json'] = json_encode($temp_rec);
// print_r($rec);die();
// if(count($rec))
// {
// if($pd_form_id == 8 && $is_addtional_pd == 1)
@ -2736,6 +2824,7 @@ public function getPDFormDetailsJSON_post()
{
$json = json_decode($rec[0]['json']);
}
$logger->info("GET FORM JSON FUNCTION RESPONSE - ENV (".ENVIRONMENT.")",$log_info_array);
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
@ -5592,10 +5681,18 @@ public function getPDFormDetailsJSON_post()
//<body style="font-family:Merriweather;font-size:12px;margin:15px 30px">
// $sql = "SELECT email FROM sineedgeprod.m_user_profile where email like '%imgc%'";
// $u = $this->db->query($sql)->result_array();
// print_r($u);
// die();
// foreach($u as $v)
// {
// $this->aws_cognito->adminSetUserPassword($v['email']);
// }
// die();
//$this->aws_cognito->adminSetUserPassword('anuj.vaish@imgc.com');
//die();
$is_regenerate = 0;
if(isset($records['regenerate']))
{
@ -5664,7 +5761,7 @@ public function getPDFormDetailsJSON_post()
$data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC');
$fields2 = array('*');
$data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i);
$data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i,null,null,null,'report');
// $this->getPDImages_post``($fields2,array('fk_pd_id'=>$pdid,'fk_form_id' => $i),PDDOCUMENTS,array(),'','company_id','ASC');

View File

@ -16,12 +16,12 @@ class INLINEPHOTOTRANSFORM
if(isset($value['is_person_met_pic']) && $value['is_person_met_pic'] != "")
{
$base64 = self::addTimestampAndReturnBase64($CI,$value['is_person_met_pic'],$value['applicant_name'],$pd_details,18);
$records['individuals'][$key]['is_person_met_pic'] = $base64;
//$records['individuals'][$key]['is_person_met_pic'] = $base64;
}
if(isset($value['is_person_met_id_proof']) && $value['is_person_met_id_proof'] != "")
{
$base64 = self::addTimestampAndReturnBase64($CI,$value['is_person_met_id_proof'],($value['applicant_name'].'-id_proof'),$pd_details,18);
$records['individuals'][$key]['is_person_met_id_proof'] = $base64;
//$records['individuals'][$key]['is_person_met_id_proof'] = $base64;
}
}
}
@ -41,7 +41,7 @@ class INLINEPHOTOTRANSFORM
{
$base64 = self::addTimestampAndReturnBase64($CI,$records['shop_eat_act_cert_pic'],'shop_eat_act_cert_pic',$pd_details,13,$records['company_id'],$busienss_info_location);
$records['shop_eat_act_cert_pic'] = $base64;
// $records['shop_eat_act_cert_pic'] = $base64;
}
@ -50,7 +50,7 @@ class INLINEPHOTOTRANSFORM
{
$base64 = self::addTimestampAndReturnBase64($CI,$records['gst_Regn_cert_pic'],'gst_Regn_cert_pic',$pd_details,13,$records['company_id'],$busienss_info_location);
$records['gst_Regn_cert_pic'] = $base64;
//$records['gst_Regn_cert_pic'] = $base64;
}
@ -58,7 +58,7 @@ class INLINEPHOTOTRANSFORM
{
$base64 = self::addTimestampAndReturnBase64($CI,$records['pf_regn_pic'],'pf_regn_pic',$pd_details,13,$records['company_id'],$busienss_info_location);
$records['pf_regn_pic'] = $base64;
// $records['pf_regn_pic'] = $base64;
}
@ -67,7 +67,7 @@ class INLINEPHOTOTRANSFORM
{
$base64 = self::addTimestampAndReturnBase64($CI,$records['esic_regn_pic'],'esic_regn_pic',$pd_details,13,$records['company_id'],$busienss_info_location);
$records['esic_regn_pic'] = $base64;
//$records['esic_regn_pic'] = $base64;
}
@ -75,7 +75,7 @@ class INLINEPHOTOTRANSFORM
{
$base64 = self::addTimestampAndReturnBase64($CI,$records['export_import_cert_pic'],'export_import_cert_pic',$pd_details,13,$records['company_id'],$busienss_info_location);
$records['export_import_cert_pic'] = $base64;
//$records['export_import_cert_pic'] = $base64;
}
@ -84,7 +84,7 @@ class INLINEPHOTOTRANSFORM
{
$base64 = self::addTimestampAndReturnBase64($CI,$records['factory_cert_pic'],'factory_cert_pic',$pd_details,13,$records['company_id'],$busienss_info_location);
$records['factory_cert_pic'] = $base64;
//$records['factory_cert_pic'] = $base64;
}
@ -92,7 +92,7 @@ class INLINEPHOTOTRANSFORM
{
$base64 = self::addTimestampAndReturnBase64($CI,$records['practice_cert_pic'],'practice_cert_pic',$pd_details,13,$records['company_id'],$busienss_info_location);
$records['practice_cert_pic'] = $base64;
//$records['practice_cert_pic'] = $base64;
}
@ -100,7 +100,7 @@ class INLINEPHOTOTRANSFORM
{
$base64 = self::addTimestampAndReturnBase64($CI,$records['fire_noc_pic'],'fire_noc_pic',$pd_details,13,$records['company_id'],$busienss_info_location);
$records['fire_noc_pic'] = $base64;
//$records['fire_noc_pic'] = $base64;
}
@ -111,7 +111,7 @@ class INLINEPHOTOTRANSFORM
if($value['document_pic'] != '')
{
$base64 = self::addTimestampAndReturnBase64($CI,$value['document_pic'],$value['document'],$pd_details,13,$records['company_id'],$busienss_info_location);
$records['documents'][$key]['document_pic'] = $base64;
//$records['documents'][$key]['document_pic'] = $base64;
}
}

View File

@ -47,7 +47,7 @@ class AWS_COGNITO
$result = $this->client->adminSetUserPassword([
'Password' => 'temp1234', // REQUIRED
'Permanent' => false,
'UserPoolId' => $this->CI->config->item('sine_egde_pool_id'), // REQUIRED
'UserPoolId' => $this->CI->config->item('lender_pool_id'), // REQUIRED
'Username' => $user_name, // REQUIRED
]);
print_r($result);

View File

@ -47,7 +47,7 @@ class AWS_S3
{
try {
$result = $this->S3->createBucket(['ACL' => 'authenticated-read','Bucket' => $BUCKET_NAME]);
$result = $this->S3->createBucket(['ACL' => 'private','Bucket' => $BUCKET_NAME]);
return $result;
} catch (AwsException $e) {
@ -69,7 +69,7 @@ class AWS_S3
'SourceFile' => $data['sourcefile'],
'ContentType' => '*/*',
'StorageClass' => 'STANDARD',
'ACL'=>'authenticated-read'
'ACL'=>'private'
]);
} catch (AwsException $e)

View File

@ -290,6 +290,11 @@ class PD_Model extends SPARQ_Model {
{
$where_condition_array['company_id'] = null ;
$where_condition_array['fk_form_id'] = null ;
}
$time = '+2 day';
if($api_client = 'report')
{
$time = '+5 day';
}
//print_r($where_condition_array);die();
$document_lists = $this->selectRecords(PDDOCUMENTS,$where_condition_array);
@ -303,7 +308,7 @@ class PD_Model extends SPARQ_Model {
{
$profilepics3path = 'pd'.$pdid.'/'.$value['pd_document_name'];
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'+2 day');
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,$time);
$document_lists[$key]['doc_url'] = $singed_uri;
}

View File

@ -549,8 +549,19 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "Not Available" ;
//echo '<br>'.$individual['applicant_title_name_master'] .' '. $applicant_name.'<br>' ;
$temp_person_met['name'] = $individual['applicant_title_name_master'] .' '. $applicant_name;
$temp_person_met['photo'] = isset($individual['is_person_met_pic']) ? $individual['is_person_met_pic'] : null;
$temp_person_met['id_proof'] = isset($individual['is_person_met_id_proof']) ? $individual['is_person_met_id_proof'] : null;
$temp_person_met['photo'] = '';
$temp_person_met['id_proof'] = '';
foreach($pd_images[18] as $pm_Key => $pm_value)
{
if($applicant_name == $pm_value['pd_document_title'] )
{
$temp_person_met['photo'] = $pm_value['doc_url'] ;
}
if(($applicant_name.'-id_proof') == $pm_value['pd_document_title'])
{
$temp_person_met['id_proof'] = $pm_value['doc_url'] ;
}
}
$company_relationship_data = null;
foreach($general_form['company_with_relationships'] as $company_with_relationship)
{
@ -1400,6 +1411,21 @@ defined('BASEPATH') OR exit('No direct script access allowed');
array_push($getDocuments,array('name' => $docValue['document'].'.', 'img' => isset( $docValue['document_pic']) ? $docValue['document_pic'] : ''));
}
}
if(count($getDocuments))
{
foreach($getDocuments as $getDocument_key => $getDocument_value)
{
foreach($pd_images[13] as $img_key => $img_value)
{
if( $getDocument_value['name'] == $img_value['pd_document_title'] )
{
$getDocuments[$getDocument_key]['img'] = $img_value['doc_url'];
break;
}
}
}
}
$bindEachResult['visit_documents']=$getDocuments;
array_push($businessResult,$bindEachResult);

View File

@ -549,8 +549,19 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "Not Available" ;
//echo '<br>'.$individual['applicant_title_name_master'] .' '. $applicant_name.'<br>' ;
$temp_person_met['name'] = $individual['applicant_title_name_master'] .' '. $applicant_name;
$temp_person_met['photo'] = isset($individual['is_person_met_pic']) ? $individual['is_person_met_pic'] : null;
$temp_person_met['id_proof'] = isset($individual['is_person_met_id_proof']) ? $individual['is_person_met_id_proof'] : null;
$temp_person_met['photo'] = '';
$temp_person_met['id_proof'] = '';
foreach($pd_images[18] as $pm_Key => $pm_value)
{
if($applicant_name == $pm_value['pd_document_title'] )
{
$temp_person_met['photo'] = $pm_value['doc_url'] ;
}
if(($applicant_name.'-id_proof') == $pm_value['pd_document_title'])
{
$temp_person_met['id_proof'] = $pm_value['doc_url'] ;
}
}
$company_relationship_data = null;
foreach($general_form['company_with_relationships'] as $company_with_relationship)
{