CLIX RE CHANGE AND GEN FORM BASE64 SEPERATE

This commit is contained in:
Velz2020 2019-09-12 17:41:00 +05:30
parent c2c05f44c0
commit 6cc57869e7
4 changed files with 139 additions and 32 deletions

View File

@ -219,7 +219,7 @@ $route['getPDScore'] = 'PD_Controller/getPDScoreForDisplay';
$route['savePDRemark'] = 'PD_Controller/savePDRemark';
$route['savePDDocsToBeCollected'] = 'PD_Controller/savePDDocsToBeCollected';
$route['getLenderContactPersons'] = 'PD_Controller/getLenderContactPersons';
// $route['savePDFormDetailsJSON'] = 'PD_Controller/savePDFormDetailsJSON';
$route['saveApplicantFromGeneralForm'] = 'PD_Controller/saveApplicantFromGeneralForm';
// $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON';
$route['smartyTestFunction'] = 'PD_Controller/smartyTestFunction';

View File

@ -2359,7 +2359,7 @@ public function assignPDTempalate($data)
public function savePDFormDetailsJSON_post()
{
//ini_set('max_execution_time', 60);
$this->load->helper('INLINEPHOTOTRANSFORM');
//$this->load->helper('INLINEPHOTOTRANSFORM');
$records = $this->post('records');
$pdid = $records['pdid'];
$formid = $records['formid'];
@ -2368,7 +2368,7 @@ public function assignPDTempalate($data)
$processed_json = null;
$rental_count_id = isset($records['rental_count_id']) ? $records['rental_count_id'] : null;
//print_r($records);die();
$parent_pdid = $records['parent_pdid'];;
$parent_pdid = $records['parent_pdid'];
$parent_form_index = null;
$parent_forms = $this->config->item('parent_forms');
$additional_pd_id = $pdid;
@ -2376,9 +2376,10 @@ public function assignPDTempalate($data)
$logger = MYLOG::logFunction(null,$pdid);
$log_info_array['pdid'] = $pdid;
$log_info_array['formid'] = $formid;
$log_info_array['payload_size'] = (int) $_SERVER['CONTENT_LENGTH'];
$logger->info("SAVE FORM JSON FUNCTION CALLED - ENV (".ENVIRONMENT.")",$log_info_array);
$inline_forms_photo_status_check = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid),T_PD_INLINE_PHOTO_FORM_STATUS);
///die();
//$inline_forms_photo_status_check = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid),T_PD_INLINE_PHOTO_FORM_STATUS);
// print_r($inline_forms_photo_status_check);
// echo count($inline_forms_photo_status_check);
@ -2397,22 +2398,17 @@ public function assignPDTempalate($data)
}
//Save Any New Applicants Details From General Form
if($formid == 18)
{
$records = $this->saveCoApplicantsFromGeneralInfoForm($records);
if(!count($inline_forms_photo_status_check))
{
$records = INLINEPHOTOTRANSFORM::retransformGeneralFormInlinePhotos($records);
//update general form photos saved once
$this->PD_Model->saveRecords(array('fk_pd_id' => $pdid,'is_general_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS);
// if($formid == 18)
// {
// $records = $this->saveCoApplicantsFromGeneralInfoForm($records);
// if(!count($inline_forms_photo_status_check))
// {
// $records = INLINEPHOTOTRANSFORM::retransformGeneralFormInlinePhotos($records);
// //update general form photos saved once
// $this->PD_Model->saveRecords(array('fk_pd_id' => $pdid,'is_general_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS);
// }
}
}
// }
if($formid == 10)
{
@ -2424,11 +2420,11 @@ public function assignPDTempalate($data)
{
$this->saveEmpSalaryAsBusinessExpensesFromBusinessForm($records);
if(count($inline_forms_photo_status_check) && $inline_forms_photo_status_check[0]['is_business_photo_saved'] != 1)
{
$records = INLINEPHOTOTRANSFORM::retransformBusinessFormInlinePhotos($records);
$this->PD_Model->updateRecords(array('is_business_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS,array('fk_pd_id' => $pdid));
}
// if(count($inline_forms_photo_status_check) && $inline_forms_photo_status_check[0]['is_business_photo_saved'] != 1)
// {
// $records = INLINEPHOTOTRANSFORM::retransformBusinessFormInlinePhotos($records);
// $this->PD_Model->updateRecords(array('is_business_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS,array('fk_pd_id' => $pdid));
// }
}
if($formid == 22)
@ -2593,6 +2589,7 @@ public function assignPDTempalate($data)
public function getPDFormDetailsJSON_post()
{
//echo (memory_get_usage()/1024) /1024;die();
$pd_id = $this->post('pd_id');
$pd_form_id = $this->post('pd_form_id');
$parent_pd_id = $this->post('parent_pdid');// ? $this->post('parent_pd_id') : null;
@ -4681,10 +4678,10 @@ public function getPDFormDetailsJSON_post()
//Get Common Images
$data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report');
$temp = 'DEFAULT DATA';
if($data['pd_master_details'][0]['lender_short_name'] == 'CLIX')
{
$t = $this->load->view('report_templates/JSONTOREPORT_CLIX',$data,true);
$temp = $this->load->view('report_templates/JSONTOREPORT_CLIX',$data,true);
}
else if($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-RI')
{
@ -7892,7 +7889,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$person_met_is_applicant_count = 0;
$person_met_selfie_count = 0;
$person_met_id_proof_count = 0;
//print_r( $general_form['individuals'] );die();
foreach($general_form['individuals'] as $person)
{
@ -8822,4 +8819,113 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
// die();
}
public function saveApplicantFromGeneralForm_post()
{
$records = $this->post();
$current_operation = null;
$applicant_id = null;
//print_r($records);
$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 );
//print_r($applicant_details);
if($records['pd_co_applicant_id'] == " " || $records['pd_co_applicant_id'] == null)
{
$applicant_id = $this->PD_Model->saveRecords($applicant_details,PDAPPLICANTSDETAILS);
$current_operation = 1;// 1 means INSERT
}
else
{
unset($applicant_details['applicant_type']);
$applicant_id = $this->PD_Model->updateRecords($applicant_details,PDAPPLICANTSDETAILS,array('pd_co_applicant_id' => $records['pd_co_applicant_id']));
$current_operation = 2;// 2 means UPDATE
}
//echo $current_operation.$applicant_id;die();
if($records['is_person_met'])
{
$img_data = array();
if($current_operation == 1)
{
if($records['is_person_met_pic'] != "")
{
$img_data[] = array('Name' => $records['applicant_name'], 'image' => $records['is_person_met_pic'], 'link' => $records['link']);
}
if($records['is_person_met_id_proof'] != "")
{
$img_data[] = array('Name' => ($records['applicant_name'].'-id_proof'), 'image' => $records['is_person_met_id_proof'], 'link' => $records['link']);
}
}
//print_r( $img_data );
if($current_operation == 2) // Make inactive old entries with same data
{
$sql = 'UPDATE '. PDDOCUMENTS.' SET isactive = 0 where fk_pd_id = '.$records['fk_pd_id'];
$where1 = '';
$where2 = '';
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']);
$where1 = $records['applicant_name'];
}
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']);
$where1 = ($records['applicant_name'].'-id_proof');
}
if($where1 != '' || $where2 != '')
{
$sql .= ' and (pd_document_title = ? or pd_document_title = ?)';
$this->db->query($sql, array($where1, $where2));
}
}
if(count($img_data))
{
$this->saveBase64Images($records['fk_pd_id'],18,null,null,$img_data);
}
}
$is_person_met_id_proof = '';
$is_person_met_pic = '';
$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'];
$applicant_name = $this->PD_Model->selectCustomRecords(array('pd_document_name'),array('fk_pd_id' => $records['fk_pd_id'],'pd_document_title' => ($records['applicant_name'])),PDDOCUMENTS);
if(count($applicant_name))
{
$profilepics3path = 'pd'.$records['fk_pd_id'].'/'.($applicant_name[0]['pd_document_name']);
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'30 minutes');
$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')),PDDOCUMENTS);
if(count($applicant_name_id))
{
$profilepics3path = 'pd'.$records['fk_pd_id'].'/'.($applicant_name_id[0]['pd_document_name']);
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'30 minutes');
$is_person_met_id_proof = $singed_uri;
}
if($applicant_id != null)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = array("pd_co_applicant_id" => $applicant_id,"is_person_met_pic" => $is_person_met_pic, "is_person_met_id_proof" => $is_person_met_id_proof);
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$data['msg'] = 'Data Not Updated, Try one more!';
$this->response($data,REST_Controller::HTTP_OK);
}
//pd_co_applicant_id, fk_pd_id, , applicant_type, mobile_no, landline, email, isactive, addressline1, addressline2, addressline3, fk_city, fk_state, pincode, relation, company_name, applicant_title_name, additional_pd_id
}
}

View File

@ -298,6 +298,7 @@ class PD_Model extends SPARQ_Model {
$time = '+5 day';
}
//print_r($where_condition_array);die();
$where_condition_array['isactive'] = 1;
$document_lists = $this->selectRecords(PDDOCUMENTS,$where_condition_array);
if(count($document_lists))

View File

@ -2355,7 +2355,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
// $getService=array();
//$getTotalPaymentsPercentonCredit=array();
$client_first_row = '<tr><td class="customtd">1</td><td class="customtd">Product / Service </td>';
$client_second_row = '<tr><td class="customtd">2</td><td class="customtd">Contact Person </td>';
$client_second_row = '<tr><td class="customtd">2</td><td class="customtd">Client Name </td>';
$client_third_row = '<tr><td class="customtd">3</td><td class="customtd">Mobile Number </td>';
$client_fourth_row = '<tr><td class="customtd">4</td><td class="customtd">Landline No</td>';
$client_fifth_row = '<tr><td class="customtd">5</td><td class="customtd">Payment Terms</td>';
@ -2636,7 +2636,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
}
$temp['supplier_first_row'] = '<tr><td class="customtd">1</td><td class="customtd_leftalign">Item Purchased </td>'.'<td class="customtd">'.$raw['manufacturing_raw_material_name'].'</td></tr>';
$supplier_second_row = '<tr><td class="customtd">2</td><td class="customtd_leftalign">Contact Person </td>';
$supplier_second_row = '<tr><td class="customtd">2</td><td class="customtd_leftalign">Supplier Name </td>';
$supplier_second_row .= isset($raw['person_title_name_master']) ? '<td class="customtd">' . $raw['person_title_name_master'].' ': '<td class="customtd">' . '';
$supplier_second_row .= $raw['manufacturing_contact_person_name'] ;
@ -3630,7 +3630,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
?>
<h3 contenteditable="true">Personal Banking: </h3>
<!-- <h3 contenteditable="true">Personal Banking: </h3> -->
<?php if($is_personal_banking_available != null){
//print_r($bankingResult);
?>
@ -3759,7 +3759,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$residence_text .= (!strcasecmp($fmValue['residence_ownership'],'rented')) ? '<span contenteditable="true"> The rent paid '.$rupee_symbol.' </span>'.$fmValue['rent'].'<span contenteditable="true"> per month.</span>' : '';
$clix_dependency_text = 'There are totally '.$fmValue['no_family_members_clix'].' family members';
$clix_dependency_text .= isset($fmValue['no_dependents_clix']) && $fmValue['no_dependents_clix'] != 0 ? (' and ' . $fmValue['no_dependents_clix']. ' of them have dependencies on applicant.'): ' and no dependencies.';
$clix_dependency_text .= isset($fmValue['no_dependents_clix']) && $fmValue['no_dependents_clix'] != 0 ? (' and ' . $fmValue['no_dependents_clix']. ' of them have dependencies on applicant.'): ' and no dependencies on applicant.';
echo $intro_text;echo "<br><br>";echo $residence_text;echo "<br><br>";echo $clix_dependency_text;