SAVE CO IMG DELETE IMG INVESMENT

This commit is contained in:
Velz2020 2019-10-31 17:43:55 +05:30
parent ede9f95637
commit 434e9bcd04
3 changed files with 37 additions and 31 deletions

View File

@ -8775,7 +8775,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$records = $this->post('records'); $records = $this->post('records');
$pd_details = $this->PD_Model->getPDMasterDetails($records['fk_pd_id']); $pd_details = $this->PD_Model->getPDMasterDetails($records['fk_pd_id']);
//print_r($records);
// if(isset($records['isactive']) && ($records['isactive'] == 0 || $records['isactive'] == 1))//de activate the image // if(isset($records['isactive']) && ($records['isactive'] == 0 || $records['isactive'] == 1))//de activate the image
// { // {
// unset($records['image']); // unset($records['image']);
@ -8798,8 +8798,9 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
// } // }
// } // }
if(isset($records['image']) && ($records['image'] != '')) if(isset($records['image']) && ($records['image'] != '' && !substr_count($records['image'],'https')))
{ {
$output_file = APPPATH."/docs/temp_base64_image.jpeg"; $output_file = APPPATH."/docs/temp_base64_image.jpeg";
$temp_file_name = $records['pd_document_name']; $temp_file_name = $records['pd_document_name'];
@ -8821,6 +8822,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$record_data = array('fk_updatedby' => $records['fk_updatedby']); $record_data = array('fk_updatedby' => $records['fk_updatedby']);
if(isset($records['is_show_report'])){ $record_data['is_show_report'] = $records['is_show_report']; } if(isset($records['is_show_report'])){ $record_data['is_show_report'] = $records['is_show_report']; }
if(isset($records['pd_document_title'])){ $record_data['pd_document_title'] = $records['pd_document_title']; } if(isset($records['pd_document_title'])){ $record_data['pd_document_title'] = $records['pd_document_title']; }
if(isset($records['isactive'])){ $record_data['isactive'] = $records['isactive']; }
$where_condition_array = array('pd_document_id' => $records['pd_document_id']); $where_condition_array = array('pd_document_id' => $records['pd_document_id']);
$id = $this->PD_Model->updateRecords($record_data,PDDOCUMENTS,$where_condition_array); $id = $this->PD_Model->updateRecords($record_data,PDDOCUMENTS,$where_condition_array);
@ -9031,7 +9033,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$applicant_type = $records['is_applicant'] ? 0 : ($records['is_person_met'] ? 3 : ''); $applicant_type = $records['is_applicant'] ? 0 : ($records['is_person_met'] ? 3 : '');
$applicant_details = array('fk_pd_id' => $records['fk_pd_id'],'applicant_name' => $records['applicant_name'],'applicant_title_name' => $records['applicant_title_name'],'applicant_type' => $applicant_type ); $applicant_details = array('fk_pd_id' => $records['fk_pd_id'],'applicant_name' => $records['applicant_name'],'applicant_title_name' => $records['applicant_title_name'],'applicant_type' => $applicant_type );
//print_r($applicant_details); //print_r($applicant_details);
if($records['pd_co_applicant_id'] == " " || $records['pd_co_applicant_id'] == null) if($records['pd_co_applicant_id'] == "" || $records['pd_co_applicant_id'] == null)
{ {
$applicant_id = $this->PD_Model->saveRecords($applicant_details,PDAPPLICANTSDETAILS); $applicant_id = $this->PD_Model->saveRecords($applicant_details,PDAPPLICANTSDETAILS);
$current_operation = 1;// 1 means INSERT $current_operation = 1;// 1 means INSERT
@ -9061,16 +9063,19 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$img_data[] = array('Name' => ($records['applicant_name'].'-id_proof'), 'image' => $records['is_person_met_id_proof'], 'link' => $records['link'],'co_applicant_id' => $applicant_id,'img_type' => 2); $img_data[] = array('Name' => ($records['applicant_name'].'-id_proof'), 'image' => $records['is_person_met_id_proof'], 'link' => $records['link'],'co_applicant_id' => $applicant_id,'img_type' => 2);
} }
} }
//print_r( $img_data ); ///print_r( $img_data );
if($current_operation == 2) // Make inactive old entries with same data if($current_operation == 2)
{ {
$sql = 'UPDATE '. PDDOCUMENTS.' SET isactive = 0 where fk_pd_id = '.$records['fk_pd_id'].' WHERE co_applicant_id = '.$records['pd_co_applicant_id'];
$where1 = '';
$where2 = '';
if($records['is_person_met_pic'] != "" && !substr_count($records['is_person_met_pic'],'https')) if($records['is_person_met_pic'] != "" && !substr_count($records['is_person_met_pic'],'https'))
{ {
$img_data[] = array('Name' => $records['applicant_name'], 'image' => $records['is_person_met_pic'], 'link' => $records['link']); $img_data[] = array('Name' => $records['applicant_name'], 'image' => $records['is_person_met_pic'], 'link' => $records['link'],'co_applicant_id' => $records['pd_co_applicant_id'],'img_type' => 1);
$where1 = $records['applicant_name'];
// Make inactive old entries with same data
$sql = 'UPDATE '. PDDOCUMENTS.' SET isactive = 0 where fk_pd_id = '.$records['fk_pd_id'].' and co_applicant_id = '.$records['pd_co_applicant_id'] .' and img_type = 1';
$this->db->query($sql);
} }
else else
{ {
@ -9079,26 +9084,25 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
if($records['is_person_met_id_proof'] != "" && !substr_count($records['is_person_met_id_proof'],'https')) if($records['is_person_met_id_proof'] != "" && !substr_count($records['is_person_met_id_proof'],'https'))
{ {
$img_data[] = array('Name' => ($records['applicant_name'].'-id_proof'), 'image' => $records['is_person_met_id_proof'], 'link' => $records['link']); $img_data[] = array('Name' => ($records['applicant_name'].'-id_proof'), 'image' => $records['is_person_met_id_proof'], 'link' => $records['link'],'co_applicant_id' => $records['pd_co_applicant_id'],'img_type' => 2);
$where2 = ($records['applicant_name'].'-id_proof');
// Make inactive old entries with same data
$sql = 'UPDATE '. PDDOCUMENTS.' SET isactive = 0 where fk_pd_id = '.$records['fk_pd_id'].' and co_applicant_id = '.$records['pd_co_applicant_id'] .' img_type = 2';
$this->db->query($sql);
} }
else else
{ {
$this->PD_Model->updateRecords(array('pd_document_title' => ($records['applicant_name'].'-id_proof')),PDDOCUMENTS,array('fk_pd_id' => $records['fk_pd_id'],'fk_form_id' => 18,'co_applicant_id' => $records['pd_co_applicant_id'],'img_type' => 2,'isactive' => 1));// 2- person met ID proof img $this->PD_Model->updateRecords(array('pd_document_title' => ($records['applicant_name'].'-id_proof')),PDDOCUMENTS,array('fk_pd_id' => $records['fk_pd_id'],'fk_form_id' => 18,'co_applicant_id' => $records['pd_co_applicant_id'],'img_type' => 2,'isactive' => 1));// 2- person met ID proof img
} }
if($where1 != '' || $where2 != '')
{
$sql .= ' and (pd_document_title = ? or pd_document_title = ?)';
$this->db->query($sql, array($where1, $where2));
//print_r($this->db->last_query());
}
} }
if(count($img_data)) if(count($img_data))
{ {
$this->saveBase64Images($records['fk_pd_id'],18,null,null,$img_data); $d = $this->saveBase64Images($records['fk_pd_id'],18,null,null,$img_data);
//print_r($d);
} }
} }
@ -9107,14 +9111,16 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$lender_id = $this->PD_Model->selectCustomRecords(array('fk_lender_id'),array('pd_id' => $records['fk_pd_id']),PDTRIGGER); $lender_id = $this->PD_Model->selectCustomRecords(array('fk_lender_id'),array('pd_id' => $records['fk_pd_id']),PDTRIGGER);
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$lender_id[0]['fk_lender_id']; $bucket_name = LENDER_BUCKET_NAME_PREFIX.$lender_id[0]['fk_lender_id'];
$applicant_name = $this->PD_Model->selectCustomRecords(array('pd_document_name'),array('fk_pd_id' => $records['fk_pd_id'],'pd_document_title' => ($records['applicant_name']),'isactive' => 1),PDDOCUMENTS); $applicant_name = $this->PD_Model->selectCustomRecords(array('pd_document_name'),array('fk_pd_id' => $records['fk_pd_id'],'pd_document_title' => ($records['applicant_name']),'isactive' => 1,'co_applicant_id is not null' => null,'img_type' => 1),PDDOCUMENTS);
//print_r($this->db->last_query());
if(count($applicant_name)) if(count($applicant_name))
{ {
$profilepics3path = 'pd'.$records['fk_pd_id'].'/'.($applicant_name[0]['pd_document_name']); $profilepics3path = 'pd'.$records['fk_pd_id'].'/'.($applicant_name[0]['pd_document_name']);
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'30 minutes'); $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'30 minutes');
$is_person_met_pic = $singed_uri; $is_person_met_pic = $singed_uri;
} }
$applicant_name_id = $this->PD_Model->selectCustomRecords(array('pd_document_name'),array('fk_pd_id' => $records['fk_pd_id'],'pd_document_title' => ($records['applicant_name'].'-id_proof'),'isactive' => 1),PDDOCUMENTS); $applicant_name_id = $this->PD_Model->selectCustomRecords(array('pd_document_name'),array('fk_pd_id' => $records['fk_pd_id'],'pd_document_title' => ($records['applicant_name'].'-id_proof'),'isactive' => 1,'co_applicant_id is not null' =>null,'img_type' => 2),PDDOCUMENTS);
//print_r($this->db->last_query());
if(count($applicant_name_id)) if(count($applicant_name_id))
{ {
$profilepics3path = 'pd'.$records['fk_pd_id'].'/'.($applicant_name_id[0]['pd_document_name']); $profilepics3path = 'pd'.$records['fk_pd_id'].'/'.($applicant_name_id[0]['pd_document_name']);

View File

@ -37,27 +37,27 @@ public static function getOthersAssetsDetails($values){
// this is for investments type // this is for investments type
if($fetchVal['assets_mode']==7){ if($fetchVal['assets_mode']==7){
$storeValue['approximate_market_value'] = $fetchVal['details'][0]['amount_of_invest']; $storeValue['approximate_market_value'] = $fetchVal['details'][0]['amount_of_invest'];
switch($fetchVal['details'][0]['investments_type_master']) { switch($fetchVal['details'][0]['investments_type']) {
case 1: case 1:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['other_investments_type'].' with '.$fetchVal['details'][0]['in_which_organisation']; $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['other_investments_type'].' with '.$fetchVal['details'][0]['bank_name'];
break; break;
case 2: case 2:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name'];
break; break;
case 3: case 3:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name'];
break; break;
case 4: case 4:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name'];
break; break;
case 5: case 5:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name'];
break; break;
case 6: case 6:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name'];
break; break;
default: default:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name'];
} }

View File

@ -47,7 +47,7 @@ class AWS_COGNITO
$result = $this->client->adminSetUserPassword([ $result = $this->client->adminSetUserPassword([
'Password' => 'temp1234', // REQUIRED 'Password' => 'temp1234', // REQUIRED
'Permanent' => false, '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 'Username' => $user_name, // REQUIRED
]); ]);
print_r($result); print_r($result);